Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking at replacing my current MBR-partitioned 2 TB system drive with quite possibly a 3 TB drive. Copying the files should not pose a problem, but are there any gotchas to watch out for, particularly with regards to the boot loader, keeping in mind that MBR doesn't support anything more than 2 TB so I'll have to move to GPT? Or is it sufficient to partition the new drive, copying all files, update /etc/fstab in its new place, physically replace the old system drive with the new and then re-running grub-install?

I'm using Linux with GRUB 2 (specifically 1.99-27+deb7u1 on Debian Wheezy) on a single-boot system (no second OS installed to take into consideration).

share|improve this question
up vote 1 down vote accepted

Grub2 supports GPT, so you'll have no problem booting from the new drive. Whether your BIOS can boot a GPT drive is a different matter. If you switch your BIOS from legacy mode to EFI mode, you'll need to install the grub-efi package.

You'll need to install the bootloader on the new drive. The easiest way is to copy the data to the new drive first, then chroot into it and run grub-install, passing it the new drive as a command line argument. If you have both drives at this point, you may need to edit /boot/grub/device.map.

There are several ways to copy the files. The nicest way is to set up mirroring between the two drives via mdraid (Linux software RAID) or LVM. This has the advantage that you can keep using the system while it's setting up the mirror; once it's done, install the bootloader, reboot, break the mirror, and if desired enlarge at least one filesystem to make use of the extra space. If your filesystems are on PC partitions, you can convert them to RAID1, but it's fiddly. You can take this opportunity to put your filesystems on LVM volumes over RAID1 volumes — it's simple and makes maintenance easier.

If a large proportion of a filesystem is occupied, it's faster to copy the filesystem wholesale than to copy the files. It's difficult to give a threshold because that depends not only on the amount of disk space that's in use but also on the distribution of file sizes. To copy a filesystem wholesale, you can use cat </dev/sdOLD1 >/dev/sdNEW1 where sdOLD is the old disk (e.g. sda) and sdNEW is the new disk (e.g. sdb). Don't do this while the filesystem is mounted.

If you copy all the files, make sure to preserve all the metadata, especially ownership and partitions. cp -ax /media/old-root /media/new-root works.

If you've rearranged the partitions, make sure to update /etc/fstab. You may need to update /etc/crypttab if you have encrypted volumes.

share|improve this answer

The steps you described to replace the drive should be sufficient. If you're dual booting Windows, you may run into problems.

When you're copying files, don't forget to preserve all of the file attributes. If you're using cp, run it as such:

cp -a -r /deva/* /devb

It's also a good idea to check the integrity of the copied files.

diff -qr /deva /devb
share|improve this answer
This sounds very promising. Yes, the actual file copying is something to watch out for, particularly since I use hardlinks extensively, but also relatively easy to check. I'll hold off accepting until I have actually given this a try (particularly since I'm looking for things to watch out for). – Michael Kjörling Jul 9 '13 at 18:06

Your Answer


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.