maybe yes 发表于2015-05-21 01:20
原文链接 : 来自 :
本文将讲解在 Mac OS X 下如何为 VirtualBox 虚拟机系统 Ubuntu 扩大磁盘容量。
在 VirtualBox 的菜单栏中,设置->存储->控制器:SATA 处点击添加,此操作要求虚拟机为关机状态才可以添加,如下图所示。
创建存储后,通过 fdisk 命令查看,发现新的存储 sdb 没有分区。
rhett@ubuntu-may:~/Workspace$ sudo fdisk -l Disk /dev/sda: 20 GiB, 214748380 bytes, 41943040 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 Disklabel type: dos Disk identifier: 0x9941d8ab Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 499711 4976 243M 83 Linux /dev/sda2 501758 41940991 41439234 19.8G 5 Extended /dev/sda3 499712 501757 2046 1023K 83 Linux /dev/sda4 41940992 41943039 2048 1M 83 Linux /dev/sda5 501760 41940991 41439232 19.8G 8e Linux LVM Partition table entries are not in disk order. Disk /dev/sdb: 41.9 GiB, 44955238400 bytes, 87803200 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 /dev/mapper/ubuntu--may--vg-root: 3.2 GiB, 3460300800 bytes, 6758400 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 /dev/mapper/ubuntu--may--vg-swap_1: 508 MiB, 532676608 bytes, 1040384 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
在新增加的硬盘空间里增加分区,如下命令:
rhett@ubuntu-may:~/Workspace$ sudo fdisk /dev/sdb
执行上面的命令后,会进入输入模式,分别选择 n ,p, ....中间默认,最后别忘了输入 w 保存分区。
磁盘分区成功后,再次使用 fdisk 命令查看,可以看到多了一个 SDB1 磁盘分区。
rhett@ubuntu-may:~/Workspace$ sudo fdisk -l Disk /dev/sda: 20 GiB, 214748380 bytes, 41943040 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 Disklabel type: dos Disk identifier: 0x9941d8ab Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 499711 4976 243M 83 Linux /dev/sda2 501758 41940991 41439234 19.8G 5 Extended /dev/sda3 499712 501757 2046 1023K 83 Linux /dev/sda4 41940992 41943039 2048 1M 83 Linux /dev/sda5 501760 41940991 41439232 19.8G 8e Linux LVM Partition table entries are not in disk order. Disk /dev/sdb: 41.9 GiB, 44955238400 bytes, 87803200 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 Disklabel type: dos Disk identifier: 0x0ed142 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 87803199 87801152 41.9G 83 Linux Disk /dev/mapper/ubuntu--may--vg-root: 3.2 GiB, 3460300800 bytes, 6758400 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 /dev/mapper/ubuntu--may--vg-swap_1: 508 MiB, 532676608 bytes, 1040384 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
格式化磁盘 sdb1 分区为 ext4 格式,如下命令所示:
rhett@ubuntu-may:~/Workspace$ sudo mkfs -t ext4 /dev/sdb1 mke2fs 1.42.10 (18-May-2014) Creating filesystem with 10975144 4k blocks and 2744320 inodes Filesystem UUID: 29ed7b70-2b0a-46fa-808d-f4203b3ff4c0 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
rhett@ubuntu-may:~/Workspace$ sudo mount /dev/sdb1 /home/rhett/