Mặc dù bạn có không gian trên hệ điều hành khách của bạn, VM là limited.There là cupple các bước cần thiết để tăng kích thước của đĩa của bạn:
đầu tiên, vagrant halt
để đóng VM của bạn
thay đổi kích thước đĩa
VBoxManage clonehd box-disk1.vmdk box-disk1.vdi --format vdi
VBoxManage modifyhd box-disk1.vdi --resize 50000
bắt đầu hộp ảo và cấu hình thay đổi của VM để kết hợp đĩa mới
sử dụng fdisk để thay đổi kích thước đĩa
bạn cần phải tạo một phân vùng mới với không gian mới và phân bổ nó, vì vậy đầu tiên khởi động máy ảo và đăng nhập như siêu người dùng
vagrant up && vagrant ssh
su -
lệnh (như minh họa từ ví dụ của tôi) là
[[email protected] ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sda: 52.4 GB, 52428800000 bytes
255 heads, 63 sectors/track, 6374 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x00041a53
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 2611 20663296 8e Linux LVM
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (2611-6374, default 2611):
Using default value 2611
Last cylinder, +cylinders or +size{K,M,G} (2611-6374, default 6374):
Using default value 6374
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[[email protected] ~]#
lưu ý bạn có thể cần phải thay đổi/dev/sda so sánh với cấu hình của bạn
tạo một phân vùng mới (một lần nữa đăng nhập như siêu người dùng su -
)
su -
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 linux lvm2 a-- 19.70g 0
[[email protected] ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 linux lvm2 a-- 19.70g 0
/dev/sda3 lvm2 a-- 28.83g 28.83g
[[email protected] ~]# vgextend linux /dev/sda3
Volume group "linux" successfully extended
[[email protected] ~]# lvextend -l +100%FREE /dev/linux/root
[[email protected] ~]# resize2fs /dev/linux/home
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/linux/home is mounted on /home; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/linux/home to 7347200 (4k) blocks.
The filesystem on /dev/linux/home is now 7347200 blocks long.
Nguồn
2015-07-31 13:33:32
'ncdu' cho thấy khoảng 6GB sử dụng, vì vậy tôi đang bối rối ngay bây giờ. – nha