- 1.硬盘信息,LVM信息
代码: 全选
[root@Fedora-Server mnt]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 ext4 ec75c633-e82f-4546-a6c5-a8aa48d2b279 /boot
└─sda2 LVM2_member ZM2oLw-mC8W-65ap-mE3z-sLqH-oVnb-mdj04J
├─fedora-root xfs c94b388d-fc94-49b4-9d34-271af81f6151 /
└─fedora-swap swap 451b5184-395f-4d69-95f0-c13860bc1bd1 [SWAP]
[root@Fedora-Server mnt]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name fedora
PV Size <464.76 GiB / not usable 0
Allocatable yes
PE Size 4.00 MiB
Total PE 118978
Free PE 113132
Allocated PE 5846
PV UUID ZM2oLw-mC8W-65ap-mE3z-sLqH-oVnb-mdj04J
[root@Fedora-Server mnt]# vgdisplay
--- Volume group ---
VG Name fedora
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <464.76 GiB
PE Size 4.00 MiB
Total PE 118978
Alloc PE / Size 5846 / <22.84 GiB
Free PE / Size 113132 / 441.92 GiB
VG UUID o4fq0C-HD8j-u3Rm-wUXZ-Ztyb-gUFL-BOp7N8
[root@Fedora-Server mnt]# lvdisplay
--- Logical volume ---
LV Path /dev/fedora/swap
LV Name swap
VG Name fedora
LV UUID B5qCQ7-qabv-7cQy-VD7J-c0Qu-H763-GZFapm
LV Write Access read/write
LV Creation host, time localhost, 2018-11-19 22:17:45 +0800
LV Status available
# open 2
LV Size <7.84 GiB
Current LE 2006
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID 6QRnFx-3qTr-T1cX-JMoS-harH-iyUT-87GvOr
LV Write Access read/write
LV Creation host, time localhost, 2018-11-19 22:17:46 +0800
LV Status available
# open 1
LV Size 15.00 GiB
Current LE 3840
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID 6QRnFx-3qTr-T1cX-JMoS-harH-iyUT-87GvOr
LV Write Access read/write
LV Creation host, time localhost, 2018-11-19 22:17:46 +0800
LV Status available
# open 1
LV Size 456.92 GiB
Current LE 116972
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@Fedora-Server mnt]# fdisk -l
Disk /dev/sda: 465.8 GiB, 500106780160 bytes, 976771055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x3c7a658c
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 976769023 974669824 464.8G 8e Linux LVM
Disk /dev/mapper/fedora-root: 15 GiB, 16106127360 bytes, 31457280 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/fedora-swap: 7.9 GiB, 8413773824 bytes, 16433152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
- 2. 扩容根硬盘
代码: 全选
// 将容量全部移到根硬盘内
[root@Fedora-Server mnt]# lvextend -l +100%FREE /dev/mapper/fedora-root
Size of logical volume fedora/root changed from 15.00 GiB (3840 extents) to 456.92 GiB (116972 extents).
Logical volume fedora/root successfully resized.
/*
刷新文件系统是否扩容生效
没有生效
*/
[root@Fedora-Server mnt]# resize2fs /dev/mapper/fedora-root
resize2fs 1.44.3 (10-July-2018)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/fedora-root
Couldn’t find valid filesystem superblock.
/*
扩容xfs方法
没有生效
*/
//
[root@Fedora-Server mnt]# xfs_growfs /dev/mapper/fedora-root
xfs_growfs: /dev/mapper/fedora-root is not a mounted XFS filesystem
- 3. 问题
代码: 全选
[root@Fedora-Server mnt]# fdisk -l
Disk /dev/sda: 465.8 GiB, 500106780160 bytes, 976771055 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x3c7a658c
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 976769023 974669824 464.8G 8e Linux LVM
Disk /dev/mapper/fedora-root: 456.9 GiB, 490616127488 bytes, 958234624 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/fedora-swap: 7.9 GiB, 8413773824 bytes, 16433152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
[root@Fedora-Server mnt]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 1.1M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/fedora-root 15G 2.1G 13G 14% /
tmpfs 7.8G 4.0K 7.8G 1% /tmp
/dev/sda1 976M 127M 783M 14% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/0