CentOS Stream 9扩展根分区

张开发
2026/4/13 20:00:10 15 分钟阅读

分享文章

CentOS Stream 9扩展根分区
没有废话直接上操作[rootserver ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 4.0M 0 4.0M 0% /dev tmpfs 7.7G 0 7.7G 0% /dev/shm tmpfs 3.1G 9.1M 3.1G 1% /run /dev/mapper/cs-root 17G 4.5G 13G 27% / /dev/nvme0n1p1 960M 308M 653M 33% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0 [rootserver ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sr0 11:0 1 10.8G 0 rom nvme0n1 259:0 0 20G 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot └─nvme0n1p2 259:2 0 19G 0 part ├─cs-root 253:0 0 17G 0 lvm / └─cs-swap 253:1 0 2G 0 lvm [SWAP] nvme0n2 259:3 0 20G 0 disk [rootserver ~]# fdisk -l Disk /dev/nvme0n1: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VMware Virtual NVMe Disk Units: sectors of 1 * 512 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x3acf68eb Device Boot Start End Sectors Size Id Type /dev/nvme0n1p1 * 2048 2099199 2097152 1G 83 Linux /dev/nvme0n1p2 2099200 41943039 39843840 19G 8e Linux LVM Disk /dev/nvme0n2: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VMware Virtual NVMe Disk 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/cs-root: 17 GiB, 18249416704 bytes, 35643392 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/cs-swap: 2 GiB, 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 [rootserver ~]# pvcreate /dev/nvme0n2 Physical volume /dev/nvme0n2 successfully created. [rootserver ~]# pvdisplay --- Physical volume --- PV Name /dev/nvme0n1p2 VG Name cs PV Size 19.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 4863 Free PE 0 Allocated PE 4863 PV UUID 5lM9n2-i1BV-icKL-sa2n-mqOt-JNdu-GiNz5N /dev/nvme0n2 is a new physical volume of 20.00 GiB --- NEW Physical volume --- PV Name /dev/nvme0n2 VG Name PV Size 20.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID Eq2SH3-uck2-tJJ7-BEiU-rlR1-LT4L-6IKl3Z [rootserver ~]# vgextend cs /dev/nvme0n2 Volume group cs successfully extended [rootserver ~]# pvdisplay --- Physical volume --- PV Name /dev/nvme0n1p2 VG Name cs PV Size 19.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 4863 Free PE 0 Allocated PE 4863 PV UUID 5lM9n2-i1BV-icKL-sa2n-mqOt-JNdu-GiNz5N --- Physical volume --- PV Name /dev/nvme0n2 VG Name cs PV Size 20.00 GiB / not usable 4.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 5119 Free PE 5119 Allocated PE 0 PV UUID Eq2SH3-uck2-tJJ7-BEiU-rlR1-LT4L-6IKl3Z [rootserver ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 4.0M 0 4.0M 0% /dev tmpfs 7.7G 0 7.7G 0% /dev/shm tmpfs 3.1G 9.1M 3.1G 1% /run /dev/mapper/cs-root 17G 4.5G 13G 27% / /dev/nvme0n1p1 960M 308M 653M 33% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0 [rootserver ~]# lvextend -l 100%free /dev/mapper/cs-root Size of logical volume cs/root changed from 17.00 GiB (4351 extents) to 36.99 GiB (9470 extents). Logical volume cs/root successfully resized. [rootserver ~]# blkid /dev/mapper/cs-root /dev/mapper/cs-root: UUID7891d05a-39a3-4cd4-adf5-12035d8ec669 TYPExfs [rootserver ~]# xfs_growfs /dev/mapper/cs-root meta-data/dev/mapper/cs-root isize512 agcount4, agsize1113856 blks sectsz512 attr2, projid32bit1 crc1 finobt1, sparse1, rmapbt0 reflink1 bigtime1 inobtcount1 nrext640 data bsize4096 blocks4455424, imaxpct25 sunit0 swidth0 blks naming version 2 bsize4096 ascii-ci0, ftype1 log internal log bsize4096 blocks16384, version2 sectsz512 sunit0 blks, lazy-count1 realtime none extsz4096 blocks0, rtextents0 data blocks changed from 4455424 to 9697280 [rootserver ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 4.0M 0 4.0M 0% /dev tmpfs 7.7G 0 7.7G 0% /dev/shm tmpfs 3.1G 9.1M 3.1G 1% /run /dev/mapper/cs-root 37G 4.6G 33G 13% / /dev/nvme0n1p1 960M 308M 653M 33% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0 [rootserver ~]#

更多文章