0

I'm moving my system from an old drive to a new one.

I could boot from a live CD/USB stick and install the system there, but for some weird reason the bios seems unable to do so.

So, how can I change from the old to the new drive and install GRUB and Linux there? Additionally, I would to setup-up this new drive with LUKS and LVM.

1

For the first part, you can find the details at: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system

It basically boils down to:

  • Create a boot partition on /dev/sdb1
  • Create a crypt-luks partion enc on /dev/sdb2
  • Create a LVM enc_my_lv logical volume on top of the luks partition.
  • Create a btrfs (or ext4) on enc_my_lv.
  • Fsync system and user data from old drive to enc_my_lv.
  • Edit fstab and cryptsetup to fit your new system.

Now the additional part not covered there is to manually install Grub and Linux on the boot partition:

Mount enc_my_lv on /mnt:

mount /dev/your_vg/enc_my_lv /mnt

Mount boot on /mnt/boot:

mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot

Mount additional devices:

for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done  #(credits: see https://askubuntu.com/a/88432/232047)

Chroot to /mnt and run configs:

chroot /mnt
dpkg -l | grep linux-image-.*-generic | sort -k3 | tail -n1 | awk '{system ("sudo apt-get install --reinstall " $2)}' #Reinstall Linux kernel packages there (credits: see https://askubuntu.com/a/298855/232047)
update-initramfs -u
grub-install /dev/sdb
update-grub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.