Backing up & accessing CF
-
First off, I need to state that I am no BSD pro of any sort. I've a fair bit of general Linux experience (especially on Ubuntu), but I've been playing with pfSense, m0n0wall & IPCop (even SmoothWall before that) for some years now.
Right-o! Recently I got my hands on a ALIX system with pf pre-installed on a CF.
As is prudent, the first thing I did was pop it open (because that's what you do with new hardware), and pulled the CF cardI have an external USB multi-card reader/writer, & loaded it (connected to my Ubuntu system - Karmic-64)
Do a
sudo fdisk -l
& find the disk/drive/partition in question:Disk /dev/sde: 8012 MB, 8012390400 bytes 255 heads, 63 sectors/track, 974 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x90909090 Device Boot Start End Blocks Id System /dev/sde4 * 1 4 25000 a5 FreeBSD Partition 4 has different physical/logical endings: phys=(1023, 254, 63) logical=(3, 28, 41) This disk has both DOS and BSD magic. Give the 'b' command to go to BSD mode. Disk /dev/sde4: 25 MB, 25600000 bytes 255 heads, 63 sectors/track, 3 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x90909090 Device Boot Start End Blocks Id System /dev/sde4p4 * 1 4 25000 a5 FreeBSD Partition 4 has different physical/logical endings: phys=(1023, 254, 63) logical=(3, 28, 41)
Note that it doesn't quite know what's going on & that the BSD partition is on #4
OK, now to make thorough backups. I'm making backups of both the entire block device & the partition, because I don't quite know what to expect from "BSD magic":
NOWDATE=$(date +%Y%m%d) sudo dd if=/dev/sde4 of=pfsense.disk.$NOWDATE.img sudo dd if=/dev/sde4p4 of=pfsense.part.$NOWDATE.img tar vfvz pfsense.snapshot.$NOWDATE.tar.gz pfsense.disk.$NOWDATE.img pfsense.part.$NOWDATE.img rm -vi pfsense.disk.$NOWDATE.img pfsense.part.$NOWDATE.img
OK, so now I'm pretty confident that I can safely break anything on the disk without having to worry too much about the consequences :p
Now, for the entire purpose of my original exercise: to mount the disk (ro at this stage):sudo mkdir /mnt/pfsense sudo mount -r -v -t ufs -o ufstype=ufs2 /dev/sde4p4 /mnt/pfsense ls -Al /mnt/pfsense
Ta-da! :)
This was not very well-documented elsewhere, so there you go.Have fun!