Skip to content

Instantly share code, notes, and snippets.

@Diederikjh
Created January 18, 2017 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Diederikjh/ccf26b37ad7d77b08c1dc86f8b321e95 to your computer and use it in GitHub Desktop.
Save Diederikjh/ccf26b37ad7d77b08c1dc86f8b321e95 to your computer and use it in GitHub Desktop.
Copy system drive and ready to chroot.
# First sync old root then rew root.
# Mostly from http://askubuntu.com/a/3409/41258
sudo rsync -avP --numeric-ids --exclude='/dev' --exclude='/proc' --exclude='/sys' --exclude='/home' --exclude='/media' --exclude='/var/cache/zoneminder' /media/ubuntu/eb636436-ea9f-4e1b-bc71-5b46eb6e96a1/ /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/
sudo mkdir /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/proc
sudo mount -B /proc /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/proc
sudo mkdir /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/dev
sudo mount -B /dev /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/dev
sudo mkdir /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/sys
sudo mount -B /sys /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6/sys
sudo chroot /media/ubuntu/690ad96f-d072-41ef-9ebe-a524f891a2f6
#TODO fix up /etc/fstab to mount new root (690ad96f-d072-41ef-9ebe-a524f891a2f6)
sudo update-grub
#install grub on new drive:
sudo grub-install /dev/sdc
#aslo make above drive (/dev/sdc) first bootable drive in BIOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment