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

本文详细介绍了如何在Linux系统中使用fdisk工具查看、创建和删除硬盘分区,并使用mkfs创建文件系统。通过实例操作,包括查看/dev/sda和/dev/sdc的分区情况,创建100GB的Linux分区,删除/dev/sdc3分区,最后演示了如何为分区/dev/sdc1创建ext4文件系统。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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   


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值