Fdisk for linux System Disk partitioning
The fdisk command is usually used to learn disk partitions. Of course, for disks smaller than 2 TB, we basically use the fdisk command for partitioning. Below we will briefly introduce the basic commands and Scenario Simulation commands for fdisk operations. Introduction to fdisk-l viewing all disk information, fdisk/dev/sdb using fdisk command tool operation/dev/sdb disk m display all command information, usage p display partition information q exit w save partition information, only after executing the w command will partition information be written to disk d 1 Delete disk the first partition scenario simulation has a 1g Disk/dev/sdb partition as a primary partition, the size of an extended partition is mb. a mb logical partition/dev/sdb5 is created on the extended partition. The format file system is mkfs. ext4 is automatically mounted to the directory/backup31 at startup. Use the fdisk Command tool to operate the disk/dev/sdb fdisk/dev/sdb2 to create a primary partition Command (m Help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 Using default value 1 Last cylinder, + cylinders or + size {K, M, G} (1-130, default 130): + 400 M Command (m for help): p Disk/dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065*512 = 8225280 bytes Sector size (logical/physical ): 512 bytes/512 bytes I/O size (Minimum/optimal): 512 bytes/512 bytes Disk identifier: 0x0004a98a Device Boot Start End Blocks Id System/dev/sdb1 1 52 417658 + 83 Linux3 create an extended partition Command (m for help ): n Command action e extended p primary partition (1-4) e Partition number (1-4): 2 First cylinder (53-130, default 53 ): using default value 53 Last cylinder, + cylinders or + size {K, M, G} (53-130, default 130): + 400 M Command (m Help): p Disk/dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065*512 = 8225280 bytes Sector size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal ): 512 bytes/512 bytes Disk identifier: 0x0004a98a Device Boot Start End Blocks Id System/dev/sdb1 1 52 417658 + 83 Linux/dev/sdb2 53 104 417690 5 Extended4 create a logical partition Command (M for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (53-104, default 53 ): using default value 53 Last cylinder, + cylinders or + size {K, M, G} (53-104, default 104): + 100 M Command (m for help ): p Disk/dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 cylinders Units = cylinders of 16065*512 = 8225280 bytes Sector size (logical/physical ): 512 bytes/512 bytes I/O size (minimum/optimal): 512 bytes/512 bytes Disk identifier: 0x0004a98a Device Boot Start End Blocks Id System/dev/sdb1 1 52 417658 + 83 Linux/dev/sdb2 53 104 417690 112423 5 Extended/dev/sdb5 53 66 + 83 Linux 5 save Command (m for help): w The partition table has been altered! Calling ioctl () to re-read partition table. Syncing disks.6 partition the disk [root @ hsj2 ~] # Mkfs. ext4/dev/sdb1mke2fs 1.41.12 (17-May-2010) Filesystem label = OS type: LinuxBlock size = 1024 (log = 0) Fragment size = 1024 (log = 0) stride = 0 blocks, Stripe width = 0 blocks104448 inodes, 417656 blocks20882 blocks (5.00%) reserved for the super userFirst data block = 1 Maximum filesystem blocks = 6763315251 block groups8192 blocks per group, 8192 fragments per group2048 inodes per groupSuperblock backups stor Ed on blocks: 8193,245 77, 40961,573 45, 73729,204 801, 221185,401 409 Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 31 mounts or180 days, whichever comes first. use tune2fs-c or-I to override. [root @ hsj2 ~] # Mkfs. ext4/dev/sdb5mke2fs 1.41.12 (17-May-2010) Filesystem label = OS type: LinuxBlock size = 1024 (log = 0) Fragment size = 1024 (log = 0) stride = 0 blocks, Stripe width = 0 blocks28112 inodes, 112420 blocks5621 blocks (5.00%) reserved for the super userFirst data block = 1 Maximum filesystem blocks = 6737100814 block groups8192 blocks per group, 8192 fragments per group2008 inodes per groupSuperblock backups stored on blocks: 8193,245 77, 40961,573 45, 73729 Writing inode tables: doneCreating journal (4096 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 31 mounts or180 days, whichever comes first. use tune2fs-c or-I to override. OK.