Grimoire-
Command
.es

GNU+Linux command memo

Change root from live-cd to local drive

Déplacer le répertoire racine d’un système lancé (par exemple depuis un live-cd) vers un nouveau répertoire (par exemple le disque dur de la machine hôte)

# mkdir /media/disk
# mount /dev/mapper/<machine>--vg-root /media/disk (1)
# mount /dev/sda2 /media/disk/boot (2)
# mount /dev/sda1 /media/disk/boot/efi (2)
# mount -o bind /dev /media/disk/dev
# mount -o bind /sys /media/disk/sys
# mount -o bind /proc /media/disk/proc
# chroot /media/disk
# ls /media (3)
# grub-install /dev/sda && update-grub (4)
1 Here it’s for an encrypted Debian (Jessie, Stretch)
2 Mount non-encrypted boot (and efi) partition if any
3 There is no disk folder anymore, you got in !
4 Optional : to re-install GRUB once chrooted for instance