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.

the internal hard drive that I have right now in my laptop is coming near its death, clicking for life, so I decided to buy a new HDD. However, I don't want to spend two weeks setting up my system to fit me as it does right now, so I thought that I can make just a hard copy of all the contents to the new disk (using dd).

My question is: is it going to work? :-) What are the things that need to be changed, except fstab?

share|improve this question
    
dup of askubuntu.com/questions/6615/… –  nathwill Mar 29 '12 at 22:16
add comment

2 Answers 2

Using dd like this:

dd if=/dev/old_drive of=/dev/new_drive bs=100M

may work just fine. The option bs=100M should improve performance.

However you should be concerned of the following issues:

  • If you have proof that your hard drive is in a state of dying, then it's not recommended to stress the drive any further than needed. Backup the necessary data first, after that you can still do a full copy of the drive.
  • While talking about backups: Don't just do a copy from one drive to the other! Do a backup, restore from that backup to the new drive and validate your backup in that way. You don't know how long the new drive will last, it may already be faulty, you never know.
  • Copying the whole old drive including its metrics to the new drive is bad:
    • Performance loss due to false alignment. Partitions on newer drives with 4K layout have to be properly aligned. Just create new partitions on the new drive with tools like GParted and select alignment to 1 MB boundaries. Download the latest Ubuntu Live CD, it already contains GParted and while you're at it, make sure you have a copy of the Live CD from the Ubuntu version you have currently installed, you will need it for reinstalling GRUB to the newly partitioned drive.
    • Performance loss due to fragmented files. Now is the best chance to start fresh and new. Create a new file system and copy the data, defragmentation is done auto magically. :)
    • Writing to SSDs with dd is a bad idea. For example with activated TRIM support, you will loose some of your data after a few hours until your file system is corrupt. TRIM and dd don't play nice. (TRIM is enabled via the discard option for EXT4 in fstab, other file systems have other options, you might want to look that up in the man pages of the corresponding mount command for the file system)
    • Partition sizes and file systems are not adjusted. If the new drive is large enough, you will get all your data and partitions onto the drive, but the available space will still be the same. You will have to use either all-in-one partitioning tools like GParted or resize2fs and the likes to adjust the file system size to the new partition size.

That said, I recommend you better go with rsync (options -ap should suffice, boot from Live CD and start the rsync job there) to make a backup, create a new partition layout on the new drive (if you have been using EXT3, now is the time to switch to EXT4, but no more fancy stuff, btrfs is still not stable), restore from the backup to the new drive, install GRUB to the new drive with the --boot-directory method (you are still using the Live CD) and replace the UUIDs in /etc/fstab, /boot/grub/grub.cfg and /etc/initramfs-tools/conf.d/resume (latter one is for the swap partition to be used by suspend to disk) to reflect the new configuration.

That's mostly it. A bit more work, but safer and with the feeling of a fresh deployed system without reinstalling.

share|improve this answer
add comment

You should be fine. Make sure you can access the files on the backup drive before you do the deed though, just in case.

share|improve this answer
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.