189 8069 5689

Linux下怎么用fdisk进行分区

这篇文章主要为大家展示了“Linux下怎么用fdisk进行分区”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Linux下怎么用fdisk进行分区”这篇文章吧。

成都创新互联公司服务项目包括临海网站建设、临海网站制作、临海网页制作以及临海网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,临海网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到临海省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

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

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

o n – 创建新分区 
o d – 删除一个已有的分区 
o p – 打印现有的分区表 
o w – 把改动写入到分区表,也就是保存. 
o q – 离开 fdisk

创建新分区

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

# 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.

确认分区是否创建成功

1

2

3

4

5

6

7

8

9

10

11

12

# 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进行分区”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!


分享文章:Linux下怎么用fdisk进行分区
分享路径:http://cdxtjz.com/article/jicehp.html

其他资讯