월요일, 7월 22, 2024
HomeESXi/dev/mapper/ubuntu--vg-root full

/dev/mapper/ubuntu–vg-root full

/dev/mapper/ubuntu–vg-root 100% Full 해결방법

LVM DiskFull 일경우 LVM 기반 Ubuntu Disk 확장하여 문제를 해결할 수 있습니다.

VMWare ESXi 기준으로 설명하겠습니다.

root@ubuntu:~# df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         967M     0  967M   0% /dev
tmpfs                        200M  796K  199M   1% /run
/dev/mapper/ubuntu--vg-root   14G   13G  184M  99% /
tmpfs                        997M     0  997M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        997M     0  997M   0% /sys/fs/cgroup
tmpfs                        200M     0  200M   0% /run/user/1000

1.먼저 가상머신을 종료합니다.

root@ubuntu:~# shutdown -h now

2.VMWare ESXi 에서 DISK 용량을 확장합니다.
아래와 같이 용량을 확장해줍니다.
3.fdisk 를 이용하여 disk를 확장합니다.

root@ubuntu:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.31.1).
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 GiB, 34359738368 bytes, 67108864 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
Disklabel type: dos
Disk identifier: 0xb2d7b26a

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 33552383 33550336  16G 8e Linux LVM

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 
First sector (33552384-67108863, default 33552384): 
Last sector, +sectors or +size{K,M,G,T,P} (33552384-67108863, default 67108863): 

Created a new partition 2 of type 'Linux' and of size 16 GiB.

Command (m for help): p
Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 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
Disklabel type: dos
Disk identifier: 0xb2d7b26a

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1  *        2048 33552383 33550336  16G 8e Linux LVM
/dev/sda2       33552384 67108863 33556480  16G 83 Linux

Command (m for help): w
The partition table has been altered.
Syncing disks.

root@ubuntu:~# 

4.pvcreate, lvextend , resize2fs 를 이용하여 disk를 확장합니다.

root@ubuntu:~# pvcreate /dev/sda2
  Physical volume "/dev/sda2" successfully created.
root@ubuntu:~# pvscan
  PV /dev/sda1   VG ubuntu-vg       lvm2 [<16.00 GiB / 0    free]
  PV /dev/sda2                      lvm2 [16.00 GiB]
  Total: 2 [<32.00 GiB] / in use: 1 [<16.00 GiB] / in no VG: 1 [16.00 GiB]
root@ubuntu:~# vgextend ubuntu-vg /dev/sda2
  Volume group "ubuntu-vg" successfully extended
root@ubuntu:~# pvscan
  PV /dev/sda1   VG ubuntu-vg       lvm2 [<16.00 GiB / 0    free]
  PV /dev/sda2   VG ubuntu-vg       lvm2 [16.00 GiB / 16.00 GiB free]
  Total: 2 [<32.00 GiB] / in use: 2 [<32.00 GiB] / in no VG: 0 [0   ]
root@ubuntu:~# vgdisplay ubuntu-vg
  --- Volume group ---
  VG Name               ubuntu-vg
  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               <32.00 GiB
  PE Size               4.00 MiB
  Total PE              8191
  Alloc PE / Size       4095 / <16.00 GiB
  Free  PE / Size       4096 / 16.00 GiB
  VG UUID               jbtYju-j7oa-VGig-jfdg-h3dz-Foxs-s0L2zc
   
root@ubuntu:~# lvextend -L +16g /dev/ubuntu-vg/root
  Size of logical volume ubuntu-vg/root changed from <14.00 GiB (3583 extents) to <30.00 GiB (7679 extents).
  Logical volume ubuntu-vg/root successfully resized.
root@ubuntu:~# resize2fs /dev/ubuntu-vg/root
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/ubuntu-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 4
The filesystem on /dev/ubuntu-vg/root is now 7863296 (4k) blocks long.

5.확장된 disk 확인

root@ubuntu:~# df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         967M     0  967M   0% /dev
tmpfs                        200M  788K  199M   1% /run
/dev/mapper/ubuntu--vg-root   30G   13G   16G  46% /
tmpfs                        997M     0  997M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        997M     0  997M   0% /sys/fs/cgroup
tmpfs                        200M     0  200M   0% /run/user/1000
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular