Note
The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "User:Cuantar"
Jump to navigation
Jump to search
(Created page with "{{Person |Bio=Particle astrophysicist researching dark matter |Location name=University of South Carolina, Dept. of Physics & Astronomy }}") |
(add unlocking script for lvm rootfs) |
||
Line 3: | Line 3: | ||
|Location name=University of South Carolina, Dept. of Physics & Astronomy | |Location name=University of South Carolina, Dept. of Physics & Astronomy | ||
}} | }} | ||
== 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: | |||
{{file|name=/root/unlock.sh|lang=bash|desc=script to open a Funtoo rootfs|body= | |||
#!/bin/bash | |||
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 | |||
} | |||
enter_chroot() { | |||
mount --rbind /dev /mnt/funtoo/dev/ | |||
mount --rbind /proc /mnt/funtoo/proc/ | |||
mount --rbind /sys /mnt/funtoo/sys/ | |||
chroot /mnt/funtoo /bin/bash | |||
} | |||
main() { | |||
mount_filesystems | |||
enter_chroot | |||
} | |||
volgroup='v0' main | |||
}} | |||
To use it yourself, change the {{c|volgroup}} variable to match your volume group and adjust the paths to agree with your {{c|fstab}}. |
Revision as of 21:11, February 17, 2024
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/unlock.sh
(bash source code) - script to open a Funtoo rootfs#!/bin/bash
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
}
enter_chroot() {
mount --rbind /dev /mnt/funtoo/dev/
mount --rbind /proc /mnt/funtoo/proc/
mount --rbind /sys /mnt/funtoo/sys/
chroot /mnt/funtoo /bin/bash
}
main() {
mount_filesystems
enter_chroot
}
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
.