有一个带有一些时髦的默认分区设置的专用服务器,我似乎无法使用可用磁盘。
试图使 200GB 分区的大小等于 960GB 磁盘的大小。
root@jdcuser:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.2G 251M 2.9G 8% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 196G 196G 0 100% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 976M 104M 806M 12% /boot
/dev/loop0 30M 30M 0 100% /snap/snapd/8542
/dev/loop1 55M 55M 0 100% /snap/core18/1880
/dev/loop2 72M 72M 0 100% /snap/lxd/16099
tmpfs 3.2G 0 3.2G 0% /run/user/0
/dev/loop3 56M 56M 0 100% /snap/core18/1885
/dev/loop4 31M 31M 0 100% /snap/snapd/9607
/dev/loop5 71M 71M 0 100% /snap/lxd/16922
root@jdcuser:~# fdisk -l
Disk /dev/loop0: 29.9 MiB, 31334400 bytes, 61200 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 /dev/loop1: 54.98 MiB, 57626624 bytes, 112552 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 /dev/loop2: 71.28 MiB, 74735616 bytes, 145968 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 /dev/loop3: 55.33 MiB, 58007552 bytes, 113296 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 /dev/loop4: 30.95 MiB, 32432128 bytes, 63344 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 /dev/loop5: 70.58 MiB, 73990144 bytes, 144512 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 /dev/sda: 953.89 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: TEAM T253X2001T
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: gpt
Disk identifier: 4338853D-6405-4F81-ADFD-EE57B6DA7C74
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 2101247 2097152 1G Linux filesystem
/dev/sda3 2101248 2000409230 1998307983 952.9G Linux filesystem
Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 200 GiB, 214748364800 bytes, 419430400 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
root@jdcuser:~# resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs 1.45.5 (07-Jan-2020)
The filesystem is already 52428800 (4k) blocks long. Nothing to do!
编辑:
这是输出sudo pvs; sudo vgs; sudo lvs
root@jdcuser:~# sudo pvs; sudo vgs; sudo lvs
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- 952.86g 752.86g
/etc/lvm/archive: mkdir failed: No space left on device
/etc/lvm/backup: mkdir failed: No space left on device
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 1 0 wz--n- 952.86g 752.86g
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
ubuntu-lv ubuntu-vg -wi-ao---- 200.00g
对您来说好消息是卷组有额外空间,因此我们可以尝试实时调整大小。
首先,我们需要扩展逻辑卷
ubuntu-lv
以填充可用的卷组空间。一旦完成,如果它成功完成,那么我们只需要扩展文件系统:
这应该会扩展您的 Ubuntu 根分区以适应可用的磁盘大小。
之后我会重新启动以确保系统识别更改并且任何“空间不足”锁定消失。