Backing up with dd, and creating a file system on a new drive.

Fred Roller froller at tnclimited.com
Fri Dec 18 13:50:31 UTC 2009


Ray Parrish wrote:
> Hello,
>
> I just got my new 500 GB drive, and am excited about being able to back 
> up my 160 GB old drive. Since I am new to the LInux camp, I need to know 
> how to set up the new drive, and how to use dd to image the 160 GB drive 
> to the 500 GB drive.
>
> After I do back up the small drive, and create partitions beyond what dd 
> writes there, will there be a problem with using dd to rewrite the back 
> up at a later date with the new partitions beyond the backup partitions?
>
> Can I use gparted to create an ntfs volume of the drive first, then use 
> dd to image the small one, or can I run dd on the unformatted drive 
> first to create the backup partitions?
>
> Thanks, Ray Parrish
>
>   
Ray,
    Install and format your new 500 Gb hdd.  Personally, if you are 
going to use it for backing up an external case may be worth the 
investment (.02).  At any rate, to use dd to back up your 160 Gb drive 
do the following:

Assumptions:
- 160Gb drive is primary system drive.
- 160Gb drive is /dev/sda
- 500Gb drive is /dev/sdb1
- we want to create a file /not/ move an image.
- you know how to open a terminal


1. boot with a live CD
2. open terminal and become superuser:

    sudo su -

3. mount the 500Gb hdd

    mount /dev/sdb1 /mnt

4. insure 160Gb hdd is /not/ mounted:

    df -h |grep /dev/sda

this should not return any results, if it does:
   
    umount [mount point of /dev/sda*]

5. Create .img backup

    dd if=/dev/sda of=/mnt/mybackup[date].img bs=512

6. take your spouse to dinner and a show, this will take a while, the 
best I have seen is 25Mb/sec, average has been 12-14Mb/sec, lows around 
3Mb/sec.  Assuming low average your backup should take about 3.7 hours 
(160000000000÷12000000÷60÷60=3.703703704).  End result, you should have 
an .img file of the hard drive.  Restoring is the same instructions 
except the dd command is reversed:

    dd if=/mnt/mybackup[date].img of=/dev/sda bs=512

two points to conclude on:
a. the .img is mountable so you can grab something if you need it.
b. it is possible to pipe the dd command through tar for a smaller archive.

I don't recall right off what those commands are; but, you should be 
able to google them.


   

-- 
Fred
www.fwrgallery.com

"Life is like linux, simple.  If you are fighting it you are doing something wrong."






More information about the ubuntu-users mailing list