Virtualbox中Linux添加新磁盘并创建分区

引言:我们常常在使用系统的时候突然发现,哎呦~~~我们的磁盘空间不够用啦!我遇到常见的就是数据库数据暴增,预留的空间没有啦,只好新添加磁盘,在VB虚拟机上就可以实现,往往苦于没有图文并茂的好资料,下面我来为大家简单快捷的实操示范一下,做一名“实操族”偶耶!

Virtualbox中Linux添加一个新磁盘->创建分区->格式化->挂载分区。

virtualbox 设置添加磁盘

关闭你的虚拟机,挂载新磁盘不可以在开机状态做

Virtualbox 菜单栏-> 设置-> 存储-> SATA控制器 -> 右击,选择“添加虚拟硬盘”

Virtualbox中Linux添加新磁盘并创建分区

 

注:千万不要选择“IDE控制器”这是一种非常古老的并口磁盘,现在已经都淘汰了,请选SATA控制器现在流行的串口磁盘添加。我们点击红框框中的“添加虚拟磁盘”按钮

 

Virtualbox中Linux添加新磁盘并创建分区

它会问你,添加虚拟磁盘是要创建一个新文件来保存数据,还是选择一个现有文件保存,我们选择“创建新的虚拟磁盘”

Virtualbox中Linux添加新磁盘并创建分区

这时又让你选择“虚拟磁盘文件类型”,请注意90%都是选择VDI(虚拟磁盘映像)类型的,如果你的系统没有什么特殊需求,请选择第一个。点击“下一步”

 

Virtualbox中Linux添加新磁盘并创建分区

选择“动态分配”磁盘空间,只在需要的时候扩展物理磁盘空间,点击“下一步”

Virtualbox中Linux添加新磁盘并创建分区

虚拟磁盘映像文件的路径:E:\Vritaulbox\leonarding2.vdi

虚拟磁盘映像文件的大小:20GB

点击“创建”

Virtualbox中Linux添加新磁盘并创建分区

 

 

现在已经创建好了一个新的虚拟磁盘“leonarding2.vdi”,我们启动系统,virtualbox添加工作已经完成,剩下的就是在Linux系统中给新添加的磁盘->分区。

 

Linux系统进行新磁盘分区

[root@leonarding1~]# fdisk –l                检查现有系统磁盘空间

Disk/dev/sda: 21.4 GB, 21474836480 bytes        这是我们原来的那块旧磁盘

255 heads, 63sectors/track, 2610 cylinders

Units = cylindersof 16065 * 512 = 8225280 bytes

   Device Boot     Start       End     Blocks  Id  System     旧磁盘就分了2个分区

/dev/sda1   *        1        13     104391   83  Linux

/dev/sda2           14       2610   20860402+  8e  Linux LVM

Disk/dev/sdb: 21.4 GB, 21474836480 bytes     这是我们新添加的磁盘/dev/sdb,还没有分区

255 heads, 63sectors/track, 2610 cylinders

Units = cylindersof 16065 * 512 = 8225280 bytes

Disk /dev/sdbdoesn't contain a valid partition table  不包含有效分区表信息,我们需要给新磁盘创建分区表

Disk /dev/dm-0:18.2 GB, 18253611008 bytes     下面这些都不用管

255 heads, 63sectors/track, 2219 cylinders

Units = cylindersof 16065 * 512 = 8225280 bytes

Disk /dev/dm-0doesn't contain a valid partition table

Disk /dev/dm-1:3087 MB, 3087007744 bytes

255 heads, 63sectors/track, 375 cylinders

Units = cylindersof 16065 * 512 = 8225280 bytes

Disk /dev/dm-1doesn't contain a valid partition table

[root@leonarding1~]# fdisk /dev/sdb          sdb磁盘分区,有很多选项,我们选择m帮助信息

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

Building a new DOSdisklabel. Changes will remain in memory only,

until you decideto write them. After that, of course, the previous

content won't be recoverable.

The number ofcylinders for this disk is set to 2610.

There is nothingwrong with that, but this is larger than 1024,

and could incertain setups cause problems with:

1) software thatruns at boot time (e.g., old versions of LILO)

2) booting andpartitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14488.html