现在的位置: 首页 > 综合 > 正文

fdisk查看,创建分区, mkfs创建文件系统

2013年12月10日 ⁄ 综合 ⁄ 共 2200字 ⁄ 字号 评论关闭

1. 查看分区情况

fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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 identifier: 0xb850db78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   133371629    66684791    7  HPFS/NTFS/exFAT
/dev/sda2       133371904   523997183   195312640   83  Linux
/dev/sda3       523997184   527902719     1952768   83  Linux
/dev/sda4       527902720   976771071   224434176   83  Linux

2. 创建分区

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):
Using default value 1
First sector (2048-1172123567, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1172123567, default 1172123567): +100G                   
Partition 1 of type Linux and of size 100 GiB is set

3. 删除分区

Command (m for help): p

Disk /dev/sdc: 600.1 GB, 600127266816 bytes
128 heads, 32 sectors/track, 286162 cylinders, total 1172123568 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 identifier: 0xec3607d6

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   209717247   104857600   83  Linux
/dev/sdc3       209717248   419432447   104857600   83  Linux

Command (m for help): d
Partition number (1-4): 3
Partition 3 is deleted

4. 写入分区表

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

5. 创建文件系统

mkfs.ext4 /dev/sdc1
mke2fs 1.43-WIP (21-Jan-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 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   

抱歉!评论已关闭.