Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
Have you tried cp -a? –  Andrea Corbellini Aug 28 '13 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 '13 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. –  Andrea Corbellini Aug 28 '13 at 7:21
    
@AndreaCorbellini how to copy mbr ?:)) –  hunter Aug 28 '13 at 7:23

2 Answers 2

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 ...

share|improve this answer

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.
share|improve this answer
    
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. –  moon.musick Aug 28 '13 at 8:14

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.