linux分区方法

产品型号:Thinkpad E15

系统版本:centos8

案例:在sdb盘上建一个分区,大小为1G

在虚拟机上添加一块硬盘

例:对sdb这块盘划分一个100M的分区出来

[root@xuegod63 ~]# fdisk /dev/sdb

Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition 删除分区

g create a new empty GPT partition table

G create an IRIX (SGI) partition table

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 —–打印分区表

Command (m for help): n —-新建一个分区

Partition type:

p primary (2 primary, 0 extended, 2 free) p:主分区

e extended e:扩展分区

Select (default p): –#直接默认

Using default response p

Partition number (1,4, default 1): —#直接默认

First sector (1230848-41943039, default 1230848): —#直接默认

Using default value 1230848

Last sector, +sectors or +size{K,M,G} (1230848-41943039, default 41943039): +1G

#输入分区大小

Partition 3 of type Linux and of size 1 GiB is set

Command (m for help): w #保存退出

格式化并创建文件系统

[root@xuegod63 ~]# mkfs.xfs /dev/sdb1

注:-f 参数可以对已经存在文件系统的分区,强制格式化

[root@xuegod63 ~]# mkdir /sdb1 #创建挂载点

[root@xuegod63 ~]# mount /dev/sdb1 /sdb1/#挂载

[root@xuegod63 ~]# df -h #查看

免责声明:本文由用户投稿,(图文、音视频)均由用户自行上传分享,文章内容不代表本站立场,本站不对其内容的真实性、完整性、准确性给予任何担保、暗示和承诺,仅供读者参考,文章版权归原作者所有。若您的权利被侵害,请联系本站在线客服进行删除。

给TA打赏
共{{data.count}}人
人已打赏
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
购物车
优惠劵
搜索