How do I replace the root drive on Debian? What is a comprehensive set of steps starting from old drive with a new empty drive ready to go to the new drive with a fully bootable install with grub and everything?

1 Answer 1


The following makes some assumptions:

  • All commands ran as root when possible
  • You want an ext4 files system
  • You are loosely familiar on a basic level with all commands run
  • You are NOT booting from a RAID device

So here we go.

  1. Physically install new disk into computer and connect to available port leaving old disk in existing position.
  2. Boot computer into old OS.
  3. Prepare and mount new disk; first identify new disk

fdisk -l

  1. Partition new disk

fdisk /dev/(newdisk)

Make partition primary partition with type "83" file system type.
  1. Create filesystem

mkfs.ext4 /dev/(newpartition)

  1. Mount new filesystem

mkdir /mnt/(newpartitionmountpoint)

mount /dev/(newpartition) /mnt/(newpartitionmountpoint)

  1. Copy disk:

/sbin/init 1 (drop to single user mode)

rsync -avxHAX / /mnt/(newpartitionmountpoint)


  1. Update FSTAB on newdisk

blkid (note UUID of new partition)

(editor of choice) /mnt/(newpartitionmountpoint)/etc/fstab

    Replace existing UUID of / in FSTAB to new disk UUID
  1. Configure grub and install to new disk boot loader:



grub-install /dev/(newdisk)

  1. Copy grub.cfg from old disk to new

cp -ax /boot/grub/grub.cfg /mnt/(newpartitionmountpoint)/boot/grub/grub.cfg

  1. Open grub.cfg on new disk and replace all UUIDs with new disk

(editor of choice) /mnt/(newpartitionmountpoint)/boot/grub/grub.cfg

Replace all old UUIDs with the UUID of the new disk

  1. Shut down computer


  1. Physically move the new drive to the 1st drive location and remove old drive

    14.Start computer and grub should present:

error: no such device: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

GRUB rescue>

  1. Manually boot new OS from grub; first identify the drive and partition of the boot files

ls [to identify your drive and partition options]

ls (hdx,p)/ [to identify which partition has the /boot folder]

  1. Then, you can load the boot menu manually from the drive and partition you found above. Typically this would be (hd0,msdos1).

set prefix="(hdx,p)/boot/grub"

set root="(hdx,p)"

insmod normal


  1. Login to OS on new drive
  2. Configure grub again

fdisk -l (note dev of newdisk)



grub-install /dev/newdisk

And that should be it!

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