Persyaratan
Inilah pengaturan saat ini – Volume root dan swap berada pada grup volume bernama vg_os .
# vgs VG #PV #LV #SN Attr VSize VFree vg_os 1 2 0 wz--n- 557.88g 1.88g
# lvs vg_os LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv_root vg_os -wi-ao---- 300.00g lv_swap vg_os -wi-ao---- 256.00g
Kita perlu mengubah nama VG dari vg_os ke root_vg . Di bawah ini adalah prosedur langkah demi langkah untuk melakukan hal yang sama.
1. Mengganti nama grup volume
# vgs VG #PV #LV #SN Attr VSize VFree vg_os 1 2 0 wz--n- 557.88g 1.88g
# vgrename vg_os root_vg Volume group "vg_os" successfully renamed to "root_vg"
# vgs VG #PV #LV #SN Attr VSize VFree root_vg 1 2 0 wz--n- 557.88g 1.88g
2. Ubah /etc/fstab
Ganti referensi ke nama VG lama ( vg_os ) dengan nama VG baru ( root_vg ) di file /etc/fstab :
# vi /etc/fstab /dev/mapper/root_vg-lv_data /data ext4 defaults 1 2 /dev/mapper/root_vg-lv_swap swap swap defaults 0 0
3. Perbarui file konfigurasi GRUB2
Perbarui File Konfigurasi GRUB2:“/boot/grub2/grub.cfg ” dengan nama VG baru (root_vg) sebagai ganti nama VG lama (vg_os).
Sebelumnya
# cat /boot/grub2/grub.cfg | grep vg_os linux16 /vmlinuz-3.10.0-514.2.2.el7.x86_64 root=/dev/mapper/vg_os-lv_root ro nomodeset crashkernel=auto rd.lvm.lv=vg_os/lv_root rd.lvm.lv=vg_os/lv_swap rhgb quiet LANG=en_US.UTF-8 systemd.log_level=debug systemd.log_target=kmsg linux16 /vmlinuz-3.10.0-514.2.2.el7.x86_64 root=/dev/mapper/vg_os-lv_root ro nomodeset crashkernel=auto rd.lvm.lv=vg_os/lv_root rd.lvm.lv=vg_os/lv_swap rhgb quiet LANG=en_US.UTF-8
Ubah kemunculan vg_os dengan root_vg menggunakan sed:
# sed -i 's/vg_os/root_vg/g' /boot/grub2/grub.cfg
Setelah
# cat /boot/grub2/grub.cfg | grep root_vg linux16 /vmlinuz-3.10.0-514.2.2.el7.x86_64 root=/dev/mapper/root_vg-lv_root ro nomodeset crashkernel=auto rd.lvm.lv=root_vg/lv_root rd.lvm.lv=root_vg/lv_swap rhgb quiet LANG=en_US.UTF-8 systemd.log_level=debug systemd.log_target=kmsg linux16 /vmlinuz-3.10.0-514.2.2.el7.x86_64 root=/dev/mapper/root_vg-lv_root ro nomodeset crashkernel=auto rd.lvm.lv=root_vg/lv_root rd.lvm.lv=root_vg/lv_swap rhgb quiet LANG=en_US.UTF-8
4. aktifkan VG baru dan segarkan volume
Sekarang, aktifkan grup volume:
# vgchange -ay
Ubah atribut volume logis. Lakukan untuk semua volume logis:
# lvchange /dev/root_vg/lv_root --refresh # lvchange /dev/root_vg/lv_swap --refresh
5. Buat ramdisk awal baru
Jalankan perintah berikut untuk membuat image ramdisk awal baru untuk kernel. Pastikan untuk membuat cadangan dari initramf yang ada sebelum membangun kembali.
# ls -al /boot/initramfs-3.10.0-514.2.2.el7.x86_64.img -rw------- 1 root root 19991626 Mar 22 18:29 /boot/initramfs-3.10.0-514.2.2.el7.x86_64.img
# uname -r 3.10.0-514.2.2.el7.x86_64
# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak
# mkinitrd -f -v /boot/initramfs-$(uname -r).img $(uname -r) Executing: /usr/sbin/dracut -f -v /boot/initramfs-3.10.0-514.2.2.el7.x86_64.img 3.10.0-514.2.2.el7.x86_64 *** Including module: bash *** *** Including module: nss-softokn *** *** Including module: i18n *** *** Including module: network *** *** Including module: ifcfg *** *** Including module: drm *** *** Including module: plymouth *** *** Including module: dm *** Skipping udev rule: 64-device-mapper.rules Skipping udev rule: 60-persistent-storage-dm.rules Skipping udev rule: 55-dm.rules *** Including module: kernel-modules *** *** Including module: lvm *** Skipping udev rule: 64-device-mapper.rules Skipping udev rule: 56-lvm.rules Skipping udev rule: 60-persistent-storage-lvm.rules *** Including module: fcoe *** *** Including module: fcoe-uefi *** *** Including module: resume *** *** Including module: rootfs-block *** *** Including module: terminfo *** *** Including module: udev-rules *** Skipping udev rule: 91-permissions.rules *** Including module: biosdevname *** *** Including module: systemd *** *** Including module: usrmount *** *** Including module: base *** *** Including module: fs-lib *** *** Including module: shutdown *** *** Including module: uefi-lib *** *** Including modules done *** *** Installing kernel module dependencies and firmware *** *** Installing kernel module dependencies and firmware done *** *** Resolving executable dependencies *** *** Resolving executable dependencies done*** *** Hardlinking files *** *** Hardlinking files done *** *** Stripping files *** *** Stripping files done *** *** Generating early-microcode cpio image *** *** Constructing GenuineIntel.bin **** *** Store current command line parameters *** *** Creating image file *** *** Creating image file done ***Catatan :Pastikan Anda menjalankan perintah untuk initramf lainnya juga. Ini bisa terjadi jika Anda telah mengupgrade kernel