fdisk /dev/sda 명령어로 늘어난 만큼 남아있는 파티션을 Linux LVM 파티션 형태로 추가합니다.
[root@localhost ~]# fdisk /dev/sda Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00017aab
Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 33554431 15727616 8e Linux LVM
Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (3,4, default 3): First sector (33554432-125829119, default 33554432): Using default value 33554432 Last sector, +sectors or +size{K,M,G} (33554432-125829119, default 125829119): Using default value 125829119 Partition 3 of type Linux and of size 44 GiB is set
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00017aab
Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 33554431 15727616 8e Linux LVM /dev/sda3 33554432 125829119 46137344 83 Linux
Command (m for help): t Partition number (1-3, default 3): Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00017aab
Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 33554431 15727616 8e Linux LVM /dev/sda3 33554432 125829119 46137344 8e Linux LVM
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
pvcreate /dev/sda3 로 Physical volume 을 생성하여야 합니다.
[root@localhost ~]# pvcreate /dev/sda3 Device /dev/sda3 not found (or ignored by filtering). [root@localhost ~]# reboot login as: root root@192.168.1.26's password: Last login: Tue Sep 19 12:32:31 2017 from 192.168.1.2 [root@localhost ~]# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created. [root@localhost ~]# pvscan PV /dev/sda2 VG cl lvm2 [15.00 GiB / 0 free] PV /dev/sda3 lvm2 [44.00 GiB] Total: 2 [59.00 GiB] / in use: 1 [15.00 GiB] / in no VG: 1 [44.00 GiB]
파티션 잡을때 Warning 메시지가 있었듯이 재부팅을 한번 해주어야 합니다.
pvdisplay 명령어로 볼륨명 VG Name 을 확인합니다.
[root@localhost ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name cl PV Size 15.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 3839 Free PE 0 Allocated PE 3839 PV UUID hq499Q-zVoS-mZKD-zCWX-D4xf-ns5x-2L3Pui
"/dev/sda3" is a new physical volume of "44.00 GiB" --- NEW Physical volume --- PV Name /dev/sda3 VG Name PV Size 44.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID KJ8ada-YjiU-gx9e-oSpd-K4AV-9KWK-F9tnGn
위에서 확인한 VG Name 을 vgextend 명령어로 확장합니다.
[root@localhost ~]# vgextend cl /dev/sda3 Volume group "cl" successfully extended [root@localhost ~]# vgdisplay --- Volume group --- VG Name cl System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 58.99 GiB PE Size 4.00 MiB Total PE 15102 Alloc PE / Size 3839 / 15.00 GiB Free PE / Size 11263 / 44.00 GiB VG UUID ny3hEe-LQMt-0UYe-nVMT-hHlG-kRhN-y3LqmT
그리고 vgdisplay 명령어로 확장 가능한 Free PE / Size 값을 확인합니다.
[root@localhost ~]# lvextend /dev/cl/root -l +11263 Size of logical volume cl/root changed from 13.39 GiB (3429 extents) to 57.39 GiB (14692 extents). Logical volume cl/root successfully resized.