[Update] It looks like this only really applies to USB flash drives.  When I mounted my actual backup drive, it showed up in prtpart.  This post was written using the root drive on my old backup server, which is a SanDisk Cruzer flash drive.


Now that I finally got my mini thumper up and online, it’s time pull everything from my previous  backup drive.  The problem is that it’s a USB drive with an ext3 partition on it.  I did a little googling and found several references to using the belenix FSWpart and FSWfsmisc packages, with this one being the most helpful.

My only problem was that when I ran prtpart, it only showed disk information for my non-USB drives.  I could see that the drive was recognized by looking in syslog:

root@silo:~# cat /var/adm/messages
Mar 14 12:03:36 silo usba: [ID 349649 kern.info]        SanDisk U3 Cruzer Micro 0774920CB281D664
Mar 14 12:03:36 silo genunix: [ID 936769 kern.info] scsa2usb0 is /pci@0,0/pci1462,7418@1d,3/storage@1
...

So, I dug around a bit, trying to look for various names in /dev/rdsk that were in the above output when I stumbled across the fact that everything in /dev/rdsk is a symlink.  So I did a quick grep:

root@silo:~# ls -al /dev/rdsk/ | grep /pci@0,0/pci1462,7418@1d,3/storage@1
lrwxrwxrwx   1 root root  64 2010-03-14 12:03 c11t0d0p0 -> ../../devices/pci@0,0/pci1462,7418@1d,3/storage@1/disk@0,0:q,raw
lrwxrwxrwx   1 root root  64 2010-03-14 12:03 c11t0d0p1 -> ../../devices/pci@0,0/pci1462,7418@1d,3/storage@1/disk@0,0:r,raw
....

Aha! Now I know what the device name is, so I can use prtpart to figure out what to mount:

root@silo:~# prtpart /dev/rdsk/c11t0d0p0 -ldevs
Fdisk information for device /dev/rdsk/c11t0d0p0

** NOTE **
/dev/dsk/c11t0d0p0      - Physical device referring to entire physical disk
/dev/dsk/c11t0d0p1 - p4 - Physical devices referring to the 4 primary partitions
/dev/dsk/c11t0d0p5 ...  - Virtual devices referring to logical partitions

Virtual device names can be used to access EXT2 and NTFS on logical partitions

/dev/dsk/c11t0d0p1      Linux native

And mount it:

root@silo:~# mkdir /mnt/linux
root@silo:~# mount -F ext2fs /dev/dsk/c11t0d0p1 /mnt/linux
root@silo:~# ls /mnt/linux/
bin  dev  etc  home  initrd  lib  lost+found  media  mnt  proc  root  sbin  sys  tmp  usr  var  www

After basically copying my friend’s exact specifications, I now have a little server at home with 1.5T of mirrored disk space.  By and large it was a straightforward process, with the following interesting tidbits.

Most of the assembly went smoothly.  You do have to pull the motherboard out to get the CF drive into its slot.  In order to maneuver it out, you have to unclip the SATA cables and unscrew the VGA connector.

case

You can see the SATA cables snaking up the left and top and the VGA connector is in the lower right (blue).  The CF slot is just left of center at the bottom of the picture.  Here’s a picture with the drive and RAM installed.

case2

The other issue I ran into was related to the optical drive bay.  My first drive slid in and mounted fine in the HD bay, but I was stuck without brackets to properly secure the second drive in the 5.25 inch bay.  I could have just put it in and held it with one screw, but after figuring that this is my backup server, I opted to head to Best Buy to pick up the brackets.

When I got there, I was informed that they don’t carry them any more and that I would have to pay a visit to Fry’s.  Well, I hate going to Fry’s more than most bad things in life, so I called it a day and decided to figure it out later.  Then, earlier this week, Sara and I were walking by a little local computer shop named *techquest.  The proprietor was able to dig up a pair of brackets, so I bought them from him.

Yesterday, I finished assembling the hardware and then spent a while trying to figure out how to get it to boot OpenSolaris from the USB drive I had created.

The first problem was that I couldn’t get into the Wind BIOS.  I could see it flash something on the screen after POST beeping, but it was cleared far too fast for me to get any information.  After rebooting a few times and only getting a few words, I turned my iPhone video camera on it and was able to finally read the information with a well timed pause.

The rest of my issues revolved around the unique arrangement of boot options in the BIOS and having to remove the stupid U3 stuff from the Cruzer so that it behaved like a simple USB disk, but soon enough I was installing OpenSolaris.

The little box now sits in my entertainment center, ready for me to start transferring data to it.

11th Jan, 2010

The Arduino Collective

A friend and I have started a side blog to track our experiments in electronics.

It’s over at The Arduino Collective.

It can happen to the best of us.

Take this opportunity to make sure your site is properly backed up.  And while you’re at it, upgrade WordPress too.

For a while now, I’ve been backing up the few WordPress blogs that I run for various people with a very simple script that followed this algorithm:

  1. Copy files to a temporary directory.
  2. Dump the MySQL data into a file in that directory.
  3. Tarball it up.
  4. Scp that file to another server that I run.

At the time, I did this because it was the simplest thing that could possibly work.  It didn’t depend on any external facility other than mysqldump, tar, and scp.

Well, running that script on a nightly cron filled up my disk allocation on that remote server a couple times, so I got clever with the backup organization so I could quickly remove old backups while keeping sparser (monthly) backups for longer.  This only helped a little, because I was still nervous about deleting backups because I didn’t know what they contained.

I also have been using git more and more recently and I liked the idea of version control that can go in any direction.  So, in the spare bits of time I’ve had in the past few weeks, I wrote git_backup.pl.  It takes a git repository and does the following:

  • git add <any new or modified files>
  • git rm <any deleted files>
  • git commit
  • git push backup

Now, when the backup is run, only the small changes are sent to the remote server and I can look at the differences by examining the git log.

There are options for dumping database tables, changing the commit message and the remote that gets the push.  Running “git_backup.pl –man” will show all the options.

The source is (of course) in a git repo: http://git.endot.org/git_backup.git

The tree and history can be browsed at http://git.endot.org/.

Being the data and visualization nerd that I am, I’ve been delving into R on occasion.  For this purpose, I am using R.app on my Mac.  To start it up for a certain working directory (to keep different projects separate), I run “open -a R <working dir>”.  This worked great until I noticed that my history wasn’t getting saved to the .Rhistory file in each directory.  When I use the command line R executable it does, but not in the R.app GUI.

So, it took me a little while to figure out that it’s a bug in the R.app code and you have to use a workaround.  Open R.app’s preferences and set the “R history file” key to something other than “.Rhistory”:

rhistory

Now, after a restart, the .nateRhistory file in the working directory is properly updated.

Observed many times and today is rampant proof:

The surest way to be interrupted at your desk is to put on some headphones and turn on a good album.

And there’s an interesting corollary:

The surest way to NOT be interrupted at your desk is to put on some headphones and play NO MUSIC AT ALL.

In an attempt to pursue a hobby that does not involve a heap of monitor staring, I decided to get more serious about photography.  I’ve always enjoyed taking pictures, but I wanted to get deeper into the process.  So, I saved up some money and purchased a used Canon 30D from a friend back in March.  In the months that followed, I noticed myself passing through several stages as I got used to photography as a hobby rather than just image capture.  In retrospect, I thought they were rather funny.  I’ll share them over the next few blog posts.

15th Aug, 2009

A Plane Birthday

Today was a great day.  Today Sara and I celebrated my birthday.  She planned the whole thing out, so all I had to do was go along for the ride.

After sleeping in till 10:30 (due to a late night up in Hollywood catching District 9 with some old friends), we ate a breakfast of waffles and bacon with pineapple and apple juice.  We took our time and really enjoyed each other’s company.

Then, after cleaning up and getting directions, we headed up to the Van Nuys Airport.  Ever since I saw One Six Right, I wanted to go up to Van Nuys to see the airport firsthand and of course, to watch the airplanes.  We first tried the little viewing area to the west of the airport.  It’s a good area to sit and watch the planes come in, but isn’t the best for taking pictures or getting very close to the aircraft.  So, thanks to a posting on airliners.net, we went to the other side of the airport to the intersection of Arminta and Hayvenhurst.  The view wasn’t any better over there, but just before the corner we spotted several old airplanes and decided to stop.

The planes all belonged to the Condor Squadron, and we were able to go through the fence and walk among the planes.  They are all AT-6/SNJ trainers that were used in World War II.  We met Chris and John, two members who own individual planes.  They were cleaning up and refueling after doing a simulated dogfight over the Lane Victory earlier in the afternoon.  It was great to talk with them and learn a bit about their planes.  I took quite a few pictures, which I will try to post tomorrow.

After we left Van Nuys, we headed down to LAX and went to the Proud Bird for dinner.  Since we were early (only 5pm), it wasn’t crowded at all and we were able to get a table right on the window.  The prime rib and mashed potatoes were great and we just finished up the day with chocolate cake and a movie.

All in all it was a great day.  Thanks for making it special, babe.

I’m always looking for ways to improve myself as a programmer.  It usually involves something fun, but after reading this post, I think my new area of improvement is to stop increasing my technical debt.

From a related post from Steve McConnell:

Other debt accumulates from taking hundreds or thousands of small shortcuts–generic variable names, sparse comments, creating one class in a case where you should create two, not following coding conventions, and so on. This kind of debt is like credit card debt.

I was doing a review of some relatively mature (3 years) code today with the rest of my team and I found more instances of this kind of technical debt than I would like to admit.

There are other kinds of technical debt, and it’s easy to hate them and the reasons for incurring them, but this small stuff is totally under my control.  And it has to stop.

Categories