Writing superblocks and filesystem accounting information: done
[root@boyu ~]# blkid #查看分区文件系统信息以及UID
/dev/sr0: UUID=“2022-04-01-19-16-54-00” LABEL=“config-2” TYPE=“iso9660”
/dev/vda1: UUID=“4b499d76-769a-40a0-93dc-4a31a59add28” TYPE=“ext4”
/dev/vdb1: UUID=“42881dce-ab60-4bd7-ae62-6c4837203e64” TYPE=“ext4”
[root@boyu ~]# fdisk -l #查看磁盘分区情况
Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x0009ac89
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 104857566 52427759+ 83 Linux
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x00042bf5
Device Boot Start End Blocks Id System
/dev/vdb1 2048 976895 487424 83 Linux
##### 2.1.2 GPT方式分区(交互式/命令分区)
**交互式分区命令步骤:**
lsblk #查看磁盘块设备
parted /dev/vdb print #打印/dev/vdb磁盘概要信息,(刚开始磁盘是没有标签的,打上什么标签就用什么分区方案
parted /dev/vdb #对/dev/vdb磁盘进行分区
mklabel gpt #设置磁盘标签也是设置分区方案的标识;(msdos是MBR的分区方案,gpt是gpt的分区方案)
print #再次查看磁盘概要信息,查看标签是否写入
mkpart #创建分区
data1 #分区名称
ext4 #选择文件系统(并不是真的创建文件系统,而是占位符的作用,所以可以随便输入文件系统)
2048s #起始扇区对于大多数磁盘而言,起始扇区为 2048 的倍数较为安全。(第二次分区的起始扇区为601M)
600M #结束扇区,分配600M容量给此分区。
qu #退出parted
udevadm settle #等待系统检测新分区并在/dev目录下创建关联的设备文件(同步)
lsblk #查看磁盘块设备
mkfs.ext4 /dev/vdb1 #设置/dev/vdb1的文件系统(具有格式化的作用)
blkid #查看分区文件系统信息以及UID
fdisk -l #查看磁盘分区情况
**命令行分区:** parted /dev/vdb mkpart data1 ext4 2048s 600M
**交互式分区详解:**
[root@boyu ~]# lsblk #查看磁盘块设备
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
vdb 253:16 0 10G 0 disk
[root@boyu ~]# parted /dev/vdb print #打印/dev/vdb磁盘概要信息,(刚开始磁盘是没有标签的,打上什么标签就用什么分区方案
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop #此时磁盘还没有标签,需要打上msdos或gpt否则会报错从而不能进行分区
Disk Flags:
Number Start End Size File system Flags
1 0.00B 10.7GB 10.7GB ext4
[root@boyu ~]# parted /dev/vdb #对/dev/vdb磁盘进行分区
GNU Parted 3.1
Using /dev/vdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/vdb will be destroyed and all data on this disk will
be lost. Do you want to continue?
Yes/No? yes
(parted) print #再次查看磁盘概要信息,查看标签是否写入
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt #设置磁盘标签也是设置分区方案的标识;(msdos是MBR的分区方案,gpt是gpt的分区方案)
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart #创建分区
Partition name? []? data1 #分区名称
File system type? [ext2]? ext4 #选择文件系统(并不是真的创建文件系统,而是占位符的作用,所以可以随便输入文件系统)
Start? 2048s #起始扇区对于大多数磁盘而言,起始扇区为 2048 的倍数较为安全。(第二次分区的起始扇区为601M
End? 600M #结束扇区,分配600M容量给此分区。
(parted) qu #退出parted
Information: You may need to update /etc/fstab.
[root@boyu ~]# udevadm settle #等待系统检测新分区并在/dev目录下创建关联的设备文件(同步)
[root@boyu ~]# lsblk #查看磁盘块设备
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
vdb 253:16 0 10G 0 disk
└─vdb1 253:17 0 571M 0 part
[root@boyu ~]# mkfs.ext4 /dev/vdb1 #设置/dev/vdb1的文件系统(具有格式化的作用)
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
36560 inodes, 146176 blocks
7308 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=150994944
5 block groups
32768 blocks per group, 32768 fragments per group
7312 inodes per group
Superblock backups stored on blocks:
32768, 98304
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
[root@boyu ~]# blkid #查看分区文件系统信息以及UID
/dev/sr0: UUID=“2022-04-01-19-16-54-00” LABEL=“config-2” TYPE=“iso9660”
/dev/vda1: UUID=“4b499d76-769a-40a0-93dc-4a31a59add28” TYPE=“ext4”
/dev/vdb1: UUID=“1a256214-2a01-4935-a26e-5fe36223455c” TYPE=“ext4” PARTLABEL=“data1” PARTUUID=“8b155f85-2d4e-43a7-8494-31db6bd986d4”
[root@boyu ~]# fdisk -l #查看磁盘分区情况
Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x0009ac89
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 104857566 52427759+ 83 Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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: gpt
Disk identifier: 3F23313C-76B0-4AD1-B81B-CE3D3CE46FCD
Start End Size Type Name
1 2048 1171455 571M Microsoft basic data1
#### 2.2.fdisk的使用(MBR分区)
lsblk #查看磁盘块设备
fdisk /dev/vdb #使用fdisk对/dev/vdb分区
partprobe /dev/vdb1 #将划分的分区从内存同步到磁盘
lsblk #查看磁盘块设备
mkfs.ext4 /dev/vdb1 #设置/dev/vdb1的文件系统(也相当于格式化分区)
blkid #查看分区文件系统信息
fdisk -l #查看磁盘分区情况
[root@boyu ~]# lsblk #查看磁盘块设备
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
vdb 253:16 0 10G 0 disk
[root@boyu ~]# fdisk /dev/vdb #使用fdisk对/dev/vdb分区
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 table
Building a new DOS disklabel with disk identifier 0x7f5667a2.
Command (m for help): n #创建分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p #创建主分区(p:主分区,e:扩展分区)
Partition number (1-4, default 1): 1 #主分区序号
First sector (2048-20971519, default 2048): #最开始的扇区,直接回车,默认值是2048开始
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G #最后的扇区,输入想分区的容量,默认是最大容量
Partition 1 of type Linux and of size 1 GiB is set
Command (m for help): p #查看分区表,可以看到目前的分区信息
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x7f5667a2
Device Boot Start End Blocks Id System
/dev/vdb1 2048 2099199 1048576 83 Linux
Command (m for help): w #保存分区信息
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@boyu ~]# partprobe /dev/vdb1 #将划分的分区从内存同步到磁盘
[root@boyu ~]# lsblk #查看磁盘块设备
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
vdb 253:16 0 10G 0 disk
└─vdb1 253:17 0 1G 0 part
[root@boyu ~]# mkfs.ext4 /dev/vdb1 #设置/dev/vdb1的文件系统
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@boyu ~]# blkid #查看分区文件系统信息
/dev/sr0: UUID=“2022-04-01-19-16-54-00” LABEL=“config-2” TYPE=“iso9660”
/dev/vda1: UUID=“4b499d76-769a-40a0-93dc-4a31a59add28” TYPE=“ext4”
/dev/vdb1: UUID=“ed825353-5d70-4e29-a442-e675ee553406” TYPE=“ext4”
[root@boyu ~]# fdisk -l #查看磁盘分区情况
Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x0009ac89
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 104857566 52427759+ 83 Linux
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0xf2a70c68
Device Boot Start End Blocks Id System
/dev/vdb1 2048 2099199 1048576 83 Linux
#### 2.3.gdisk的使用(GPT分区)
lsblk #查看磁盘块设备
gdisk /dev/vdb #使用gdisk对/dev/vdb分区
partprobe /dev/vdb1 #将划分的分区从内存同步到磁盘
lsblk #查看磁盘块设备
mkfs.ext4 /dev/vdb1 #设置/dev/vdb1的文件系统
blkid #查看分区文件系统信息
gdisk -l /dev/vdb1 #查看磁盘分区情况
[root@boyu ~]# lsblk #查看磁盘块设备
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
vdb 253:16 0 10G 0 disk
[root@boyu ~]# gdisk /dev/vdb #使用gdisk对/dev/vdb分区
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): n #创建分区
Partition number (1-128, default 1): #主分区序号
First sector (34-20971486, default = 2048) or {±}size{KMGTP}: #最开始的扇区,默认是2048,直接回车选择默认
Last sector (2048-20971486, default = 20971486) or {±}size{KMGTP}: +500M #最后的扇区,输入想分区的容量,默认是磁盘最大容量
Current type is ‘Linux filesystem’
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to ‘Linux filesystem’
Command (? for help): p #查看分区表,列出了分区信息
Disk /dev/vdb: 20971520 sectors, 10.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): A16A075F-FADE-4865-8F93-93A98B89654D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 20971486
Partitions will be aligned on 2048-sector boundaries
Total free space is 19947453 sectors (9.5 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1026047 500.0 MiB 8300 Linux filesystem
Command (? for help): w #保存分区信息
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y #选择yes,覆盖原有分区表
OK; writing new GUID partition table (GPT) to /dev/vdb.
The operation has completed successfully.
[root@boyu ~]# partprobe /dev/vdb1 #将划分的分区从内存同步到磁盘
[root@boyu ~]# lsblk #查看磁盘块设备
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 159.1M 0 rom
vda 253:0 0 50G 0 disk
└─vda1 253:1 0 50G 0 part /
vdb 253:16 0 10G 0 disk
└─vdb1 253:17 0 500M 0 part
[root@boyu ~]# mkfs.ext4 /dev/vdb1 #设置/dev/vdb1的文件系统
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=34078720
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@boyu ~]# blkid #查看分区文件系统信息
/dev/sr0: UUID=“2022-04-01-19-16-54-00” LABEL=“config-2” TYPE=“iso9660”
/dev/vda1: UUID=“4b499d76-769a-40a0-93dc-4a31a59add28” TYPE=“ext4”
/dev/vdb1: UUID=“3056fc77-8467-4866-9c04-2b2eb9e68bcf” TYPE=“ext4” PARTLABEL=“Linux filesystem” PARTUUID=“75bde7da-ad2e-4bca-9d74-78353f78115e”
[root@boyu ~]# gdisk -l /dev/vdb1 #查看磁盘分区情况
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Disk /dev/vdb1: 1024000 sectors, 500.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): 447F9BA2-3832-407D-85CD-867113057477
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1023966
Partitions will be aligned on 2048-sector boundaries
Total free space is 1023933 sectors (500.0 MiB)
### 3、挂载文件系统
* 添加完文件系统后,最后一步是将文件系统挂载到目录结构中的目录上。
* 将文件系统挂载到目录层次结构上后,用户空间实用程序可以访问设备上的文件或
### 最后
Python崛起并且风靡,因为优点多、应用领域广、被大牛们认可。学习 Python 门槛很低,但它的晋级路线很多,通过它你能进入机器学习、数据挖掘、大数据,CS等更加高级的领域。Python可以做网络应用,可以做科学计算,数据分析,可以做网络爬虫,可以做机器学习、自然语言处理、可以写游戏、可以做桌面应用…Python可以做的很多,你需要学好基础,再选择明确的方向。这里给大家分享一份全套的 Python 学习资料,给那些想学习 Python 的小伙伴们一点帮助!
#### 👉Python所有方向的学习路线👈
Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。
![](https://img-blog.csdnimg.cn/img_convert/604bae65027d4d67fb62410deb210454.png)
#### 👉Python必备开发工具👈
工欲善其事必先利其器。学习Python常用的开发软件都在这里了,给大家节省了很多时间。
![](https://img-blog.csdnimg.cn/img_convert/fa276175617e0048f79437bd30465479.png)
#### 👉Python全套学习视频👈
我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了。
![](https://img-blog.csdnimg.cn/img_convert/16ac689cb023166b2ffa9c677ac40fc0.png)
#### 👉实战案例👈
学python就与学数学一样,是不能只看书不做题的,直接看步骤和答案会让人误以为自己全都掌握了,但是碰到生题的时候还是会一筹莫展。
因此在学习python的过程中一定要记得多动手写代码,教程只需要看一两遍即可。
![](https://img-blog.csdnimg.cn/img_convert/0d8c31c50236a205928a1d8ae8a0b883.png)
#### 👉大厂面试真题👈
我们学习Python必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有阿里大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。
![](https://img-blog.csdnimg.cn/img_convert/99461e47e58e503d2bc1dc6f4668534a.png)
**[需要这份系统化学习资料的朋友,可以戳这里无偿获取](https://bbs.csdn.net/topics/618317507)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**