I'm a stone's throw from having a perfect linux server, but there are a few things that are vexing me at the moment. Most importantly, I'd like to be able to take a live disk snapshot of my boot hard drive for disaster recovery.
The boot device (obviously /dev/sda) is MBR partitioned, with 5 partitions on the disk:
Device Boot Start End Blocks Id System
/dev/sda1 1 8287 66565296 83 Linux
/dev/sda2 * 8288 8300 102400 7 HPFS/NTFS
/dev/sda3 8300 15589 58545962+ 7 HPFS/NTFS
/dev/sda4 15589 19453 31034369 5 Extended
/dev/sda5 15589 19288 29710336 83 Linux
/dev/sda6 19288 19453 1323008 82 Linux swap / Solaris
/dev/sda5 is the partition on which linux sits, formatted ext3 (default, by the installer) the other partitions are for Windows and the swap etc..
I've been trying for a while now to get a dd image to restore successfully to a(nother) drive so that I can boot it and resume where I left off before the (currently hypothetical) disaster.
If I take an image of the drive (sudo dd if=/dev/sda of=/path/to/some.img) dd only copies /dev/sda5. The image is fairly corrupt, however after a quick fsck (sudo fsck -y /path/to/some.img)
the image can be mounted and seems complete. When I try to boot with the device, however BIOS throws the error:
No boot device found (blah, blah)
If I copy the drive to another device (sudo dd if=/dev/sda of=/dev/sdf conv=sync,noerrors) the partition structure is recreated. Again, a quick fsck brings /dev/sdf5 back to a point where it can be mounted, however it is missing about half the folders from / , notably /etc, /usr and a few others. When I try to boot with this device, I get the error:
Cannot mount ... device, wn-blcok (0,0)
What I'd like to be able to do is boot from this dd image. I don't mind if it doesn't recreate the whole device, all I need is the boot partition. On these forums somewhere are instructions to tell GRUB the new disk UUIDs and mount points, however GRUB2 uses grub.cfg (or similar) instead of the menu.lst file given in the tutorial, so I can't tell GRUB about the new device, especially in the second case where /etc is missing (so I have no /etc/fstab).
Please, does anyone know of a way I can automatically take a live system image from which I can boot? I'm fairly open to suggestions, including the use of scripts to start restart the machine from a recovery disk, take a snapshot then boot back into the system proper. Obviously I'm backing the system up (with BackInTime), although it misses several key config files I'm desperate to keep. Plus it'd be great to have a warm recovery option.
Standard Ubuntu 10.04 x86 (32bit) installation (with X)
/dev/sda5: MBR, with NTFS and ext3 partitions
Oh, and it'd be great if this could all be accomplished whilst the machine is running!
If anyone out there has any experience with live system snapshots, dd or disaster recovery, please let me know. The machine is getting very, very good at what it does and I'll be writing HOWTOs for everything it does when I get it to the point I consider stable so the love will be returned to the community.