
1、磁盘分区的英文翻译:
1.Changes will remain in memory only, until you decide to write them.
你进行的修改默认存放在内存中,直到你决定保存这些修改的时候.
:wq
Be careful before using the write command.
保存之前小心点!
Device does not contain a recognized partition table
设备 没有 包含 磁盘分区表。
Building a new DOS disklabel with disk identifier 0x6df46197.
DPT= disk partition table 磁盘分区表
2.Invalid partition type `e'
3.mkfs.xfs /dev/sdb1
mkfs.xfs: /dev/sdb1 appears to contain an existing filesystem (ext4).
这个磁盘分区中 已经包含了1个文件系统(已经格式化过了)
mkfs.xfs: 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
特殊文件(设备文件) 不存在
6.[root@oldboyedu59 ~]# mkfs.xfs /dev/sdb1
mkfs.xfs: /dev/sdb1 contains a mounted filesystem
sdb1磁盘分区 包含 1个已经挂载的文件系统 (磁盘分区已经挂载)
- [root@oldboy ~]# mkfs.xfs /dev/sdb1 -f
agsize (2560 blocks) too small, need at least 4096 blocks
磁盘分区太小了 无法格式化
Usage: mkfs.xfs
8.[root@oldboyedu ~]# mount /dev/sdb1 /mnt/
mount: /dev/sdb1 is already mounted or /mnt busy
磁盘分区 已经 挂载或/mnt正在使用中
2、创建分区格式(带注释):
创建主分区、扩展分区、逻辑分区:
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
主分区
e extended、
扩展分区
Select (default p):
默认就是 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
Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
10MB
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): e
Partition number (2-4, default 2):
First sector (22528-208895, default 22528):
Using default value 22528
Last sector, +sectors or +size{K,M,G} (22528-208895, default 208895):
Using default value 208895
Partition 2 of type Extended and of size 91 MiB is set
Command (m for help): n
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): e
Invalid partition type `e'
Command (m for help): n
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (24576-208895, default 24576):
Using default value 24576
Last sector, +sectors or +size{K,M,G} (24576-208895, default 208895): +20M
Partition 5 of type Linux and of size 20 MiB is set
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
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 208895 93184 5 Extended
/dev/sdb5 24576 65535 20480 83 Linux
3、创建磁盘分区、挂载等详解:
#第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
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-208895, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-208895, default 208895):
Using default value 208895
Partition 1 of type Linux and of size 101 MiB is set
#第2个里程碑-格式化 创建文件系统 mkfs make filesystem
[root@oldboyedu59 ~]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=6464 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=25856, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=855, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
#第3个里程碑-挂载
[root@oldboyedu59 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 99G 1.8G 97G 2% /
devtmpfs 980M 0 980M 0% /dev
tmpfs 991M 0 991M 0% /dev/shm
tmpfs 991M 9.6M 981M 1% /run
tmpfs 991M 0 991M 0% /sys/fs/cgroup
/dev/sda1 197M 105M 93M 54% /boot
tmpfs 199M 0 199M 0% /run/user/0
[root@oldboyedu59 ~]# mount /dev/sdb1 /mnt/
[root@oldboyedu59 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 99G 1.8G 97G 2% /
devtmpfs 980M 0 980M 0% /dev
tmpfs 991M 0 991M 0% /dev/shm
tmpfs 991M 9.6M 981M 1% /run
tmpfs 991M 0 991M 0% /sys/fs/cgroup
/dev/sda1 197M 105M 93M 54% /boot
tmpfs 199M 0 199M 0% /run/user/0
/dev/sdb1 98M 5.3M 93M 6% /mnt
#第4个里程碑-永久挂载
#1./etc/rc.local
#2./etc/fstab
[root@oldboyedu59 ~]# cat /etc/fstab
UUID=1e827748-cc43-4b1d-8bbc-9a85c239782d / xfs defaults 0 0
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
网友评论