[root@centos ~]# df ← LVマウント状況照会
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
3047184 1668784 1315488 56% /
/dev/sda1 101086 23800 72067 25% /boot
tmpfs 127796 0 127796 0% /dev/shm
/dev/mapper/VolGroup00-lvol0
999832 17652 931392 2% /mnt ← 縮小対象LV
[root@centos ~]# lvdisplay /dev/VolGroup00/lvol0 ← 縮小対象LV照会
--- Logical volume ---
LV Name /dev/VolGroup00/lvol0
VG Name VolGroup00
LV UUID gN1ffx-4vUj-27cU-JK8b-958P-TnQ3-fyEsvG
LV Write Access read/write
LV Status available
# open 1
LV Size 992.00 MB ← 縮小前LVサイズ
Current LE 31
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
[root@centos ~]# umount /mnt/ ← 縮小対象LVアンマウント
[root@centos ~]# df ← LVマウント状況照会
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
3047184 1668784 1315488 56% /
/dev/sda1 101086 23800 72067 25% /boot
tmpfs 127796 0 127796 0% /dev/shm
[root@centos ~]# fsck.ext3 -f /dev/VolGroup00/lvol0 ← 縮小対象LVファイルシステム整合性チェック
※ファイルシステム整合性チェックを行わないと次のresize2fsができない
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/VolGroup00/lvol0: 11/126976 files (9.1% non-contiguous), 8407/253952 blocks
[root@centos ~]# resize2fs /dev/VolGroup00/lvol0 512M ← 縮小対象LVファイルシステムサイズを512MBに変更
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/VolGroup00/lvol0 to 131072 (4k) blocks.
The filesystem on /dev/VolGroup00/lvol0 is now 131072 blocks long.
[root@centos ~]# lvreduce -L512M /dev/VolGroup00/lvol0 ← 縮小対象LVサイズを512MBに縮小
WARNING: Reducing active logical volume to 512.00 MB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lvol0? [y/n]: y ← y応答
Reducing logical volume lvol0 to 512.00 MB
Logical volume lvol0 successfully resized
[root@centos ~]# mount /dev/VolGroup00/lvol0 /mnt/ ← 縮小対象LVマウント
[root@centos ~]# df ← LVマウント状況照会
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
3047184 1668788 1315484 56% /
/dev/sda1 101086 23800 72067 25% /boot
tmpfs 127796 0 127796 0% /dev/shm
/dev/mapper/VolGroup00-lvol0
516296 17164 478164 4% /mnt ← 縮小対象LV
[root@centos ~]# lvdisplay /dev/VolGroup00/lvol0 ← 縮小対象LV照会
--- Logical volume ---
LV Name /dev/VolGroup00/lvol0
VG Name VolGroup00
LV UUID gN1ffx-4vUj-27cU-JK8b-958P-TnQ3-fyEsvG
LV Write Access read/write
LV Status available
# open 1
LV Size 512.00 MB ← 縮小後LVサイズ
Current LE 16
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
[root@centos ~]# vgdisplay ← VG照会
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 42
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 2
Act PV 2
VG Size 4.84 GB
PE Size 32.00 MB
Total PE 155
Alloc PE / Size 140 / 4.38 GB
Free PE / Size 15 / 480.00 MB ← VGに空きができた
VG UUID 9wGRk1-6iy1-03Hi-BX2b-W8u8-saiV-P6wfiL
|
|