Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 2 160GB drives in a server. One is the OS, the other data.

I want to clone these drives to two new 1TB drives.

What is the best way to go about this ?

Thanks

EDIT:

I used clonezilla to clone the drive, however now i need to resize the partition to fill this disk.

So far this is all i have found.

http://sourceforge.net/projects/clonezilla/forums/forum/663168/topic/3750321

EDIT 2:

PV         VG      Fmt  Attr PSize   PFree
  /dev/sda1  AO-0023 lvm2 a-   148.81g    0
  /dev/sdb1  AO-0023 lvm2 a-   149.05g    0

/dev/sda1 is actually a 1TB drive now.

sudo fdisk -l

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2c9c2c9b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       19457   156288321   83  Linux

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd42ad42a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19426   156039313+  8e  Linux LVM
/dev/sda2           19427       19457      249007+   5  Extended
/dev/sda5           19427       19457      248976   83  Linux
share|improve this question
    
Are these drives going to replace the existing ones? –  Ignacio Vazquez-Abrams Nov 23 '10 at 23:10
    
Yes, i want to replace them. –  Anthony Nov 23 '10 at 23:15
    
Is the system currently using LVM? –  Ignacio Vazquez-Abrams Nov 23 '10 at 23:19
    
Yes, it is using LVM –  Anthony Nov 24 '10 at 0:47
add comment

3 Answers

Since the system is using LVM, you can convert the new drives into PVs (either whole disk or partitions is fine, but you should mimic the existing structure), then use vgextend to absorb them into the existing VG, pvmove to move the LVs from the old PVs to the new PVs, vgreduce to remove the old PVs from the VG, then reinstall the bootloader on the new drives.

share|improve this answer
    
I ended up using clonezilla, although your solution sounds much nicer. Now i need to extend my partitions to use all the free space. –  Anthony Nov 24 '10 at 3:15
    
What do your new PVs,VGs and LVs look like now? –  Jasper Nov 24 '10 at 12:28
    
I'll update main post –  Anthony Nov 24 '10 at 21:11
add comment
dd if=/dev/sda of=/dev/sdc bs=32768 # bigger block size for speed
dd if=/dev/sdb of=/dev/sdd bs=32768
resize2fs /dev/sdc
resize2fs /dev/sdd

(old disks=sda and sdb, new disks=sdc and sdd)

share|improve this answer
3  
I made an assumptions here that will be false in a near future. I consider that your disk use an MBR, future disk (>2TB) will not any more be usable with standard MBR and this solution will not work any more. –  shellholic Nov 24 '10 at 0:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.