On the new hard disk partition, relatively convenient, because do not worry about the original data loss and so on, the operation failed, big deal again, but now is the existing data on the hard disk, zoning and mount, so must be careful, careful!
First recognize the next few command characters:
Fdisk: View the partition information and manipulate the partitions;
MKFS: Format the new partition;
Mount: This is the partition after the hard disk mount, only to mount the specified directory, can be used normally.
Next, record the steps: First, the command "fdisk-l" to view all the partition information, which appears as follows:
root@myvps****:/dev# fdisk-l
disk/dev/xvdb:42.9 GB, 42949672960 bytes
255 heads, Sectors/track, 5221 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk IDENTIFIER:0X000D68A3
Device Boot Start End Blocks Id System
/DEV/XVDB1 1 2610 20964793+ Linux
disk/dev/xvda:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk Identifier:0x0000aba6
Device Boot Start End Blocks Id System
/DEV/XVDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/xvda2 1306 9972736 8e Linux LVM
disk/dev/mapper/vg_501153278-lv_root:9135 MB, 9135194112 bytes
255 heads, Sectors/track, 1110 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
disk/dev/mapper/vg_501153278-lv_swap:1073 MB, 1073741824 bytes
255 heads, Sectors/track, 130 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
It's a little complicated, there are two disks in the analysis, respectively.
disk/dev/xvdb:42.9 GB and disk/dev/xvda:10.7 GB
Xvda is a system disk, no matter what he sees, the XVDB display is 42.9GB, but the actual display is only 20GB
/DEV/XVDB1 1 2610 20964793+ Linux
This indicates that there is no mount, the following operation of the process, refer to the network.
root@myvps2282:/dev# Fdisk/dev/sdb
Command (M for help): N (n = newly created new zone, if you do not know how to use the command, first into m to see help)
Command Action
E Extended
P primary partition (1-4)
(This lets you choose to create a primary partition or an extension. I just started to choose to create an extended partition, because the original 30 g I created the primary partition, but later through the MKFS to create the file system will be an error, so here I later deleted the created extension partition, select the primary partition to be successful.
P (select Create Primary partition)
Partition number (1-4): 2 (through the command fdisk-l example of the partition information can be seen, has been SDB has been divided into the first area SDB1, so here must enter numbers greater than 1, otherwise the system will prompt you to enter the partition number already exists, request re-enter)
First cylinder (3917-7832, default 3917): (Let the selection be created from that location on the disk, where you can enter without input, direct carriage return, and the default is to start at the end of the last partition)
Using Default Value 3917
Last cylinder, +cylinders or +size{k,m,g} (3917-7832, default 7832):(Select the end of the hard drive, if you do not want to divide the other areas, direct return to the default for all remaining disk space)
Using Default Value 7832
Command (M for help): W (save partition information and exit, below are some tips)
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Warning:re-reading the partition table failed with error 16:device or resource busy.
The kernel still uses the old table. The new table is used at
The next reboot or after you run Partprobe (8) or KPARTX (8)
The last line of the tip is that you need to reboot the system, the partition can take effect, if this time does not restart the system, directly through the MKFS to create a file system, the system will complain:
MKE2FS 1.41.12 (17-may-2010)
Mkfs.ext3:inode_size (128) * Inodes_count (0) too big for a
FileSystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
Then just restart the system.
After reboot, pass again:
Mkfs-t EXTS/DEV/SDB2
Create a file system for the new partition with the following tips:
KE2FS 1.41.12 (17-may-2010)
FileSystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, stripe width=0 blocks
1966080 inodes, 7863817 blocks
393190 blocks (5.00%) reserved for the Super user
The Data block=0
Maximum filesystem blocks=0
Block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing Inode Tables:done
Creating journal (32768 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem would be automatically checked every mounts or
180 days, whichever comes. Use Tune2fs-c or-i to override.
By this, the partition is created successfully, and it needs to be mounted only to the specified directory:
Mount/dev/sdb2/aaa
Of course, in order to be able to automatically mount the next time we start, we need to add the following information to the partition table:
/DEV/SDB2/AAA ext3 Defaults 1 2
The file for the partition table is located at:/etc/fstab
The DF command allows you to see the partition that we mounted after the partition was successfully completed.