You are not logged in.

#1 2009-05-21 00:25:53

blazercist
Member
Registered: 2009-01-18
Posts: 20

Copying to NEW HDD using dd?

Here's the situation, I have an old SATA1 WD Raptor HDD (74GB @10,000RPM) Here's the fdisk -l output:

Disk /dev/sda: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa9e2ea24

I bought a new Western Digital VelociRaptor WD3000HLFS(300GB  @10000 RPM)

I want to hook it up, boot into my existing install and issue the following command:

sudo dd if=/dev/sda of=/dev/sdb

1.  This will copy my MBR /boot / and /home correct?
2.  I will need to change the UUID's in menu.lst on /dev/sdb to match those of that drive?
3.  Will I be able to resize /home to take up the remaining free space? (I dont need to resize /boot or / they are fine)
4.  Will I be able to then physically remove /dev/sda (formerly) and replace it with /dev/sdb thus making what was /dev/sdb into /dev/sda? 
5.  Will it boot?
6.  Outside of human error is there any danger to the original /dev/sda from the dd command? (From what I understand dd only reads on "if" so there shouldn't be any danger but perhaps I'm wrong)
7.  Finally if all the preceding stuff works, will I be able to convert to EXT4?

If I've left any useful info out please let me know.  Thanks in advance.

Offline

#2 2009-05-21 00:33:12

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Copying to NEW HDD using dd?

1. Yes
2. Yes, use "blkid" to get them, and change /etc/fstab as well
3. Only if /home is at the end of the disk (so the new space is right next to it)
4. Yes
5. I don't see any reason why not, if it doesn't, you can always use the install image to fix GRUB
6. No
7. Only if use currently use ext2 or ext3

Offline

#3 2009-05-21 00:35:37

blazercist
Member
Registered: 2009-01-18
Posts: 20

Re: Copying to NEW HDD using dd?

Sorry I forgot to listen my partition tables so here they are.

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1           4       32098+  83  Linux (/boot)
/dev/sda2               5        3043    24410767+  83  Linux  (/)
/dev/sda3            3044        9039    48162870   83  Linux  (/home)

Thanks ataraxia, any second opinions?

Offline

#4 2009-05-21 03:07:05

jwcxz
Member
Registered: 2008-09-23
Posts: 239
Website

Re: Copying to NEW HDD using dd?

I actually just used dar when copying my old installation to my new hard drive on my laptop.  It was very painless because dar preserves everything automatically.  Then, I only needed to install GRUB again (a 30-second process using an Arch installation disk) and I was done.  I also chose this over using dd because I wanted to tweak my XFS filesystem a bit and did not do so the first time around...


-- jwc
http://jwcxz.com/ | blog
dotman - manage your dotfiles across multiple environments
icsy - an alarm for powernappers

Offline

#5 2009-05-21 13:38:31

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Copying to NEW HDD using dd?

I also recommend doing manual layout and file copying to a new disk rather than using dd. dd will take longer and is less flexible. Copying at the file level will let you do it the way you want. I don't see anything actually wrong with your plan, though.

Offline

#6 2009-05-21 13:50:14

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Copying to NEW HDD using dd?

I like using

cp -a

Then install grub and fix up fstab if necessary.

Offline

#7 2009-05-21 19:30:58

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Copying to NEW HDD using dd?

Personally, I _never_ copy a live filesystem.
Always boot from a live-cd and tar the contents from one disk to another ... something like this:

mkdir /from /to
for i in 1 2 5 6; do   # assuming swap is partition #3 and #4 is extended
  mount /dev/sda$i /from
  mount /dev/sdb$i /to
  (cd /from && tar cf - .)|(cd /to && tar xvpf -)
  umount /from /to
done

[edit]
Doing it this way, you have full control over the size of partitions and what filesystem you want to use ..
Obviously, you can play around with partitions on the target drive, but then it will be slightly more complicated than above :-(
Also obviously (I hope) you must first do a mkfs on the target drive partitions ...

And finally - install grub on the target mbr ...
[/edit]

Last edited by perbh (2009-05-21 19:35:05)

Offline

Board footer

Powered by FluxBB