Kami memiliki server RHEL 7 dengan 2 disk ( sda
dan sdb
). Kami /
, /var/log
dan swap
aktif sda
, /var
aktif sdb
. Kami menggunakan LVM dan XFS.
sda
terlalu besar (160 GB) dan kami ingin mengecilkannya menjadi 40 GB. Kami kemudian dapat menggunakan 120 GB gratis untuk memperpanjang 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
Bagaimana kita bisa mencapai ini dengan aman? Saya sudah mencoba ini dengan mesin uji, tetapi gagal:
- Tambahkan disk baru
- Buat partisi LVM, buat pvc dan tambahkan LV baru di atasnya.
- Boot dengan disk penyelamat
- Gunung
sda
untuk/mnt/sysimage
dan me-mount LV disk baru untuk/mnt/sdb
cp -ax /mnt/sysimage/* /mnt/sdb
- Perbarui
/mnt/sysimage/etc/fstab
untuk digunakan/dev/mapper/rhel-lv_root
- Akhirnya reboot gagal karena
INT18 boot failure