Linux系统 fdisk管理MBR分区 fdisk/mbr 是什么命令( 二 )
这里说一下echo命令中双引号内的含义:
# echo "scsi add-single-device w x y z" > /proc/scsi/scsi
- w 是主机适配器标识,第一个适配器为零(0)
- x 是主机适配器上的 SCSI 通道,第一个通道为零(0)
- y 是装备的 SCSI 标识
- z 是 LUN 号,第一个 LUN 为零(0)
二、创立分区
1、命令:fdisk
- fdisk命令以交互方法进行操作,在菜单中选择相应功效键即可 。
2、指令及其作用
- [ a ]:调剂磁盘的启动分区
- [ p ]:显示当前磁盘的分区信息
- [ d ]:删除磁盘分区
- [ t ]:更改分区类型
- [ l ]:显示所有支撑的分区类型
- [ u ]:切换所显示的分区大小单位
- [ m ]:查看所有指令的赞助信息
- [ n ]:创立新分区
- [ q ]:不保留更改,退出fdisk命令
- [ w ]:把修正写入磁盘分区表,然后退出fdisk命令
- [ g ]:新建一个空的GPT分区表
- [ o ]:新建一个空的DOS分区表

文章插图
3、操作步骤
(1)对新增硬盘“/dev/sdb”履行分区命令
[root@localhost ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Device does not contain a recognized partition tableBuilding a new DOS disklabel with disk identifier 0xe04147aa.
(2)应用“n”指令和“p”指令创立容量为512M的第1个主分区(/dev/sdb1)
Command (m for help): n # 输入字符n,新建分区Partition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): p # 输入字符p,新建主分区,直接回车默以为主分区Partition number (1-4, default 1): 1 # 输入数字1,创立序号为1的主分区,直接回车默认序号为1First sector (2048-41943039, default 2048): 2048&nb资源网sp; # 输入数字2408,主分区的其实扇区号,默以为2048Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +512M # 设置分区大小,格局为+size{K,M,G}Partition 1 of type Linux and of size 512 MiB is setCommand&nb资源网sp;(m for help): p # 输入字符p,显示当前磁盘分区信息Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0xe04147aa Device Boot Start End Blocks Id System/dev/sdb1 2048 1050623 524288 83 LinuxCommand (m for help): w # 输入字符w,保留并退出fdisk命令The partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
(3)应用lsblk命令查看块装备信息
[root@localhost ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 20G 0 disk ├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 19G 0 part ├─centos-root 253:0 0 17G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm [SWAP]sdb 8:16 0 20G 0 disk └─sdb1 8:17 0 512M 0 part sr0 11:0 1 4.3G 0 rom
推荐阅读
- 胆管支架术后不良反应
- 智能汽车事故频发,辅助驾驶系统“背锅”?
- 让Win11系统更好用的几个设置
- Linux下常用的Shell脚本
- 10种有用的Linux Bash_Completion 命令示例
- 华为|国产第一系统加持!华为新台式机曝光:搭自研盘古M900 替代Intel/AMD
- 驾校|边开车边被系统疯狂提醒!55岁大叔模拟考科三被扣1000多分
- 暗黑破坏神|暴雪剧透《暗黑破坏神4》付费系统:氪金不会影响平衡
- 多发腔隙灶
- 超级人类/超击突破系统出现错误 D00222的解决办法
