Create a virtual hard disk
1. Close the virtual system that is running in the VM;
2. Right-click on the virtual system name-"virtual machine Settings;"
3. Hardware Page "Add"-"Add a hard disk-" Create a new virtual disk-"SCSI (recommended)-" Allocate space size-"OK;
4, you can see a new hard disk drive in the hardware 2.
First, partition and format the virtual hard disk
1. See how many drives are currently on the system
[Email protected] data1]# fdisk-l
First hard drive information
disk/dev/sda:36.4 GB, 36401479680 bytes
255 heads, Sectors/track, 4425 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 255 2048256 Linux
/dev/sda2 1530 10241437+ Linux
/dev/sda3 4296 4425 1044225, Linux swap
/DEV/SDA4 1531 4295 22209862+ f Win95 Ext ' d (LBA)
/dev/sda5 1531 2805 10241406-up Linux
/dev/sda6 2806 4295 11968393+-up Linux
Partition table entries is not in disk order
Second Drive information
disk/dev/sdb:36.7 GB, 36703918080 bytes # # found here/dev/sdb, capacity 36.7G, cut not partitioned
255 heads, Sectors/track, 4462 cylinders
Units = Cylinders of 16065 * 8225280 bytes
DISK/DEV/SDC doesn ' t contain a valid partition table
The second hard disk does not have a partition table
[Email protected] root]# fdisk/dev/sdb
Partitioning the second hard drive
The number of cylinders for this disk was set to 4462.
There is nothing wrong with the, but this is larger than 1024,
And could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from the other OSs
(e.g., DOS fdisk, OS/2 fdisk)
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)
Command (M for help): P
# # Print out the list of partitions under the current drive
disk/dev/sdb:36.7 GB, 36703918080 bytes
255 heads, Sectors/track, 4462 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
Command (M for help): N
# # Add a partition
Command Action
E Extended
P primary partition (1-4)
# # Because the main partition is usually selected, so here's a P
P
Partition number (1-4):1# # Here because it's the first one, so just select 1, if it's the second partition, select 2, and so on
First cylinder (1-4462, default 1): # # Number of disk blocks starting with the new partition
Using Default value 1
Last cylinder or +size or +sizem or +sizek (1-4462, default 4462): If you want to partition 10G, you can enter it directly: +10240m, because you want to use all the hard disk space, the default
Using Default Value 4462
Command (M for help): P
disk/dev/sdb:36.7 GB, 36703918080 bytes
255 heads, Sectors/track, 4462 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDB1 1 4462 35840983+ Linux
# # Here the first partition has been divided, then the partition must be written to the hard disk, W
Command (M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
The following work is the format of the hard disk, I am here to format into ext3
[Email protected] root]# MKFS.EXT3/DEV/SDB1(Here The original command is: Mke2fs-j/dev/sdb1, tried a bit unsuccessful, changed)
MKE2FS 1.32 (09-nov-2002)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4480448 inodes, 8960245 blocks
448012 blocks (5.00%) reserved for the Super user
First Data block=0
274 block Groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing Inode Tables:done
Creating Journal (8192 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
Check to see if it's formatted well
[Email protected] root]#fdisk-l
disk/dev/sda:36.4 GB, 36401479680 bytes
255 heads, Sectors/track, 4425 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 255 2048256 Linux
/dev/sda2 1530 10241437+ Linux
/dev/sda3 4296 4425 1044225, Linux swap
/DEV/SDA4 1531 4295 22209862+ f Win95 Ext ' d (LBA)
/dev/sda5 1531 2805 10241406-up Linux
/dev/sda6 2806 4295 11968393+-up Linux
Partition table entries is not in disk order
disk/dev/sdb:36.7 GB, 36703918080 bytes
255 heads, Sectors/track, 4462 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDB1 1 4462 35840983+ Linux
mount a virtual hard disk
Partition well, also formatted well, the following is mounted
I hung/dev/sdb1 under/data1.
[[email protected] root]# MKDIR/DATA1 # # First build the mounted directory Data1
[Email protected] root]#mount/dev/sdb1/data1# #将sdb1挂载到data1
After rebooting the system, check to see if the mount is successful:
[Email protected] data1]# df-h
File system capacity has been used with available% mount points
/DEV/SDA1 2.0G 454M 1.4G 25%/
/dev/sda6 12G 53M 11G 1%/bak
/DEV/SDB1 34G 33M 32G 1%/data1
None 250M 0 250M 0%/dev/shm
/dev/sda2 9.7G 1.5G 7.7G 17%/usr
/dev/sda5 9.7G 8.6G 559M 95%/var
See here/dev/sda6 12G 53M 11G 1%/bak
The description has been mounted successfully. You can view this mounted data1 in the root directory "/".
This article is from the "Godben" blog, make sure to keep this source http://godben.blog.51cto.com/8919725/1714436
VMware Virtual Machine Linux adds hard drives