• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Least intrusive way to dd-backup a live partition

Ken g6

Programming Moderator, Elite Member
Moderator
OK, here's my situation:

1. I have Ubuntu installed on one large partition (650GB). Not the best decision, I know, but it will not be reversed easily, or at all if I don't get this done.
2. I recently purchased a much larger drive (2TB). On this drive I made two large partitions. Most of the space goes to random files I don't want backed up. The rest is a partition of identical size to the main 650GB partition.

What I'd like to do, obviously, is to dd the main partition to the backup space. I really do want something like dd, so that if the main drive ever fails I can just set the backup partition to be active and continue on my way. The problem is that I can't do this while Ubuntu is running from the main partition.

In the past I've booted from a LiveCD and run the dd command from there. This is inconvenient because I have to turn off my main OS, and it won't come back on automatically. Tonight I tried the same thing from an Ubuntu 10.04.3 LiveCD, and I had a few problems. First, it's not completely clear which partition I need to dd from and to. I can find out, of course, but if I get it wrong...poof go my files. I can write a script and put it on the extra partition, but I'm not entirely confident that sda will always be the backup drive and sdb will always be the main drive. Again, get it wrong and poof go my files. I got it right this time, but it was nerve-wracking. Second, for whatever reason, bad optical drive or something, the Ubuntu 10.04.3 LiveCD wasn't entirely stable. I aborted long before the dd was done.

Therefore, my ideal system would be one that runs from within the on-disk main Ubuntu system, unmounts all drives, performs the dd, re-mounts the drives, and puts me back where I was. Hibernating the OS, while not ideal, would be an acceptable way to do this. Is there any such system out there?

If that doesn't work, then I'm looking for a small OS (preferably one that fits in 4GB) that I could stick in a free partition on the drive and boot to, which always boots the drives in the same order, and which can read/write multi-TB drives with dd. That's not too much to ask, is it? Any specific suggestions, or particularly backup-oriented OSes? 'Twould also be nice if it had a web browser to browse these forums while I wait, but not essential.
 
Don't do it. dd will read the drive/filesystem directly which won't include any data that's still cached in memory and not flushed to disk yet. Unless you can remount the filesystem read-only you will eventually get corrupt data.

If you're using LVM and have free space in the VG you can take a snapshot of the LV and then back that up.

Ken g6 said:
but I'm not entirely confident that sda will always be the backup drive and sdb will always be the main drive.

Because you're not guaranteed that. You need to use the symlinks under /dev/disk if you want a stable name for a disk.
 
Well, I'm not going to dd while the system is live. I was looking for some software that would dump everything (possibly to the swapfile), unmount all filesystems, do the DD, and then reload everything OR reboot.

My kernel's too old for LVM. Ubuntu 9.04 is what's on the disk. I need to do this to upgrade as well, as last time I upgraded to 9.10 I had other issues.

Thanks for letting me know about /dev/disk!!! One way or another I'll probably wind up using that.
 
Back
Top