- Maybe I will start at the beginning, so I've OS Centos 7.3 with below state
Result of executing df -Th command
Filesystem Type Size Used Avail Use% Mounted on
/dev/vda1 xfs 30G 942M 30G 4% /
devtmpfs devtmpfs 901M 0 901M 0% /dev
tmpfs tmpfs 920M 0 920M 0% /dev/shm
tmpfs tmpfs 920M 17M 904M 2% /run
tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup
tmpfs tmpfs 184M 0 184M 0% /run/user/1000
and the file grub.cnf
[...]
menuentry 'CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.16.1.el7.x86_64-advanced-29342a0b-e20f-4676-9ecf-dfdf02ef6683' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 29342a0b-e20f-4676-9ecf-dfdf02ef6683
else
search --no-floppy --fs-uuid --set=root 29342a0b-e20f-4676-9ecf-dfdf02ef6683
fi
linux16 /boot/vmlinuz-3.10.0-514.16.1.el7.x86_64 root=UUID=29342a0b-e20f-4676-9ecf-dfdf02ef6683 ro console=tty0 console=ttyS0,115200n8 crashkernel=auto console=ttyS0,115200 LANG=en_US.UTF-8
initrd16 /boot/initramfs-3.10.0-514.16.1.el7.x86_64.img
}
menuentry 'CentOS Linux (0-rescue-8bd05758fdfc1903174c9fcaf82b71ca) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca-advanced-29342a0b-e20f-4676-9ecf-dfdf02ef6683' {
load_video
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 29342a0b-e20f-4676-9ecf-dfdf02ef6683
else
search --no-floppy --fs-uuid --set=root 29342a0b-e20f-4676-9ecf-dfdf02ef6683
fi
linux16 /boot/vmlinuz-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca root=UUID=29342a0b-e20f-4676-9ecf-dfdf02ef6683 ro console=tty0 console=ttyS0,115200n8 crashkernel=auto console=ttyS0,115200
initrd16 /boot/initramfs-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca.img
}
[...]
- In the next step I migrate /boot partition from /dev/vda1 to separate partition (acoording to https://docs.hytrust.com/DataControl/Admin_Guide-4.0/Content/Books/Admin-Guide/Linux-Root-Swap-Drive-Encryption/Creating-Boot-Partition-RHEL-CentOS-7.htm)
Filesystem Type Size Used Avail Use% Mounted on
/dev/vda1 xfs 30G 1.1G 29G 4% /
devtmpfs devtmpfs 901M 0 901M 0% /dev
tmpfs tmpfs 920M 0 920M 0% /dev/shm
tmpfs tmpfs 920M 17M 904M 2% /run
tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vdc1 xfs 1020M 144M 877M 15% /boot
tmpfs tmpfs 184M 0 184M 0% /run/user/1000
It's working properly and grub.cnf from /boot/grub2 looks like:
[...]
menuentry 'CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.16.1.el7.x86_64-advanced-29342a0b-e20f-4676-9ecf-dfdf02ef6683' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root b526cf02-6566-4a91-8027-13b3800d177f
else
search --no-floppy --fs-uuid --set=root b526cf02-6566-4a91-8027-13b3800d177f
fi
linux16 /vmlinuz-3.10.0-514.16.1.el7.x86_64 root=UUID=29342a0b-e20f-4676-9ecf-dfdf02ef6683 ro console=tty0 crashkernel=auto console=ttyS0,115200
initrd16 /initramfs-3.10.0-514.16.1.el7.x86_64.img
}
menuentry 'CentOS Linux (0-rescue-8bd05758fdfc1903174c9fcaf82b71ca) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca-advanced-29342a0b-e20f-4676-9ecf-dfdf02ef6683' {
load_video
insmod gzio
insmod part_msdos
insmod xfs
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root b526cf02-6566-4a91-8027-13b3800d177f
else
search --no-floppy --fs-uuid --set=root b526cf02-6566-4a91-8027-13b3800d177f
fi
linux16 /vmlinuz-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca root=UUID=29342a0b-e20f-4676-9ecf-dfdf02ef6683 ro console=tty0 crashkernel=auto console=ttyS0,115200
initrd16 /initramfs-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca.img
}
if [ "x$default" = 'CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)' ]; then default='Advanced options for CentOS Linux>CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)'; fi;
[...]
- Finnaly I create and migrate to LVM root, all used commands I pasted earlier.
Extra commands
$ mount /dev/mapper/vg00-root /
$ mount -o rw,remount /
$ cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak
$ dracut -f -v
$ grub2-mkconfig -o /boot/grub2/grub.cfg
So df -hT command displays:
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg00-root xfs 30G 2.1G 28G 7% /
devtmpfs devtmpfs 901M 0 901M 0% /dev
tmpfs tmpfs 920M 0 920M 0% /dev/shm
tmpfs tmpfs 920M 17M 904M 2% /run
tmpfs tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vdc1 xfs 1020M 179M 842M 18% /boot
tmpfs tmpfs 184M 0 184M 0% /run/user/1000
and in file grub.cnf directives changes to:
menuentry 'CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.16.1.el7.x86_64-advanced-c81176da-6e61-44f0-afbc-93df72820140' {
load_video
set gfxpayload=keep
insmod gzio
insmod lvm
insmod xfs
set root='lvmid/T33gzF-WKVs-rUjx-Pieh-rZIU-pna5-JXF6bF/f0wezp-3C1o-03mr-CfaC-ZlAY-LyKH-Zcx8fg'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvmid/T33gzF-WKVs-rUjx-Pieh-rZIU-pna5-JXF6bF/f0wezp-3C1o-03mr-CfaC-ZlAY-LyKH-Zcx8fg' c81176da-6e61-44f0-afbc-93df72820140
else
search --no-floppy --fs-uuid --set=root c81176da-6e61-44f0-afbc-93df72820140
fi
linux16 /boot/vmlinuz-3.10.0-514.16.1.el7.x86_64 root=/dev/mapper/vg00-root ro console=tty0 crashkernel=auto console=ttyS0,115200
initrd16 /boot/initramfs-3.10.0-514.16.1.el7.x86_64.img
}
menuentry 'CentOS Linux (0-rescue-8bd05758fdfc1903174c9fcaf82b71ca) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca-advanced-c81176da-6e61-44f0-afbc-93df72820140' {
load_video
insmod gzio
insmod lvm
insmod xfs
set root='lvmid/T33gzF-WKVs-rUjx-Pieh-rZIU-pna5-JXF6bF/f0wezp-3C1o-03mr-CfaC-ZlAY-LyKH-Zcx8fg'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvmid/T33gzF-WKVs-rUjx-Pieh-rZIU-pna5-JXF6bF/f0wezp-3C1o-03mr-CfaC-ZlAY-LyKH-Zcx8fg' c81176da-6e61-44f0-afbc-93df72820140
else
search --no-floppy --fs-uuid --set=root c81176da-6e61-44f0-afbc-93df72820140
fi
linux16 /boot/vmlinuz-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca root=/dev/mapper/vg00-root ro console=tty0 crashkernel=auto console=ttyS0,115200
initrd16 /boot/initramfs-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca.img
}
if [ "x$default" = 'CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)' ]
but now when i restart server system starts with old /root partition and it's in RO state. Any ideas?
/dev/mapper/VGSYS-root 999320 55704 874804 6% / /dev/mapper/VGSYS-usr 13352008 8229988 4518448 65% /usr /dev/sda1 253871 188634 52130 79% /boot
for example – francois P Jan 25 '18 at 19:13rd.lvm.lv=vg00/root
to GRUB_CMDLINE_LINUX variable in /etc/default/grub, and then regenerate grub.cfg. – Martian Jan 30 '18 at 08:24