partitioning of instance in OpenStack

只谈情不闲聊 提交于 2019-12-12 03:28:17

问题


I uploaded a virtual box image in vdi format to OpenStack. I added a flavor of 100 G size to the instance created using that .vdi image. But it still showing the 15 G size allocated in virtual box. I dont know how to partition the disk to use the size provided by the OpenStack flavor.

# df -h 

is as follows

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

And

# fdisk /dev/vda1

is as follows

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): 

How I need to partition the Virtual machine disk to get the entire 100 Gb size??


回答1:


The partition and filesystem is not extended automatically.

Hint: in your question you use fdisk on the partition /dev/vda1 instead of the disk /dev/vda.

You have to do two steps if you want to use the existing partition layout:

  1. Increase the size of a partition. There are many documentations available in the internet; example: Parted: Growing a partition into unused space.

  2. Increase the size of the filesystem. The command that is needed here depends on your filesystem. If you are using ext[234] you can use resize2fs /dev/vda1.

As an alternative you can create a new partition in the empty space (using e.g. fdisk /dev/vda and then the command n for new), create a new file system on the new partition and mount it - don't forget to add it to /etc/fstab that is gets mounted automatically after the next boot.



来源:https://stackoverflow.com/questions/36839303/partitioning-of-instance-in-openstack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!