2016-04-25 40 views
0

我上傳了一個vdi格式的虛擬框圖像給OpenStack。我爲使用該.vdi圖像創建的實例添加了100 G大小的味道。但它仍然顯示在虛擬盒子中分配的15 G大小。我不知道如何分區磁盤以使用OpenStack提供的大小。在OpenStack中分割實例

# df -h 

如下

Filesystem  Size Used Avail Use% Mounted on 
/dev/vda1  15G 4,4G 9,3G 32%/
none   4,0K  0 4,0K 0% /sys/fs/cgroup 
udev   2,0G 4,0K 2,0G 1% /dev 
tmpfs   396M 824K 395M 1% /run 
none   5,0M  0 5,0M 0% /run/lock 
none   2,0G 144K 2,0G 1% /run/shm 
none   100M 40K 100M 1% /run/user 

而且

# fdisk /dev/vda1 

如下

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel 

Building a new DOS disklabel with disk identifier 0xe682a7ff. 
Changes will remain in memory only, until you decide to write them. 
After that, of course, the previous content won't be recoverable. 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 

Command (m for help): p 

Disk /dev/vda1: 15.8 GB, 15793651712 bytes 
16 heads, 63 sectors/track, 30602 cylinders, total 30846976 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 identifier: 0xe682a7ff 

Device Boot  Start   End  Blocks Id System 

Command (m for help): 

如何需要將虛擬機磁盤,以獲得整個100 GB的分區尺寸??

+0

重複的:http://stackoverflow.com/questions/31295416/openstack-instance-does-not-use-the-entire-hard-disk –

回答

0

分區和文件系統不會自動擴展。

提示:在您的問題中,您使用分區上的fdisk/dev/vda1而不是磁盤/ dev/vda。

你要做兩個步驟,如果你想使用現有的分區佈局:

  1. 增加分區的大小。互聯網上有許多文件可供使用;例如:Parted: Growing a partition into unused space

  2. 增加文件系統的大小。這裏需要的命令取決於你的文件系統。如果您使用的是ext [234],則可以使用resize2fs /dev/vda1

正如你可以創建空的空間的新分區的選擇(例如,使用fdisk /dev/vda,然後新的命令n),在新的分區創建一個新的文件系統,並將它安裝 - 不要忘記將其添加到/etc/fstab即下次啓動後自動安裝。