How does one Add a new virtual hard disk in the Virtual Machine VirtualBox? virtualbox uses a fixed-size virtual hard disk. Currently, there is not enough space. We need to add another virtual hard disk. How can we add it? Www.2cto.com 1. Create a virtual hard disk in virtualbox, and use "Settings" -- "Storage" -- add a virtual hard disk
Add the virtual hard disk as prompted. 2. Start the system using a virtual hard disk partition and view the disk space [plain] [root @ localhost ~] # If fdisk-l is normal, you will see a similar message: Disk/dev/hdb doesn't contain a valid partition table. Here/dev/hdb is the new virtual hard Disk. Partition a virtual hard disk: www.2cto.com [plain] [root @ localhost ~] # Fdisk/dev/hdb input m to view help [plain] Command (m for help): m input n add partition [plain] Command (m for help ): n input p create primary Partition type number 1, add a primary Partition www.2cto.com [plain] Partition number (1-4 ): 1 Press Enter [Enter] [plain] First cylinder (1-41610, default 1 ): press Enter and press Enter. [Enter] [plain] Last cylinder or + size or + sizeM or + sizeK (1-41610, default 41610 ): enter w to write data and exit [plain] Command (m for help): w www.2cto.com 3. Before formatting a virtual hard disk partition and formatting it to ext4, you must first check the system Whether to load the ext4 module [plain] [root @ localhost ~] # Lsmod | if grep ext4 is not loaded, manually load it (there is an ext4 module in centos5.x, but it needs to be manually loaded) [plain] [root @ localhost ~] # Cd/lib/modules/2.6.18-194. el5/kernel/fs/ext4/if there is no accident, you will see the ext4.ko file, load the ext4 module [plain] [root @ localhost ext4] # modprobe ext4 to check whether the load is successful: [plain] [root @ localhost ext4] # lsmod | grep ext4 ext4 254557 0 jbd2 60325 1 ext4 crc16 6209 1 ext4 the above indicates that the load is successful. Before formatting, install e4fsprogs. If not, run the following command to install e4fsprogs: [plain] [root @ localhost ext4] # yum-y install e4fsprogs to format the partition: [plain] [root @ localhost ext4] # mkfs. ext4/dev/hdb1 4. mount a virtual partition to create a mount directory: /mnt/hdb1 [plain] [root @ localhost dev] # cd/mnt/[root @ localhost mnt] # mkdir hdb1 Mount virtual partitions/dev/hdb1 to/mnt/hdb1/ [plain] [root @ localhost mnt] # mount-t ext4/dev/hdb1/mnt/hdb1/view the file system: [plain] [root @ localhost hdb1] # df-lh file system capacity used and available % Mount point/dev/mapper/VolGroup00-LogVol00 6.7G 6.0G 378 M 95%/dev/hda1 99 M 25 M 70 M 26%/boot tmpfs 315 M 0 315 M 0%/dev/ shm/dev/hdb1 20G 172 M 19G 1%/mnt/hdb1 actually saw/mnt/hdb1. So far, the basic operation has been completed. 5. fstab [plain] [root @ localhost ~] # Vim/etc/fstab add a line at the end of the file: [plain]/dev/hdb1/mnt/hdb1 ext4 defaults 0 0