Linux CentOS5.564-bit virtual machine version VmwareWorkstation9.01. add a new hard disk to linux on the virtual machine, the size is 20 GB (can be customized) 2. open the terminal and use fdisk to format and partition the newly mounted hard disk/dev/sdb,
Preface:
1. add a new hard disk to linux on the VM, with a size of 20 GB (customizable)
2. open the terminal, use fdisk to format the partition of the new hard disk/dev/sdb that has just been attached, and divide a m primary partition and a 1g primary partition.
1) view the newly added hard disk fdisk? L
| 1234567891011121314 |
Fdisk-lDisk/dev/sda: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065*512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 33 265041 83 Linux/dev/sda2 34 1308 10241437 + 83 Linux/dev /sda3 1309 1945 5116702 + 83 Linux/dev/sda4 1946 2610 5341612 + 5 Extended/dev/sda5 1946 2072 1020096 82 Linux swap/SolarisDisk/dev/sdb: 21.4 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065*512 = 8225280 bytesDisk/dev/sdb doesn't contain a valid partition table |
2). partition
| 1234567891011121314151617181920212223242526272829303132333435 |
[Root @ localhost ~] # Fdisk/dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. changes will remain in memory only, until you decide to write them. after that, of course, the previuscontent won't be recoverable. the number of cylinders for this disk is set to 2610. there is nothing wrong with that, but this is larger than 1024, and cocould in certain setup S cause problems with: 1) software that runs at boot time (e.g ., old versions of LILO) 2) booting and partitioning software from other OSs (e.g ., dos fdisk, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite) Command (m for help ): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 1 First cylinder (1-2610, default 1): Using default value 1 Last cylinder or + size or + sizeM or + sizeK (1-2610, default 2610): + 100 MCommand (m for help ): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 2 First cylinder (14-2610, default 14 ): using default value 14 Last cylinder or + size or + sizeM or + sizeK (14-2610, default 2610): + 1 GCommand (m for help): wThe partition table has been altered! Calling ioctl () to re-read partition table. Syncing disks. [root @ localhost ~] # |
3) re-read the partition table
| 12 |
[Root @ localhost ~] # Partprobe/dev/sdb [root @ localhost ~] # |
4). format it to the ext3 file system.
| 12 |
[Root @ localhost ~] # Mke2fs-j/dev/sdb1 [root @ localhost ~] # Mke2fs-j/dev/sdb2 |
5) mount the newly formatted partition/dev/sdb1 to/mnt/boot/dev/sdb2 to/mnt/sysroot
| 1234 |
[Root @ localhost ~] # Mkdir-p/mnt/boot [root @ localhost ~] # Mkdir-p/mnt/sysroot [root @ localhost ~] # Mount/dev/sdb1/mnt/boot/[root @ localhost ~] # Mount/dev/sdb2/mnt/sysroot/ |
6) view the Mount partition
| 12345678910111213 |
[Root @ localhost ~] # Mount/dev/sda2 on/type ext3 (rw) proc on/proc type proc (rw) sysfs on/sys type sysfs (rw) devpts on/dev/pts type devpts (rw, gid = 5, mode = 620)/dev/sda3 on/data type ext3 (rw) |