我们有一个带有2个磁盘的RHEL 7服务器(sda
和sdb
)。我们的/
,/var/log
和swap
在sda
上,/var
在sdb
上。我们使用LVM和XFS。
sda
太大了(160 GB),我们想把它缩小到40 GB。然后,我们可以使用空闲的120 GB扩展sdb
。
[root@foo ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- 134.77g 9.77g
/dev/sdb1 vg_var lvm2 a-- 200.00g 0
[root@foo ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root rhel -wi-ao---- 117.19g
swap rhel -wi-ao---- 3.91g
var_log rhel -wi-ao---- 3.91g
lv_var vg_var -wi-ao---- 200.00g
[root@foo ~]# fdisk -l
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 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 label type: dos
Disk identifier: 0x3235298e
Device Boot Start End Blocks Id System
/dev/sdb1 2048 419430399 209714176 8e Linux LVM
Disk /dev/sda: 161.1 GB, 161061273600 bytes, 314572800 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 label type: dos
Disk identifier: 0x0009b153
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 283656191 141315072 8e Linux LVM
Disk /dev/mapper/rhel-root: 125.8 GB, 125829120000 bytes, 245760000 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/rhel-swap: 4194 MB, 4194304000 bytes, 8192000 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/vg_var-lv_var: 214.7 GB, 214744170496 bytes, 419422208 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/rhel-var_log: 4194 MB, 4194304000 bytes, 8192000 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
我们如何才能安全地做到这一点?我用一台测试机试过,但失败了:
sda
安装到/mnt/sysimage
,并将新磁盘的LV安装到/mnt/sdb
cp -ax /mnt/sysimage/* /mnt/sdb
/mnt/sysimage/etc/fstab
以使用/dev/mapper/rhel-lv_root
INT18 boot failure
,重新启动失败发布于 2017-03-02 17:10:14
目前,2019 XFS文件系统无法缩小。
http://xfs.org/index.php/Shrinking_支持
这是RH网站上的说法:
https://unix.stackexchange.com/questions/279502
复制相似问题