2023年11月25日发(作者:)
第26课磁盘分区知识点2019-04-30
第六周
1、磁盘分区的英⽂翻译:
s will remain in memory only, until you decide to write them.
/dev/sdb1
: /dev/sdb1 appears to contain an existing filesystem (ext4).
这个磁盘分区中 已经包含了1个⽂件系统(已经格式化过了)
: Use the -f option to force overwrite.
如果强制格式化使⽤-f
4.[root@cuihua ~]# mount /dev/sdb1 /mnt
mount: /dev/sdb1 is write-protected, mounting read-only
mount: unknown filesystem type '(null)'
未知的⽂件系统(没有格式化)
5.[root@guanggege ~]# mount /dev/sdb1 /mnt/
mount: special device /dev/sdb1 does not exist
默认就是 p
Partition number (1-4, default 1):
分区号 默认
First sector (2048-208895, default 2048):
磁盘分区中第1个扇区(从哪⾥开始) 默认
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-208895, default 208895):
磁盘分区中最后1个扇区
Last sector, +sectors or +size{K,M,G} (2048-208895, default 208895): +10M
Partition 1 of type Linux and of size 10 MiB is set
创建了分区号是1的 10MB的分区
Command (m for help): p
Disk /dev/sdb: 106 MB, 106954752 bytes, 208896 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x6df46197
#第1个⾥程碑-创建分区
Command (m for help): p
Disk /dev/sdb: 106 MB, 106954752 bytes, 208896 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x6df46197
Device Boot Start End Blocks Id System
Command (m for help): n
UUID=29a4ef75-7502-48df-b31c-c7c10264a7c8 /boot xfs defaults 0 0
UUID=60c45f5e-c78d-41fe-aa92-93d10de6def3 swap swap defaults 0 0
第1列:UUID或设备名称 第2列 第3列 第4列 第5列 第6列
查询系统的磁盘与对应的uuid 挂载点(⼊⼝) ⽂件系统类型 挂载参数 是否进⾏备份 是否开机⾃动检查
[root@oldboyedu59 ~]# tail -1 /etc/fstab
/dev/sdb1 /data xfs defaults 0 0
4、fdisk和parted的区别:
fdisk parted
共同 磁盘分区 磁盘分区
区别 ⽀持2TB以内硬盘 ⼤于2TB磁盘
⽀持MBR分区表 MBR GPT(⽀持更⼤的硬盘和更多的主分区)
5、parted的参数:
parted (实时⽣效)
p print 显⽰磁盘信息
mktable mklabel make partition table 创建磁盘分区表 MBR GPT
mkpart make partition 创建磁盘分区
rm 删除磁盘分区
q quit 退出磁盘分区
实例:
创建1个主分区 10M
(parted) p
Error: /dev/sdc: unrecognised disk label #⽆法识别的
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown #未知
Disk Flags:
(parted) mktable gpt
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart primary 0 10
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 107MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary


发布评论