SpringBoot 整合 Swagger2
阿新 • • 發佈:2021-06-22
概述
從最底層向上,分別為:物理儲存介質 > 物理卷(Physical Volume,PV) > 卷組(Volume Group,VG) > 邏輯卷(Logical Volume,LV)。
檢視物理磁碟資訊
[root@localhost ~]# fdisk -l Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x00035770 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 198549503 98761728 8e Linux LVM Disk /dev/mapper/centos-root: 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 /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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 /dev/mapper/centos-home: 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 /dev/mapper/centos-data: 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 /dev/mapper/centos-mongo1: 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 /dev/mapper/centos-mongo2: 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
檢視物理卷資訊
[root@localhost ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- 94.18g 2.18g [root@localhost ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name centos PV Size 94.19 GiB / not usable 3.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 24111 Free PE 559 Allocated PE 23552 PV UUID VZJK2P-I2xp-uBU7-GRT1-1lmv-AR7f-lvidpL
檢視卷組資訊
[root@localhost ~]# vgs VG #PV #LV #SN Attr VSize VFree centos 1 6 0 wz--n- 94.18g 2.18g [root@localhost ~]# vgdisplay --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 19 VG Access read/write VG Status resizable MAX LV 0 Cur LV 6 Open LV 5 Max PV 0 Cur PV 1 Act PV 1 VG Size 94.18 GiB PE Size 4.00 MiB Total PE 24111 Alloc PE / Size 23552 / 92.00 GiB Free PE / Size 559 / 2.18 GiB VG UUID EnXv5G-61bc-tBOR-Zi6e-7Y8L-ygas-19p6jC
檢視邏輯卷資訊
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data centos -wi-ao---- 50.00g
home centos -wi-ao---- 10.00g
mongo1 centos -wi-ao---- 10.00g
mongo2 centos -wi-a----- 10.00g
root centos -wi-ao---- 10.00g
swap centos -wi-ao---- 2.00g
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID MOEifJ-qBRF-5gjB-qXB7-jNJa-LW3H-IzClIq
LV Write Access read/write
LV Creation host, time localhost, 2021-06-26 06:56:26 +0000
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID 7NvaN8-X2k1-woTr-dvxF-ZvjL-OYsD-eX2lEn
LV Write Access read/write
LV Creation host, time localhost, 2021-06-26 06:56:27 +0000
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID eEgY5U-bhWg-74Cl-AKWM-o3k4-9UBd-9NLg4K
LV Write Access read/write
LV Creation host, time localhost, 2021-06-26 06:56:27 +0000
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/data
LV Name data
VG Name centos
LV UUID FgxSlv-ISnS-0SKH-gTMk-gHCg-5xHh-n4F0yS
LV Write Access read/write
LV Creation host, time localhost, 2021-06-26 06:56:28 +0000
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
--- Logical volume ---
LV Path /dev/centos/mongo1
LV Name mongo1
VG Name centos
LV UUID 6wqmyQ-kII5-hXTa-E3Co-9iRU-626g-TAsUko
LV Write Access read/write
LV Creation host, time localhost, 2021-06-26 06:17:16 +0000
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:4
--- Logical volume ---
LV Path /dev/centos/mongo2
LV Name mongo2
VG Name centos
LV UUID 7hl3pj-ye17-1uNd-opVT-25SK-IZWa-iWd2EG
LV Write Access read/write
LV Creation host, time localhost, 2021-06-26 06:33:27 +0000
LV Status available
# open 0
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:5
檢視檔案系統及掛載資訊
[root@localhost ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 10G 1.3G 8.7G 14% /
devtmpfs devtmpfs 487M 0 487M 0% /dev
tmpfs tmpfs 497M 0 497M 0% /dev/shm
tmpfs tmpfs 497M 6.7M 490M 2% /run
tmpfs tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/mapper/centos-home ext4 9.8G 37M 9.2G 1% /home
/dev/sda1 xfs 497M 125M 373M 25% /boot
tmpfs tmpfs 100M 0 100M 0% /run/user/0
/dev/mapper/centos-data ext4 50G 63M 47G 1% /data
/dev/mapper/centos-mongo1 ext4 9.8G 337M 8.9G 4% /mongo1
縮減邏輯卷
如果想新建邏輯卷,但卷組中已經沒有空餘空間,可以縮減已有的邏輯卷,切出一部分空間。
注意:centos預設的xfs格式磁碟,是不支援縮減的,會導致邏輯卷無法掛載,甚至系統無法啟動。
- /data邏輯卷取消掛載。縮減前,要先將待縮減的卷取消掛載。
umount /data
- 檢查卷
e2fsck -f /dev/centos/data
- 重置/dev/mapper/centos-data卷為10G
resize2fs /dev/centos/data 10G
lvresize -L 10G /dev/centos/data
- 重新掛載/etc/fstab中的所有卷
mount -a
新增卷
通過縮減邏輯卷,卷組中已經空餘出37G的空間,可以通地vgs檢視。
- 新增卷,指定大小為30G,名稱為vnew,卷組為centos
lvcreate -L 30G -n vnew centos
- 檢視新增的卷
lvdisplay
- 格式化新增的卷為ext4格式。
mkfs.ext4 /dev/centos/vnew
- 建立掛載點資料夾
mkdir /vnew/
- 編輯/etc/fstab,新增新增的卷。最後一行,新增如下內容:
/dev/centos/vnew /vnew ext4 defaults 0 0
- 重新掛載/etc/fstab中的所有卷。
mount -a
- 檢視掛載情況
df -Th
刪除卷
- 取消掛載
umount /vnew
- 刪除卷
lvremove /dev/centos/vnew