Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000d0627
Device Boot Start End Blocks Id System /dev/sda1 * 2048 616447 307200 83 Linux /dev/sda2 616448 8744959 4064256 82 Linux swap / Solaris /dev/sda3 8744960 83886079 37570560 83 Linux
[root@localhost ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xfa4c6082.
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 g create a new empty GPT partition table G create an IRIX (SGI) partition table 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): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): # 默认选择p,主分区 Partition number (1-4, default 1): # 默认选择1,分区1 First sector (2048-536870911, default 2048): # 默认从2048字节开始 Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-536870911, default 536870911): # 默认到 536870911 字节位置结束 Using default value 536870911 Partition 1 of type Linux and of size 256 GiB is set
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
分区完成后,可以看到将 /deb/sdb 分了一个区。
1 2 3 4 5 6 7 8 9
[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 40G 0 disk ├─sda1 8:1 0 300M 0 part /boot ├─sda2 8:2 0 3.9G 0 part [SWAP] └─sda3 8:3 0 35.9G 0 part / sdb 8:16 0 256G 0 disk └─sdb1 8:17 0 256G 0 part sr0 11:0 1 1024M 0 rom
[root@localhost ~]# mkfs -t ext4 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 16777216 inodes, 67108608 blocks 3355430 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2214592512 2048 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, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done