我创建了一个 ubuntu 服务器虚拟机,配置了 64GB 的存储空间。我记得我指定了 30GB 用于虚拟机。当我这样做时df -h
,我得到了
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/analysis--db-root<br/>
28G 25G 904M 97% /
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 793M 228K 793M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
/dev/sda1 228M 45M 171M 21% /boot
磁盘几乎已满,如何使用配置存储中的另外 30GB?
另外,当我输入“sudo parted -l”时:
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 256MB 255MB primary ext2 boot
2 257MB 64.4GB 64.2GB extended
5 257MB 64.4GB 64.2GB logical lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/analysis--db-swap_1: 533MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 533MB 533MB linux-swap(v1)
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/analysis--db-root: 29.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 29.5GB 29.5GB ext4
答案1
我已经通过参考解决了这个问题http://ezunix.org/index.php/Extend_existing_LVM_root_partition_without_rebooting。我只需要扩展逻辑卷,然后扩展文件系统。
twadmin@analysis-db:~$ sudo lvextend -l +100%FREE /dev/analysis-db/root
Extending logical volume root to 59.26 GiB
Logical volume root successfully resized
twadmin@analysis-db:~$ sudo resize2fs /dev/mapper/analysis--db-root
resize2fs 1.41.14 (22-Dec-2010)
Filesystem at /dev/mapper/analysis--db-root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/mapper/analysis--db-root to 15535104 (4k) blocks.
The filesystem on /dev/mapper/analysis--db-root is now 15535104 blocks long.
twadmin@analysis-db:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/analysis--db-root
59G 25G 31G 45% /
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 793M 228K 793M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
/dev/sda1 228M 45M 171M 21% /boot