linux 檔案系統擴容

刚好遇见Mysql發表於2024-05-14

pvcreate /dev/sdb
vgcreate vg_nc /dev/sdb
lvcreate -l +100%FREE -n lv_nc vg_nc
mkfs.xfs /dev/vg_nc/lv_nc
mount /dev/vg_nc/lv_nc /nc

xfs檔案系統擴充套件
vgextend vg_nc /dev/sdc
lvextend -l +100%FREE /dev/vg_nc/lv_nc

df -Th --檢視檔案系統型別
[root@ht19c01 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 5.6G 0 5.6G 0% /dev
tmpfs tmpfs 5.7G 0 5.7G 0% /dev/shm
tmpfs tmpfs 5.7G 9.3M 5.6G 1% /run
tmpfs tmpfs 5.7G 0 5.7G 0% /sys/fs/cgroup
/dev/mapper/ol_ht19c-root xfs 47G 45G 2.5G 95% /
/dev/sda1 xfs 1014M 229M 786M 23% /boot
tmpfs tmpfs 1.2G 12K 1.2G 1% /run/user/42
tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0
/dev/mapper/vg_nc-lv_nc xfs 1017M 33M 985M 4% /nc
[root@ht19c01 ~]# xfs_growfs /dev/mapper/vg_nc-lv_nc
meta-data=/dev/mapper/vg_nc-lv_nc isize=256 agcount=4, agsize=65280 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=261120, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=853, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 261120 to 522240
[root@ht19c01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 5.6G 0 5.6G 0% /dev
tmpfs 5.7G 0 5.7G 0% /dev/shm
tmpfs 5.7G 9.3M 5.6G 1% /run
tmpfs 5.7G 0 5.7G 0% /sys/fs/cgroup
/dev/mapper/ol_ht19c-root 47G 45G 2.5G 95% /
/dev/sda1 1014M 229M 786M 23% /boot
tmpfs 1.2G 12K 1.2G 1% /run/user/42
tmpfs 1.2G 0 1.2G 0% /run/user/0
/dev/mapper/vg_nc-lv_nc 2.0G 33M 2.0G 2% /nc

ext4檔案系統擴充套件
resize2fs /dev/mapper/vg_nc-lv_nc


[root@ht19c01 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 1G 0 disk
└─vg_nc-lv_nc 252:2 0 2G 0 lvm /nc
sr0 11:0 1 1024M 0 rom
sdc 8:32 0 1G 0 disk
└─vg_nc-lv_nc 252:2 0 2G 0 lvm /nc
sda 8:0 0 50G 0 disk
├─sda2 8:2 0 49G 0 part
│ ├─ol_ht19c-swap 252:1 0 2G 0 lvm [SWAP]
│ └─ol_ht19c-root 252:0 0 47G 0 lvm /
└─sda1 8:1 0 1G 0 part /boot
[root@ht19c01 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
ol_ht19c 1 2 0 wz--n- <49.00g 4.00m
vg_nc 2 1 0 wz--n- 1.99g 0
[root@ht19c01 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root ol_ht19c -wi-ao---- 46.99g
swap ol_ht19c -wi-ao---- 2.00g
lv_nc vg_nc -wi-ao---- 1.99g

相關文章