Rescuing Ancient FreeBSD Discs with Linux

The ancient FreeBSD/i386 box that was running finally keeled over. I just blew my afternoon/evening scraping the data off of it because while the most critical stuff was backed up, not everything was. Some keyword and error string filled notes that will hopefully save others swearing and googling:

  • A bit of digging in the lab turned up a working box with an UltraSCSI 320 controller to read the disc out of the machine. Hurray for obsolete hardware!
  • Clonezilla can interact with BSD Slices and UFS just fine.
  • Clonezilla, by default, produces an image per slice when working with BSD discs.
  • The builds of partclone (underlying tool in Clonezilla) packaged in all the major Distros are built without UFS support, so you will be using Clonezilla, and subsequently interacting with Clonezilla images of UFS file systems is a PITA.
  • From a Clonezilla system, unpacking their default image format into something you can loop mount elsewhere is sudo cat sdc1.ufs-ptcl-img.gz.aa | sudo gzip -d -c | sudo partclone.ufs -C -s - -o sdc1.img. The relevant FAQ entry misses the part where the partclone tools don’t work if not run as root. (It dies with “open logfile /var/logs/partclone.log error” – which, of course, it can’t write as a non-root user.)
  • CentOS (and other RHEL-alikes) don’t even package the UFS kernel module in the default repos. Thankfully, Arch does. modprobe ufs
  • The Linux kernel UFS driver can’t automatically discriminate the ufstype (because there aren’t any obvious things for it to probe based on) and doesn’t always completely fail if you guess wrong. If you actually have a 4.4BSD flavor UFS volume,
    • mount -o loop,ro,ufstype=old /path/to/disc.img /mnt/path = Mounts, warns “rec_len is too small for name_len” then sprays ufs_readdir: bad page in #2 errors in dmesg when you interact with it. “Old” seems to be the default behavior if not specified.
    • mount -o loop,ro,ufstype=ufs2 path/to/disc.img /mnt/path = Errors out, doesn’t mount.
    • mount -o loop,ro,ufstype=44bsd /path/to/disc.img /mnt/path = Naturally works, since that’s what the volume actually is.
  • A simple rsync -av /src /dst/. can copy the data out the loop-mounted volume.
  • I was told it was a FreeBSD 6 box (should have had UFS2 volumes). What was /usr/include/sys/syscall.h has a datestamp 2002/07/12, which implies I’m actually looking at the wreckage of a FreeBSD 4.6 box, and explains the older disc format.
  • I set up a machine to migrate to almost 3 years ago, it’s not my fault that new things were put on the new server, but the old stuff was never migrated.

Back up thoroughly and often, upgrade equipment before it fails, sing the praises of the crazy motherfuckers who keep tools for legacy formats working. Also, I need to spend more time with the BSDs, I’m getting rusty.

This entry was posted in Computers, General, School and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *