environment/centos7-linux

VMWare 에서 root 용량 resize ( 늘이기 )

yoursyun 2019. 8. 23. 11:21

LVM 설정 내용 확인 ============================= [[

[root@localhost /]# df -k
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root  20503120 9681400   9893584  50% /
devtmpfs                   914900       0    914900   0% /dev
tmpfs                      931608       0    931608   0% /dev/shm
tmpfs                      931608    2388    929220   1% /run
tmpfs                      931608       0    931608   0% /sys/fs/cgroup
/dev/sda1                 3030800  157972   2699160   6% /boot
/dev/mapper/centos-home   5029504  206256   4544720   5% /home
tmpfs                      186324      24    186300   1% /run/user/1000

/dev/mapper/centos-root 에서 50% 사용중. 이 디스크 용량을 늘여야 한다고 가정한다.

[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: 32.2 GB, 32212254720 bytes, 62914560 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: 0x0004db11

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     6293503     3145728   8e  Linux LVM
/dev/sda2         6293504    41943039    17824768   8e  Linux LVM
/dev/sda3        41943040    62914559    10485760   8e  Linux LVM

Command (m for help): 

dev/sda 전체 용량은 32.2GB Command (m for help): p 디스크 파티션을 조회

[root@localhost /]# pvscan
  PV /dev/sda2   VG centos          lvm2 [<17.00 GiB / 0    free]
  PV /dev/sda3   VG centos          lvm2 [<10.00 GiB / 0    free]
  Total: 2 [26.99 GiB] / in use: 2 [26.99 GiB] / in no VG: 0 [0   ]

물리 볼륨명 /dev/sda2, /dev/sda3 볼륨그룹명은 centos 이다.

[root@localhost /]# lvdisplay

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                UKVdn3-MB7K-1Jvm-oHB4-EMsS-tu5k-A4vpkf
  LV Write Access        read/write
  LV Creation host, time localhost, 2019-05-22 19:56:13 +0900
  LV Status              available
  # open                 1
  LV Size                19.99 GiB
  Current LE             5118
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

논리 볼륨 경로 명은  /dev/centos/root 이다. 

LVM 설정 내용 확인 ============================= ]]

용량증설시작 ============================= [[

1. 우선 VMware 에서 용량을 늘인다.
2. fdisk
[root@localhost /]# fdisk
이후 커멘드는 순서대로이다. "n , p, 3, p, t, 3, 8e, w"
[root@localhost /]# reboot
[root@localhost /]# pvcreate /dev/sda3
3. 볼륨그룹확장
[root@localhost /]# vgextend centos /dev/sda3
[root@localhost /]# vgdisplay 로 Free PE 생겼는지 확인
[root@localhost /]# lvextend /dev/centos/root -l + 2559  이숫자는 FreePE 숫자임.
4. 파일시스템 반영
[root@localhost /]# resize2fs /dev/centos/root

용량증설시작 ============================= ]]

반응형