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 a laptop computer with the following setup:

  • / on a btrfs /dev/sda3 subvolume @
  • /home on a btrfs /dev/sda3 subvolume @home
  • /boot on an ext4 /dev/sda2
  • /boot/efi on a vfat /dev/sda1
  • no swap
  • /tmp on a tmpfs

Now I got a new solid state disk that I want to use instead of my current setup. Besides dd'ing the whole disk to the SSD (which I don't want to do since it marks all sectors as used), what steps should I do to copy all data in a way that my system still boots afterwards?

Big gotcha: I can't insert both discs at once into my system but I have a sufficiently fast eSATA backup disc that is big enough to store all data from the old HDD.

share|improve this question
    
Clonezilla might be what you're looking for. –  Glutanimate Dec 26 '12 at 14:51
    
@MHC Clonezilla does not support btrfs iirc. I don't want to wear of all sectors with a sector-by-sector copy. –  FUZxxl Dec 26 '12 at 19:32
add comment

1 Answer

Personally, I use tar for this sort of thing: Create a tarball on your eSATA disk with a command like:

sudo tar cvfz /mnt/backup/backup.tgz --one-file-system / /boot /boot/efi/ /home /tmp

You can then boot with an emergency system, create your partitions and filesystems, mount your eSATA disk, and unpack the tarball. You'll also need to do some cleaning up -- most notably, you'll need to adjust your /etc/fstab entries for the new system, and probably deal with your boot loader configuration to point it to the new filesystems.

You've got "UEFI" and "grub-efi" tags set, so I assume you've got an EFI-based system. One major difference between BIOS systems and EFI systems is that BIOS-based computers rely on boot code tucked away in boot sectors and elsewhere on the hard disk, whereas EFI relies on boot files on the ESP (/boot/efi in your installation) along with NVRAM entries. When you swap out one disk for another, the old NVRAM entries will no longer be valid, since the GUID of the disk and the GUID of the ESP will have changed. Thus, you'll need to either move your boot loader to the fallback filename of /boot/efi/EFI/BOOT/bootx64.efi or create a new NVRAM entry with the efibootmgr utility, as in:

sudo efibootmgr -c -l \\EFI\\newloader\\loadername.efi -L NewLoader

The details depend on where your boot loader is located and what you want to call it. In some cases you may need to add more options, particularly if the ESP isn't /dev/sda1. Consult the efibootmgr man page for details. Also, efibootmgr must be run from an EFI boot, so it won't work from some emergency disks.

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.