[Linux]vbox virtual machine Add new disk

Source: Internet
Author: User

That's the case, the hard drive setup was too small to start creating the virtual machine, only 10g, and I'm now adding a hard disk to this Linux (centos6.6) virtual machine with VBox settings.
The following action is how to mount the hard drive to the system.

Use Fdisk to view information about the physical disk now (this is done with root permission)

The following actions are root permissions.

[[email protected] ~]# fdisk -l...32.232212254720 bytes2556339161606551282252805125125125120x00000000...
Write Partition Table

The following is an interaction is a process, after each input according to the prompt, in the input

[Email protected] ~]# Fdisk/dev/sdbdevice contains neither a valid DOS partition table, nor Sun, SGIorOSF disklabelbuilding ANewDOS Disklabel withDisk identifier0xa4378777. Changes'll remaininchMemory only,untilYou decide to Writethem. After that, ofCourse, the previous content won' t be recoverable. Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite) warning:dos-compatible mode is deprecated. It 'S strongly recommended toSwitch off the mode command' C ') andChange display units toSectors (Command' u '). Command (M forHelp): Ncommand action E Extended P primary partition (1-4) Ppartition Number (1-4):1First Cylinder (1-3916,default 1):Using defaultValue1Last Cylinder, +cylindersor+size{k,m,g}(1-3916,default 3916):Using defaultValue3916Command (M forHelp): Wthe partition Table hasbeen altered! Calling IOCTL () tore-ReadPartition table. Syncing disks.

When we're done, we'll look at the disk information.

# fdisk-l...DISK/DEV/SDB:32.2GB,32212254720bytes255Heads theSectors/track,3916Cylindersunits = Cylinders of16065* +=8225280Bytessector size (logical/physical): +Bytes/ +BYTESI/O size (Minimum/optimal): +Bytes/ +Bytesdisk identifier:0xa4378777Device Boot Start End Blocks Id system/dev/sdb11        3916    31455238+ theLinux...

One more piece of partition information

formatting partitions

A command would be fine.

# MKFS.EXT4/DEV/SDB1MKE2FS1.41.( --may- .) Filesystemlabel=ostype: LinuxBlockSize=4096(log=2) Fragment size=4096(log=2) stride=0blocks, Stripe width=0Blocks1966080Inodes,7863809Blocks393190Blocks (5.00%) reserved forThe Super Userfirst dataBlock=0Maximum filesystem blocks=4294967296 - BlockGroups32768Blocks perGroup,32768Fragments perGroup8192Inodes perGroupSuperblock Backups Stored onBlocks32768,98304,163840,229376,294912,819200,884736,1605632,2654208,4096000? Writing inode tables:donecreating Journal (32768Blocks): donewriting superblocks andFileSystem Accounting Information:donethis filesystem'll be automatically checked every -Mountsor theDays, whichever comes first. UseTune2fs-cor-I. toOverride.
To create a new volume label (ignorable)

This step, I saw some people did, some people did not do, and then checked the information.
Can look at the reference E2label command

# e2label /dev/sdb1 /data

Check it out.

# e2label /dev/sdb1/data

Create a mount directory that is consistent with the previous step

mkdir /data

To automatically mount the boot, you also need to edit /etc/fstab the file, add a line after the file

/dev/sdb1       /data                   ext4    defaults        0 0

Some may not be familiar with this configuration file, see [Fatab Chinese explanation] (https://wiki.archlinux.org/index.php/Fstab_ (%e7%ae%80%e4%bd%93%e4%b8%ad%e6%96% 87)

#Mount-a#DF-LHFilesystem            Size  used Avail  Use% mounted on/Dev/Mapper/Vg_orangleliu-Lv_root                      6.5G  3.2G  3.0G   the% /Tmpfs                 499M     0  499M   0%/dev/shm/Dev/sda1             477M    inM  424M   7%/boot/Dev/SDB1               -G    -M    -G   1%/data

Then reboot and view the mount condition again, normal mount, success.

Copyright NOTICE: This article is Orangleliu (http://blog.csdn.net/orangleliu/) original article, the article reproduced please declare.

[Linux]vbox virtual machine Add new disk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.