sudo hdparm -I /dev/sdb 硬盘硬件安装后,此命令测试linux系统是否能找到挂载的未分区硬盘

2、创建分区

sudo fdisk /dev/sdb

sda是第一块SCSI硬盘,sdb第二块,以此类推...物理分区使用a、b编号,每个物理硬盘最多有四个主逻辑分区(或扩展分区),所以自动分区中,扩展分区sda2下第一个逻辑分区编号从5开始

第一次执行sudo fdisk /dev/sdb,出现了Error: Unable to open /dev/sdb - unrecognised disk label. 提示找不到磁盘标签,可以使用 parted 进行分区(sudo parted /dev/sdb )。

Command (m for help):

这里按m获得帮助

a toggle a bootable flag 将分区设置为启动区

b edit bsd disklabel 编辑bsd的disklabel

c toggle the dos compatibility flag 设置该分区为dos分区

d delete a partition 删除分区

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):p //查看新硬盘的分区

********************************************************************

Disk /dev/sdb: 1000204 MB, 1000202273280 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

********************************************************************

Command (m for help):n //创建新分区

File system type (default ext2): ext3 //输入想使用的分区格式

Partition name: backup //输入分区的名字

First cylinder (default 0cyl): //第几个柱面,我们按照默认

Last cylinder or +size or +sizeMB or +sizeKB (default 0cyl):+1000000M //这里我们按大小输入 即+1000000M (注意这个M为大写)

Warning: You requested a partition from 0cyl to 121576cyl.

The closest location we can manage is 1cyl to 121575cyl. Is this still

acceptable to you?

y Yes

n No

取消

评论

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐