There should be no problem running the backup dd and gzip on a mounted filesystem.
-GC
There should be no problem running the backup dd and gzip on a mounted filesystem.
-GC
"Nice jail. Looks strong."
- H. Houdini
Updated post with image clean up information.
-GC
"Nice jail. Looks strong."
- H. Houdini
So, if you are using this method to backup a 100 GB sda drive and later want to restore to a 200 GB drive, you would:
sfdisk /dev/sda < partition_structure_sda.dump
restore image
Then resize the partition up to 200 GB using gparted?
Hi mdsharp24,
If you image your 100gb drive using the /dev/sda and you want to restore the image to a larger drive you do *not* need to restore the partition table with...
Creating an image using anyone of the methods I've listed will capture bit for bit backup of everything on the original drive including the drives partition table and structure. So all you would need to do is restore your backup to the larger drive, using one of the methods I've described, and use gparted to resize your partitions.Code:sfdisk /dev/sda < partition_structure_sda.dump
That said, if you can... I would install your new drive as a secondary drive in your PC and run a direct dd from your 100gb drive to the 200gb drive.
Assuming that your old 100gb is /dev/sda and your new 200gb is /dev/sdb you could clone your 100gb to the 200gb directly using...
If you already have the gparted install on your 100gb you can run it and resize the partitions on /dev/sdb. Then power down your system swap the cables and test booting off your new drive.Code:sudo dd bs=15M if=/dev/sda of=/dev/sdb
Hope this helps,
-GC
Last edited by GrammatonCleric; August 1st, 2008 at 12:56 PM.
"Nice jail. Looks strong."
- H. Houdini
Very cool! So running dd if=/dev/zero of=/tmp/disk_zero_fill.tmp bs=8M; rm -f /tmp/disk_zero_fill.tmp on the live filesystem will actually wipe free space?
mdsharp24,
I would not say "wipe" rather over write. Picture a balloon being blown up inside a glass, filling all the empty space until none exists then the balloon pops ( i.e. rm -f /tmp/disk_zero_fill.tmp). So the...
...over writes any files that have have been flagged as deleted.Code:dd if=/dev/zero of=/tmp/disk_zero_fill.tmp bs=8M; rm -f /tmp/disk_zero_fill.tmp
If you want to securely clear empty space on your drive take a look at "scrub."
http://ubuntuforums.org/showthread.php?t=333309
- GC
"Nice jail. Looks strong."
- H. Houdini
Thanks for this fabulous howto. I just used dd for the first time right before I found this thread. (It's actually still going as I type this), and I do wish I had noted the ability to compress the image on the fly as you show in your examples.
If you don't mind explaining a bit just for my curiosity, regarding your USB example (just because it's the one most applicable to what I'm doing)
I assume I can look up conv=sync,noerror but I'm curious why use of gzip (apparently) removes the need for an of= paramerter (even though I can see that of course you have specified the actual output path).Code:sudo dd bs=15M if=/dev/sda conv=sync,noerror | gzip -9 > /media/path/to/usbdrive/ubuntu_linux.img.gz
Just curious...
Thanks!
Hi converted,
Sorry for the delay in replying, busy week but then aren't they all? =)
In the simplest terms there is no need to use the "of=" option because in using the "if=" in conjunction with pipe (i.e. "|") and gzip dd is sending data directly to gzip to compress as it receives it.
Hope this helps.
-GC
Last edited by GrammatonCleric; August 30th, 2008 at 02:44 PM.
"Nice jail. Looks strong."
- H. Houdini
Heh -- I do know how that is, and didn't get back to check this until today.
Wow, a more helpful response than you could know. I knew that was a pipe symbol, but had no idea (until further googling based on your response) that this literally instructs one process to "pipe" data over to another, nor that using it in this fashion is what an "unnamed pipe" is.
Years of tinkering (though only recently with Linux) and you've filled in yet another hole (I'd heard the term, but didn't even have the vaguest notion of what it meant) that none of my classes nor prior experiences had forced me to learn.
And I also now understand why so many commands I've used from howtos and such have contained that symbol. I had no idea what the significance was.
Thanks!!
I would like to make a system image on my external USB HDD.
So I attempted to follow your USB example instructions.
I had a problem, when I entered in Terminal:
Code:
sudo dd bs=15M if=/dev/sda conv=sync,noerror | gzip -9 > /media/path/to/usbdrive/ubuntu_linux.img.gz
The output was:
bash: /media/path/to/usbdrive/ubuntu_linux.img.gz: No such file or directory
The results of 'df -h' are:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 71G 4.0G 63G 6% /
varrun 1006M 100K 1006M 1% /var/run
varlock 1006M 0 1006M 0% /var/lock
procbususb 1006M 136K 1006M 1% /proc/bus/usb
udev 1006M 136K 1006M 1% /dev
devshm 1006M 16K 1006M 1% /dev/shm
lrm 1006M 33M 973M 4% /lib/modules/2.6.20-17-generic/volatile
/dev/sdb1 299G 255G 45G 86% /media/Storage
/dev/sde1 150G 112G 38G 75% /media/NEXT 160
Am I supposed to alter the line of code,
so that '/usbdrive/' = '/dev/sde/' ?
(The System drive is sda1 and the external usb drive is sde1)
I'm Using 7.04 (Feisty) at the moment. Is that a problem?
Bookmarks