![分区未使用全部空间](https://linux22.com/image/679492/%E5%88%86%E5%8C%BA%E6%9C%AA%E4%BD%BF%E7%94%A8%E5%85%A8%E9%83%A8%E7%A9%BA%E9%97%B4.png)
该sda5
分区有 1953 GB,但dev/mapper/MediaServer--vg-root
实际只使用了 496 GB。如何扩展dev/mapper/MediaServer--vg-root
才能充分利用空间?
sudo fdisk -l
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000a9ebd
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 3907028991 1953263617 5 Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5 501760 3907028991 1953263616 8e Linux LVM
Disk /dev/mapper/MediaServer--vg-root: 495.9 GB, 495909339136 bytes
255 heads, 63 sectors/track, 60290 cylinders, total 968572928 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/MediaServer--vg-root doesn't contain a valid partition table
Disk /dev/mapper/MediaServer--vg-swap_1: 3883 MB, 3883925504 bytes
255 heads, 63 sectors/track, 472 cylinders, total 7585792 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/MediaServer--vg-swap_1 doesn't contain a valid partition table
答案1
您可以运行 lvextend 来增加逻辑卷的大小:
sudo lvextend /dev/mapper/MediaServer--vg-root
您还需要扩展文件系统以利用新空间。对于 ext2/3/4 文件系统,请运行:
sudo resize2fs /dev/mapper/MediaServer--vg-root
如果您运行的是现代版本的 Linux,那么您应该能够在线完成所有操作。标准警告适用于存储混乱和数据丢失的可能性。备份重要文件并谨慎操作。
如果这不起作用,最好查看一下你的 lvm 结构。这应该会提供一些有用的调试信息:
sudo pvdisplay
sudo vgdisplay
sudo lvdisplay