首先找到VBOX的安装目录,cd到此目录下
VBoxManage modifyhd
[--type normal|writethrough|immutable|shareable|
readonly|multiattach]
[--autoreset on|off]
[--compact]
[--resize
VBoxManage 修改硬盘的命令如上。uuid可通过list hdds查看到,如下:
C:\Program Files\Oracle\VirtualBox>VBoxManage list hdds
UUID: 8fb0a784-9e1c-4b5b-92e2-76177002eacbUsage: dg1 (UUID: ba35342b-6a51-46e2-a807-79273f341eb1)
修改如下,
C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd 53e7a957-0164-4dea-803f-c0304e69cf60 --resize 20000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
------虚拟机硬盘空间扩大了,然后挂在分配的硬盘,具体步骤如下:
dg1:~/Desktop # df -k
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/sda2 7513960 7132344 0 100% /
devtmpfs 251428 164 251264 1% /dev
tmpfs 251428 100 251328 1% /dev/shm
1---查看新加载的磁盘
dg1:~/Desktop # fdisk -l
Disk /dev/sda: 21.0 GB, 20971520000 bytes
255 heads, 63 sectors/track, 2549 cylinders, total 40960000 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: 0x000944de
Device Boot Start End Blocks Id System
/dev/sda1 2048 1509375 753664 82 Linux swap / Solaris
/dev/sda2 * 1509376 16777215 7633920 83 Linux
2---创建分区
dg1:~/Desktop # fdisk /dev/sda
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
然后按 n分区,在w退出即可。
3--格式化新分区
格式化mkfs.ext3 /dev/sda3 --这个要和你前面创建的分区对应上
4--添加挂接地址
vi /etc/fstab,添加一行
/dev/sda3 /oracle ext3 defaults 1 1
如果要挂再到已存在的目录,先把里面的东西备份下
然后重启下看下结果如何