0

I have working Ubunutu 12.0.4 production server. Want to copy it's 650 GB HDD (only 30-40 gb used, but partitions fit HDD totally) to 500 GB hdd so that I can just replace HDD's and turn on server again without time waste. After 0time of researching on google I found tool named DD. but it's copying RAW data of HDD's and destination HDD must be exactly same size.

What tool can you suggest for this reason?

4
  • Have you tried cp -a? Aug 28, 2013 at 7:15
  • @AndreaCorbellini Joking? I need exact disk structure and partitions, where one of partitions (on which mounted /home must be 150 gig smaller)
    – hunter
    Aug 28, 2013 at 7:17
  • 1
    "I need exact disk structure and partitions" conflicts with "/home must be 150 gig smaller". You need a different partition schema, not the same one. So first create the new schema on the new HDD and then copy the files in the way you prefer. Or change the partition schema of the 650 GB HDD to make it 'compatible' with the new one. Aug 28, 2013 at 7:21
  • @AndreaCorbellini how to copy mbr ?:))
    – hunter
    Aug 28, 2013 at 7:23

2 Answers 2

1

I would use GParted:

  • for data security back up the original hdd (e.g. using dd)

  • make the new and the old hdd available to the same system (e.g. your server)

  • start GParted (as sudo)

  • shrink the biggest partition of the original hdd to a lower value (to fit to the smaller hdd)

  • copy and paste all partitions to the new hdd

  • start processing

To correct booting if necessary you can use this: http://gparted.org/faq.php (GRUB fails to boot. How can I fix this?)

Another way could be to use Clonezilla ...

1

So you have a 650GB disk that you want to put an "exactly copy" on a 500GB disk? No, that's not going to happen. I'll give you a couple of options:

  1. Install and copy:

    • Install 12.04 on the new disk in a different computer. Update it to the same level as the production server.
    • Copy all the files over using rsync -av from a LiveCD.

    Ideally you'd do this with fresh hardware for zero-downtime but if you don't have hardware for another server (even a temporary one), you can turn off the server, pop in the new HD and install Ubuntu onto it and then copy the data from the older disk. That's probably somewhere just over an hour of downtime if you're fast.

  2. Resize the existing partitions, and copy over and fix MBR:

    • Boot a LiveCD on the server
    • Open Gparted and shrink the existing partitions so they'll fit on the smaller disk
    • Copy them over
    • Still in the LiveCD session, use these reinstall grub instructions to install grub on the smaller, newer HD.
1
  • I suppose OP might try to document the setup too while he's at migrating a production server, if there's no documentation present (often happens with 'hand-crafted' setups), it should definitely help with any future migrations or, say, CMS (Puppet, Chef, SaltStack etc.) deployment. Aug 28, 2013 at 8:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .