리눅스

Total 331
Today 0
profile_image
슈퍼아이피
19-05-17 22:52 0개 32회
일반문서
[Linux] root 파티션의 볼륨그룹 변경

1. 환경

RedHat Enterprise Linux 7.X

 

2. 개요

리눅스 설치 시 root파티션(/)이 lvm으로 구성이 되어있을 때가 있다. 다른 파티션의 경우 vgrename이라는 명령어를 통해서 간단히 변경이 가능하지만, root파티션이 포함된 볼륨그룹의 경우 추가적인 작업이 더 선행되어야 한다.

 

3. 설정방법

3.1 시나리오
현재 루트 파티션이 lvm으로 만들어져 있으며 볼륨그룹의 이름은 ‘vg00’이다. ‘vg00’의 볼륨그룹의 이름을 ‘vg10’으로 바꾸려고 한다.

3.2 설정

3.2.1 현재 볼륨그룹 및 logical volume 확인

[root@test ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg00 2 2 0 wz?n- <303.00g <79.00g
vg11 1 1 0 wz?n- <20.00g 0

[root@test ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg00 -wi-ao?- 220.00g
lv_swap vg00 -wi-ao?- 4.00g
lv_test vg11 -wi-a?? <20.00g

lv_root파티션은 vg00 볼륨그룹이며 vg00을 vg10으로 변경하고자 한다.

3.2.2 vgrename

[root@test ~]# vgrename vg00 vg10
Volume group “vg00″ successfully renamed to “vg10″

3.2.3 /etc/fstab

변경한 볼륨그륩에 맞추어서 fstab의 내용을 수정

# /etc/fstab
# Created by anaconda on Wed Nov 1 23:09:21 2017
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg10-lv_root / ext4 defaults 1 1
UUID=b1b0063f-b36b-48b9-99e2-d4a975b9e2ed /boot ext4 defaults 1 2
/dev/mapper/vg10-lv_swap swap swap defaults,pri=10 0 0

3.3.3 /boot/grub2/grub.cfg

볼륨그룹과 관련된 모든 내용을 변경해 준다.
### BEGIN /etc/grub.d/10_linux ###
menuentry ‘Red Hat Enterprise Linux Server (3.10.0-693.11.6.el7.x86_64) 7.4 (Maipo)’ ?class red ?class gnu-linux ?class gnu ?class os ?unrestricted $menuentry_id_option ‘gnulinux-3.10.0-693.11.6.el7.x86_64-advanced-7aae5cf5-53a3-4dbf-aa23-16b7eb729d97′ {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos1′
if [ x$feature_platform_search_hint = xy ]; then
search ?no-floppy ?fs-uuid ?set=root ?hint-bios=hd0,msdos1 ?hint-efi=hd0,msdos1 ?hint-baremetal=ahci0,msdos1 ?hint=’hd0,msdos1′ b1b0063f-b36b-48b9-99e2-d4a975b9e2ed
else
search ?no-floppy ?fs-uuid ?set=root b1b0063f-b36b-48b9-99e2-d4a975b9e2ed
fi
linux16 /vmlinuz-3.10.0-693.11.6.el7.x86_64 root=/dev/mapper/vg10-lv_root ro crashkernel=auto rd.lvm.lv=vg10/lv_root rd.lvm.lv=vg10/lv_swap rhgb quiet net.ifnames=0 biosdevname=0
initrd16 /initramfs-3.10.0-693.11.6.el7.x86_64.img
}
……..

3.3.4 부팅 이미지에 grub.cfg에 변경된 내용을 적용시키기

[root@test ~] mkinitrd -f -v /boot/initramfs-$(uname -r).img $(uname -r)

………
*** Resolving executable dependencies ***
*** Resolving executable dependencies done***
*** Hardlinking files ***
*** Hardlinking files done ***
*** Stripping files ***
*** Stripping files done ***
*** Generating early-microcode cpio image contents ***
*** Constructing GenuineIntel.bin ****
*** Store current command line parameters ***
*** Creating image file ***
*** Creating microcode section ***
*** Created microcode section ***
Message from syslogd@test at Apr 3 02:18:24 …
kernel:NMI watchdog: BUG: soft lockup ? CPU#0 stuck for 27s! [gzip:12208]
*** Creating image file done ***
*** Creating initramfs image file ‘/boot/initramfs-3.10.0-693.11.6.el7.x86_64.img’ done ***

3.3.5 재부팅 후 볼륨그룹 변경확인
[root@test ~] reboot

[root@test ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg10 2 2 0 wz?n- <303.00g <79.00g
vg11 1 1 0 wz?n- <20.00g 0

댓글목록

등록된 댓글이 없습니다.