我在分配给服务器的一些空间时遇到问题,我需要向分区 /store 添加 1TB
df -h 显示
[root@SERVER ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 12G 0 12G 0% /dev
tmpfs 12G 56K 12G 1% /dev/shm
tmpfs 12G 26M 12G 1% /run
tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/mapper/rootrhel-root 13G 3.5G 9.1G 28% /
/dev/mapper/rootrhel-opt 13G 6.6G 6.0G 53% /opt
/dev/mapper/rootrhel-storetmp 15G 34M 15G 1% /storetmp
/dev/mapper/storerhel-store 2.9T 2.6T 350G 89% /store
/dev/sda3 32G 5.5G 27G 18% /recovery
/dev/mapper/rootrhel-tmp 3.0G 46M 3.0G 2% /tmp
/dev/mapper/rootrhel-var 5.0G 253M 4.8G 5% /var
/dev/mapper/rootrhel-varlog 15G 1.3G 14G 9% /var/log
/dev/mapper/rootrhel-varlogaudit 3.0G 84M 3.0G 3% /var/log/audit
/dev/mapper/rootrhel-home 1014M 33M 982M 4% /home
/dev/sda2 1014M 358M 657M 36% /boot
/dev/sda1 200M 9.9M 190M 5% /boot/efi
tmpfs 2.4G 0 2.4G 0% /run/user/0
和 fdisk -l 显示
[root@SERVER ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 4398.0 GB, 4398046511104 bytes, 8589934592 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: gpt
Disk identifier: 56EB4CE6-541B-4A54-BE1C-5F2738DEDEA4
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 2508799 1G Microsoft basic
3 2508800 69617663 32G Microsoft basic
4 69617664 6264891391 2.9T Linux LVM
5 6264891392 6405408767 67G Linux LVM
6 6405408768 6442438655 17.7G Linux swap
7 6442438656 6442450910 6M Linux filesyste
Disk /dev/mapper/rootrhel-root: 13.4 GB, 13421772800 bytes, 26214400 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/rootrhel-storetmp: 16.1 GB, 16106127360 bytes, 31457280 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/rootrhel-tmp: 3221 MB, 3221225472 bytes, 6291456 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/rootrhel-home: 1073 MB, 1073741824 bytes, 2097152 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/rootrhel-opt: 13.4 GB, 13421772800 bytes, 26214400 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/rootrhel-varlogaudit: 3221 MB, 3221225472 bytes, 6291456 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/rootrhel-varlog: 16.1 GB, 16106127360 bytes, 31457280 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/rootrhel-var: 5368 MB, 5368709120 bytes, 10485760 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/storerhel-store: 3172.0 GB, 3171980148736 bytes, 6195273728 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
这是我使用parted然后打印free看到的
[root@SERVER ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 1049kB 1031kB Free Space
1 1049kB 211MB 210MB fat16 EFI System Partition boot
2 211MB 1285MB 1074MB xfs
3 1285MB 35.6GB 34.4GB xfs
4 35.6GB 3208GB 3172GB lvm
5 3208GB 3280GB 71.9GB lvm
6 3280GB 3299GB 19.0GB linux-swap(v1)
7 3299GB 3299GB 6275kB
3299GB 4398GB 1100GB Free Space
(parted)
所以 1TB 未分配,但我找不到在哪里调整分区大小
我尝试使用 resize2fs、xfs_growfs、fdisk、parted 但没有任何反应
有什么可能的解决办法吗?谢谢
答案1
这里仍然有一些猜测,但是......
看起来分区 7、6 MB 文件系统未使用。如果这是正确的,我会删除它并创建一个新分区。理想情况下,您可以将现有分区 5 和 6 移至磁盘末尾,以便可以使用pvresize
当前分区store
,但我没有为您提供命令行演练。
如果您能够使用rescue-cd并且可以承受服务器上的停机时间,您可以启动rescue-cd并使用gparted
图形化前端来移动它们(命令行工具放弃了对移动一段时间的支持)前)。
如果不能选择停机,最简单的方法是在可用空间中创建一个新分区,并将其添加到现有卷组中。假设您删除了微小的 #7,并用 1TB 重新创建了它。 (如果正在使用,请创建一个新分区 #8 并在下面的示例中使用它)。
vgextend storerhel-store /dev/sda7
现在, Avgdisplay
应显示卷组的可用盘区大小为 1TB(空闲 PE)。之后你可以
lvextend -r -l +<Available Size> /dev/mapper/storerhel-store