纪一次Ubuntu服务器root目录空间100%占满解决办法

新装的Dell PowerEdge服务器,Ubuntu20.04,RAID 0 磁盘阵列。一直使用没有问题。但是突然有一天所有服务全都不能用了,查看原因是空间满了:

df -lh 
Filesystem                         Size  Used Avail Use% Mounted on
udev                                16G     0   16G   0% /dev
tmpfs                              3.1G  7.9M  3.1G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  196G   196G  0G  100% /

可是我的硬盘明明有4T啊?

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
Device       Start        End    Sectors  Size Type
/dev/sda1     2048    1050623    1048576  512M EFI System
/dev/sda2  1050624    3147775    2097152    1G Linux filesystem
/dev/sda3  3147776 7812937727 7809789952  3.7T Linux filesystem

百度就算了,直接上GGGGGG,关键词/dev/mapper/ubuntu--vg-ubuntu--lv, 第一个答案就解决问题:

# We need to resize the logical volume to use all the existing and free space of the volume group
$ lvm
lvm> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
lvm> exit

# And then, we need to resize the file system to use the new available space in the logical volume
$ resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 58
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 120784896 (4k) blocks long.

# Finally, you can check that you now have available space:
$ df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /dev
tmpfs                              786M  1.2M  785M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  454G  3.8G  432G   1% /

具体就2条指令:

$ lvm
lvm> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv // 这里换成满的磁盘的名字
lvm> exit
 resize2fs /dev/ubuntu-vg/ubuntu-lv // 要等待一会

搞定

df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                                16G     0   16G   0% /dev
tmpfs                              3.1G  7.9M  3.1G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  3.6T   47G  3.4T   2% /

你可能感兴趣的:(纪一次Ubuntu服务器root目录空间100%占满解决办法)