Page 1 of 1

hard disk image

PostPosted: Tue Sep 27, 2005 4:52 pm
by Master of Reality
I think i have to get my laptop replaced (screen is a bit messed, i believe from a twisted cable or some such thing) and i dont want to reinstall everything when i get it replaced. Would i be able to create a hard disk image so that i could do that?
Would dd be able to create the image and do that with this?
# dd if=/dev/hda of=disk.img

And i have two partitions so would i have to do them separetly or the hard disk altogether?

Would the image be the complete 60GB of the hard disk, or would i be able to make it smaller so that it was just the 20GB of data i have on it?

It will be an exact replacement of the laptop so there should be no hardware issues.

PostPosted: Tue Sep 27, 2005 5:19 pm
by Void Main
Unless the drives are identical I wouldn't dd /dev/hda. Even if you think they are I wouldn't. If I use dd to back up a disk I usually do it partition by partition and yes, dd has to read the entire file system so you might want to shrink it first. There are alternatives. You can also use something like partimage:

http://www.partimage.org/

You could also just tar it up. Make sure that if you use dd that the partition you are backing up is unmounted and if using tar it's best to boot form alternate media and mounting the partition to tar up just to make sure all files are not being written to.

PostPosted: Thu Sep 29, 2005 2:10 pm
by Master of Reality
Do I have to do anything special to "format" a harddrive or do i just delete the current partitions, remake them with linux format, and then make2fs?

I have an 80GB external drive that current has a vfat partition that has some useless stuff on it which i am going to use to store my images.

PostPosted: Thu Sep 29, 2005 3:13 pm
by Ice9
Nothing special, just did it with a spare 80GB drive I put in an Icy Box.
All I really did was fdisk /dev/sda, erase everything, make 2 new partitions and then mkfs -t ext3 /dev/sdax

PostPosted: Thu Sep 29, 2005 3:20 pm
by Void Main
You don't even have to do the mkfs. All you have to do is create the partitions because the filesystem is actually what you dd'd. When you write it back to the new partition it will be your in tact file system. It will just overwrite whatever file system you make there when writing the image back so... Before I back up a partition using dd I usually shrink the file system. I restore it to the new partition (or just dd from one partition to the new partition, even over ssh if on a remote machine, then I resize the file system on the new partition to take up the full space on the partition (resize2fs etc).

PostPosted: Sat Oct 01, 2005 9:40 am
by Master of Reality
i actually ended up using partimage, and so i did have to re create the filesystem, although i messed it up by trying to make a reiserfs 4 filesystem, which wasnt supported by the rescue disk distro i was using. Eventually I did figure out to put the ext3 on and save the images to it.

PostPosted: Thu Oct 06, 2005 8:46 am
by Master of Reality
just a note to anyone having to send a laptop back.... i wouldnt suggest leaving in your rescueCD in the laptop you are returning which you will need to put the images on your new laptop.

Other than that... partimage is great to use for this.