I'm just making sure this is doing what I think and want, I got the command off of this site http://www.linuxweblog.com/dd-image and looked at the man pages it seems correct to me.
Currently in a live cd environment
I'm wanting to image my entire drive (251GB) then compress it and send it over to my usb drive (160GB) I hope it fits
for restorationCode:dd if=/dev/sda conv=sync,noerror bs=1k | bzip2 -c > /media/disk-2/sda.img.bz2
The guide also says to create a text file with partition info using the command below, and using this text file you can restore a specific partition.Code:bzcat /media/<usb disk>/sda.img.bz2 | dd of=/dev/sda bs=1k
so my fdisk -l looks like thisCode:fdisk -l /dev/sda > /media/<usb drive>/sda_fdisk.info
Then to restore sda5 I would do this. This command just doesn't look right to me (of=/tmp/sda5.img should be /dev/sda5 shouldn't it?)Code:Disk /dev/sda: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors/track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xd300d300 Device Boot Start End Blocks Id System /dev/sda1 * 1 30515 245111706 5 Extended /dev/sda5 1 3039 24410704+ 83 Linux /dev/sda6 3040 3101 497983+ 82 Linux swap / Solaris /dev/sda7 3102 30515 220202923+ 83 Linux
edit: second look I guess I just pretend sda1 doesn't exist and don't skip ahead (30515 is the end of my drive)Code:bzcat /<path to usb disk>/<sda.img.bz2> | dd of=/dev/sda5 bs=512 skip=1 count=$[3039-1]
another edit: On further review it looks like it's better to use bs=1k, so I have edited my commands to reflect that.
I found a small usb drive to test all the commands on and everything is working fine except I can't figure out how to restore a single partition from the full drive image, only the whole drive.
If anybody knows the correct way to grab a single partition out of the whole drive image feel free to chime in. I'll keep googling meanwhile.



Adv Reply


Bookmarks