fdisk分区步骤 linux,Linux下用fdisk进行分区的步骤

本文介绍了在Linux系统中如何使用fdisk工具进行硬盘分区。通过fdisk的基本操作,如创建新分区(n),删除分区(d),保存改动(w)等,详细讲解了创建主分区的步骤。在示例中,成功创建了/dev/sda1主分区,并通过重新读取分区表确认了分区的创建。了解这些步骤对于Linux服务器的管理和维护至关重要。
摘要由CSDN通过智能技术生成

当你在Linux服务器上装上全新的硬盘后,你需要用类似 fdisk 这样的工具进行相应的分区。

fdisk中相应的提供5种基本操作:

o n – 创建新分区

o d – 删除一个已有的分区

o p – 打印现有的分区表

o w – 把改动写入到分区表,也就是保存.

o q – 离开 fdisk

创建新分区

在下面的例子中, 我创建了主分区 /dev/sda1

# fdisk /dev/sda

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 34893. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sda: 287.0 GB, 287005343744 bytes

255 heads, 63 sectors/track, 34893 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-34893, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-34893, default 34893):

Using default value 34893

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

确认分区是否创建成功

# fdisk /dev/sda

The number of cylinders for this disk is set to 34893.

There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 287.0 GB, 287005343744 bytes

255 heads, 63 sectors/track, 34893 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 1 34893 280277991 83 Linux

Command (m for help): q

Linux下用fdisk进行分区的步骤就介绍到这里了。

,,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

,,,

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值