当前位置:网站首页>Realize the disk partition and file system mount of the newly added hard disk
Realize the disk partition and file system mount of the newly added hard disk
2022-07-27 13:20:00 【A rookie who has been studying hard】
Realize the disk partition and file system mount of the newly added hard disk
1. View disk devices
[[email protected] ~]#ls /dev/sda*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5
2. Add hard disk







3. Alias realizes the identification of newly added hard disk
[[email protected] ~]#alias scandisk='echo - - - > /sys/class/scsi_host/host0/scan;echo - - - > /sys/class/scsi_host/host1/scan;echo - - - > /sys/class/scsi_host/host2/scan'
[[email protected] ~]#alias scandisk
alias scandisk='echo - - - > /sys/class/scsi_host/host0/scan;echo - - - > /sys/class/scsi_host/host1/scan;echo - - - > /sys/class/scsi_host/host2/scan'
[[email protected] ~]#scandisk
[[email protected] ~]#lsblk
[[email protected] ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 100G 0 part /
├─sda3 8:3 0 50G 0 part /data
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 2G 0 part [SWAP]
sdb 8:16 0 200G 0 disk
sr0 11:0 1 9.5G 0 rom
[[email protected] ~]#ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sdb
4. Create partitions
MBR:Master Boot Record,1982 year , Use 32 Bits represent the number of sectors , No more than 2T
MBR A hard disk in a partition has at most 4 Primary partitions , It's fine too 3 Primary partition +1 Expand (N Logical partitions )
MBR Partition : Primary and extended partition 1–4,/dev/sda3, Logical partition from 5 Start ,/dev/sda5
GPT:GUID(Globals Unique Identifiers) partition table Support 128 Zones , Use 64 position , Support 8Z(
512Byte/block )64Z ( 4096Byte/block)
fdisk /dev/sda: management MBR Partition
gdisk /dev/sda: class fdisk Of GPT Partitioning tool
Sons command :
p: Partition list
t: Change partition type
n: Create a new partition
d: Delete partition
v: Verify partition
u: Converting units
w: Save and exit
q: Do not save and exit
[[email protected] ~]#yum -y install gdisk
[[email protected] ~]#gdisk /dev/sdb
Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-419430366, default = 2048) or {
+-}size{
KMGTP}: 2048
Last sector (2048-419430366, default = 419430366) or {
+-}size{
KMGTP}: +1G
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/sdb: 419430400 sectors, 200.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0351662F-7E98-4CC8-B5D4-8973B19FC01C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 419430366
Partitions will be aligned on 2048-sector boundaries
Total free space is 417333181 sectors (199.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB 8300 Linux filesystem
Command (? for help): n
Partition number (2-128, default 2): 2
First sector (34-419430366, default = 2099200) or {
+-}size{
KMGTP}:
Last sector (2099200-419430366, default = 419430366) or {
+-}size{
KMGTP}: +100G
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/sdb: 419430400 sectors, 200.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0351662F-7E98-4CC8-B5D4-8973B19FC01C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 419430366
Partitions will be aligned on 2048-sector boundaries
Total free space is 207617981 sectors (99.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB 8300 Linux filesystem
2 2099200 211814399 100.0 GiB 8300 Linux filesystem
Command (? for help): n
Partition number (3-128, default 3): 3
First sector (34-419430366, default = 211814400) or {
+-}size{
KMGTP}:
Last sector (211814400-419430366, default = 419430366) or {
+-}size{
KMGTP}: +50G
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/sdb: 419430400 sectors, 200.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0351662F-7E98-4CC8-B5D4-8973B19FC01C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 419430366
Partitions will be aligned on 2048-sector boundaries
Total free space is 102760381 sectors (49.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB 8300 Linux filesystem
2 2099200 211814399 100.0 GiB 8300 Linux filesystem
3 211814400 316671999 50.0 GiB 8300 Linux filesystem
Command (? for help): n
Partition number (4-128, default 4): 4
First sector (34-419430366, default = 316672000) or {
+-}size{
KMGTP}:
Last sector (316672000-419430366, default = 419430366) or {
+-}size{
KMGTP}: +1k
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/sdb: 419430400 sectors, 200.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0351662F-7E98-4CC8-B5D4-8973B19FC01C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 419430366
Partitions will be aligned on 2048-sector boundaries
Total free space is 102760379 sectors (49.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB 8300 Linux filesystem
2 2099200 211814399 100.0 GiB 8300 Linux filesystem
3 211814400 316671999 50.0 GiB 8300 Linux filesystem
4 316672000 316672001 1024 bytes 8300 Linux filesystem
Command (? for help): n
Partition number (5-128, default 5): 5
First sector (34-419430366, default = 316674048) or {
+-}size{
KMGTP}:
Last sector (316674048-419430366, default = 419430366) or {
+-}size{
KMGTP}: +2G
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/sdb: 419430400 sectors, 200.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0351662F-7E98-4CC8-B5D4-8973B19FC01C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 419430366
Partitions will be aligned on 2048-sector boundaries
Total free space is 98566075 sectors (47.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB 8300 Linux filesystem
2 2099200 211814399 100.0 GiB 8300 Linux filesystem
3 211814400 316671999 50.0 GiB 8300 Linux filesystem
4 316672000 316672001 1024 bytes 8300 Linux filesystem
5 316674048 320868351 2.0 GiB 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
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
5. Create file system
[[email protected] ~]#lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 xfs b36add53-d3f4-4ef7-9444-3c69bffb95db /boot
├─sda2 ext4 099f9e4c-8094-4e19-ace1-f99b7f81744b /
├─sda3 xfs 756b01bd-ccee-4563-a492-7368bb57b100 /data
├─sda4
└─sda5 swap 076fc1a8-ac81-4378-8fcf-6968c31519bc [SWAP]
sdb
├─sdb1
├─sdb2
├─sdb3
├─sdb4
└─sdb5
sr0 iso9660 CentOS 7 x86_64 2020-11-02-15-15-23-00
[[email protected] ~]#mkfs.xfs /dev/sdb1
[[email protected] ~]#mkfs.ext4 /dev/sdb2
[[email protected] ~]#mkfs.xfs /dev/sdb3
[[email protected] ~]#mkswap /dev/sdb5
[[email protected] ~]#lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 xfs b36add53-d3f4-4ef7-9444-3c69bffb95db /boot
├─sda2 ext4 099f9e4c-8094-4e19-ace1-f99b7f81744b /
├─sda3 xfs 756b01bd-ccee-4563-a492-7368bb57b100 /data
├─sda4
└─sda5 swap 076fc1a8-ac81-4378-8fcf-6968c31519bc [SWAP]
sdb
├─sdb1 xfs 2a668187-9013-4187-9177-bcbcff8842f0
├─sdb2 ext4 cd43676b-cd3f-409c-8c62-374db8c02ffe
├─sdb3 xfs 1d8d09e7-dd06-4e08-8021-b34f64cf77b1
├─sdb4
└─sdb5 swap 5a4fa393-66c2-4530-a058-f2602130da6a
sr0 iso9660 CentOS 7 x86_64 2020-11-02-15-15-23-00
[[email protected] ~]#partprobe # Synchronize partition table
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
6. mount
[[email protected] ~]#vim /etc/fstab
UUID=cd43676b-cd3f-409c-8c62-374db8c02ffe /root ext4 defaults 1 1
UUID=2a668187-9013-4187-9177-bcbcff8842f0 /boot xfs defaults 0 0
UUID=1d8d09e7-dd06-4e08-8021-b34f64cf77b1 /data xfs defaults 0 0
UUID=5a4fa393-66c2-4530-a058-f2602130da6a swap swap defaults 0 0
[[email protected] ~]#mount -a # Make the addition of new mount items effective
[[email protected] ~]#swapon -a # Activate all swap partitions
[[email protected] ~]#lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 xfs b36add53-d3f4-4ef7-9444-3c69bffb95db /boot
├─sda2 ext4 099f9e4c-8094-4e19-ace1-f99b7f81744b /
├─sda3 xfs 756b01bd-ccee-4563-a492-7368bb57b100 /data
├─sda4
└─sda5 swap 076fc1a8-ac81-4378-8fcf-6968c31519bc [SWAP]
sdb
├─sdb1 xfs 2a668187-9013-4187-9177-bcbcff8842f0 /boot
├─sdb2 ext4 cd43676b-cd3f-409c-8c62-374db8c02ffe /root
├─sdb3 xfs 1d8d09e7-dd06-4e08-8021-b34f64cf77b1 /data
├─sdb4
└─sdb5 swap 5a4fa393-66c2-4530-a058-f2602130da6a [SWAP]
sr0 iso9660 CentOS 7 x86_64 2020-11-02-15-15-23-00
7. View disk space usage
[[email protected] ~]#df -h
Filesystem Size Used Avail Use% Mounted on
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/sda2 99G 2.6G 91G 3% /
/dev/sdb3 50G 33M 50G 1% /data
/dev/sdb1 1014M 33M 982M 4% /boot
tmpfs 199M 0 199M 0% /run/user/0
/dev/sdb2 99G 61M 94G 1% /root
[[email protected] ~]#free -h
total used free shared buff/cache available
Mem: 1.9G 165M 1.5G 9.5M 317M 1.6G
Swap: 4.0G 0B 4.0G
边栏推荐
- PySide6/PyQt开发经验总结(2) - 设置快捷键
- JNI程序如何进行参数传递
- feign的动态代理
- 从tidb实时同步到mysql 只能用 tidb binlog 工具吗?
- Wfuzz, a test tool that can blur everything that can be blurred
- Poj1273 drainage ditches [maximum flow] [SAP]
- What should I do if I can't see any tiles on SAP Fiori launchpad?
- xshell7可以登录mysql虚拟机不能登陆mysql
- Detail try catch finally
- POJ2446 Chessboard【二分图最大匹配】
猜你喜欢
随机推荐
Poj1548 robots [bipartite graph minimum path coverage]
C语言犄角旮旯的知识之数组与函数
flinksql从Oracle同步数据到Doris,一共50几个字段,Oracle表中3000多万条
Pyside6/pyqt development experience summary (2) - set shortcut keys
Bank case | ZABBIX cross version upgrade guide, isn't 4.2-6.0 popular?
Open source project - taier1.2 release, new workflow, tenant binding simplification and other functions
[expression calculation] double stack: general solution of expression calculation problem
MySQL扩展
Minimally invasive brain science broke the listing: the company's market value is HK $14.3 billion, and minimally invasive medical is the major shareholder
ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
Firefox 103 发布,更快、更安全
固定定位
Cvpr22 | graph neural architecture search of relational consciousness
Qt优秀开源项目之十三:QScintilla
592. 分数加减运算 : 表达式计算入门题
Poj2446 chessboard [maximum matching of bipartite graph]
500强企业如何提升研发效能?来看看行业专家怎么说!
Laboratory procedures and references of chloramphenicol acetate
Seata 在蚂蚁国际银行业务的落地实践
B站713故障后的多活容灾建设|TakinTalks大咖分享









