如何增加文件系统 linux 上的空间?

xtr*_*sky -1 linux filesystems centos

我正在租用带有 Parallel Plesk 的专用服务器(我讨厌它,我尝试使用命令行)。

我有一个已满的文件系统,"df -H" 打印:

Filesystem             Size   Used  Avail Use% Mounted on
/dev/md1               4.0G   4.0G   361k 100% /
/dev/mapper/vg00-usr   4.3G   1.4G   3.0G  32% /usr
/dev/mapper/vg00-var   4.3G   2.8G   1.6G  64% /var
/dev/mapper/vg00-home
                       4.3G   4.4M   4.3G   1% /home
none                   1.1G    24M   1.1G   3% /tmp
tmpfs                  1.1G      0   1.1G   0% /usr/local/psa/handlers/before-local
tmpfs                  1.1G      0   1.1G   0% /usr/local/psa/handlers/before-queue
tmpfs                  1.1G      0   1.1G   0% /usr/local/psa/handlers/before-remote
tmpfs                  1.1G      0   1.1G   0% /usr/local/psa/handlers/info
tmpfs                  1.1G      0   1.1G   0% /usr/local/psa/handlers/spool
Run Code Online (Sandbox Code Playgroud)

我租用的服务器有 1TB 的硬盘。为什么这些这么小,我怎样才能增加我的存储空间?(我是 Linux 的初学者)。

谢谢

ste*_*tew 5

您正在运行 LVM,这应该很容易。这些挂载的设备是“逻辑卷”,它们是从称为“卷组”的一大块空间中分配的。运行vgdisplay应该会显示有关卷组的详细信息。这是我的当前的样子,你的应该看起来相似:

--- Volume group ---
VG Name               vg00
System ID             
Format                lvm2
Metadata Areas        1
Metadata Sequence No  10
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                9
Open LV               2
Max PV                0
Cur PV                1
Act PV                1
VG Size               186.26 GiB
PE Size               4.00 MiB
Total PE              47683
Alloc PE / Size       39165 / 152.99 GiB
Free  PE / Size       8518 / 33.27 GiB
VG UUID               ekYzHp-b4n9-8971-nBBZ-kOfH-Cfd1-ZcEf12
Run Code Online (Sandbox Code Playgroud)

The important bit here is the "Free PE" line which shows that we have some "Free physical extents" which can be allocated to our logical volumes. You can allocate space to a logical volume with lvresize. perhaps something like lvresize --size +100M /dev/mapper/vg00-var to increase by 100 megabytes.

After resizing the logical volume, you'll have to resize the contained filesystem. How to do this would be filesystem dependent. If it is ext2/ext3/ext4, you would use resize2fs /dev/mapper/vg00-var. And the changes should be immediately apparent.