Linux:CentOS 7 Single User

From Nigel's Wiki
Revision as of 06:40, 15 March 2018 by Nelgin (talk | contribs) (Created page with "How to startup single user rescue mode with lvm. Enter the grub boot menu and look for linux16 and change "ro" to "rw init=sysroot/bin/sh" then CTRL-X to start up You'll nee...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to startup single user rescue mode with lvm.

Enter the grub boot menu and look for linux16 and change "ro" to "rw init=sysroot/bin/sh" then CTRL-X to start up

You'll need to mount some filesystems

 mount -t proc none /sysroot/proc
 mount -t sysfs none /sysroot/sys
 mount -o bind /dev /sysroot/dev

Now let's discover our LVMS if you have separate /var, /home, or other fs you want to work with

 lvm vgscan -v
 lvm vgchange -a y
 lvm lvscan -v --all

After this I had to run vgscan again. I'm not sure it made the nodes the first time.

 lvm vgscan -v --mknodes


Now you can mount any filesystems. This will vary with your vg names of course

 mount /dev/vg00/lv.var /sysroot/var

Once you've got everything mounted you can chroot

 chroot /sysroot

Remember to drop back out of sysroot and umount your filesystems before rebooting.

Hope this helps someone.