From Funtoo
Jump to navigation Jump to search

Useful bits

It's often handy to be able to open a system quickly from a rescue disk. I use a script like the following:

   /root/ (bash source code) - script to open a Funtoo rootfs

mount_filesystems() {
        mkdir /mnt/funtoo -p
        mount /dev/${volgroup}/root /mnt/funtoo
        mkdir /mnt/funtoo/{usr,var,tmp,opt,boot} -p
        mount /dev/${volgroup}/boot /mnt/funtoo/boot
        mount /dev/${volgroup}/usr /mnt/funtoo/usr
        mount /dev/${volgroup}/var /mnt/funtoo/var
        mount /dev/${volgroup}/opt /mnt/funtoo/opt
        mount /dev/${volgroup}/tmp /mnt/funtoo/tmp
        mkdir /mnt/funtoo/var/{git,tmp,cache/portage} -p
        mount /dev/${volgroup}/var_tmp /mnt/funtoo/var/tmp/
        mount /dev/${volgroup}/var_cache /mnt/funtoo/var/cache/
        mount /dev/${volgroup}/var_git  /mnt/funtoo/var/git/
        swapon /dev/${volgroup}/swap
        mount --rbind /dev /mnt/funtoo/dev/
        mount --rbind /proc /mnt/funtoo/proc/
        mount --rbind /sys /mnt/funtoo/sys/

enter_chroot() {
        chroot /mnt/funtoo /bin/bash

main() {

volgroup='v0' main

To use it yourself, change the volgroup variable to match your volume group and adjust the paths to agree with your fstab.