加入收藏 | 设为首页 | 会员中心 | 我要投稿 拼字网 - 核心网 (https://www.hexinwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

linux磁盘分区命令 linux磁盘分区方法

发布时间:2022-11-17 11:17:56 所属栏目:Linux 来源:
导读:  产品型号:Thinkpad E15

  系统版本:centos8

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

  在虚拟机上添加一块硬盘

  linux分区和不分区_linux分区工具_linux下分区工具

  例:对sd
  产品型号:Thinkpad E15
 
  系统版本:centos8
 
  案例:在sdb盘上建一个分区,大小为1G
 
  在虚拟机上添加一块硬盘
 
  linux分区和不分区_linux分区工具_linux下分区工具
 
  例:对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 参数可以对已经存在文件系统的分区linux分区工具,强制格式化
 
  [root@xuegod63 ~]# mkdir /sdb1 #创建挂载点
 
  [root@xuegod63 ~]# mount /dev/sdb1 /sdb1/#挂载
 
  [root@xuegod63 ~]# df -h #查看
 

(编辑:拼字网 - 核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!