LVM上のファイルシステム(ext3)を縮小する手順例を示す。
確認環境
- RHEL 5.4 on VMware Server 2
例
- ファイルシステム(ext3)をアンマウントする
[root@localhost ~]# df Filesystem 1K-ブロック 使用 使用可 使用% マウント位置 /dev/sda2 10154020 3557124 6072776 37% / /dev/sda1 256666 37292 206122 16% /boot tmpfs 62192 0 62192 0% /dev/shm /dev/mapper/VG0001-LV0001 63605 5163 55821 9% /mnt [root@localhost ~]# umount /mnt [root@localhost ~]#
- ファイルシステム(ext3)を縮小する
[root@localhost ~]# e2fsck -nfv /dev/VG0001/LV0001 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 11 inodes used (0.07%) 1 non-contiguous inode (9.1%) # of inodes with ind/dind/tind blocks: 0/0/0 7094 blocks used (10.82%) 0 bad blocks 0 large files 0 regular files 2 directories 0 character device files 0 block device files 0 fifos 0 links 0 symbolic links (0 fast symbolic links) 0 sockets -------- 2 files [root@localhost ~]# e2fsck -f /dev/VG0001/LV0001 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/VG0001/LV0001: 11/15232 files (9.1% non-contiguous), 7094/65536 blocks [root@localhost ~]# resize2fs /dev/VG0001/LV0001 53248 resize2fs 1.39 (29-May-2006) Resizing the filesystem on /dev/VG0001/LV0001 to 53248 (1k) blocks. The filesystem on /dev/VG0001/LV0001 is now 53248 blocks long. [root@localhost ~]#
- LV(論理ボリューム)を縮小する
[root@localhost ~]# lvreduce -L-12M /dev/VG0001/LV0001 WARNING: Reducing active logical volume to 52.00 MB THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce LV0001? [y/n]: y Reducing logical volume LV0001 to 52.00 MB Logical volume LV0001 successfully resized [root@localhost ~]# vgdisplay -v VG0001 Using volume group(s) on command line Finding volume group "VG0001" --- Volume group --- VG Name VG0001 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 6 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size 7.80 GB PE Size 4.00 MB Total PE 1998 Alloc PE / Size 13 / 52.00 MB Free PE / Size 1985 / 7.75 GB VG UUID Fusrtt-uqYJ-uNdZ-fepf-5hpt-554b-zKQuIj --- Logical volume --- LV Name /dev/VG0001/LV0001 VG Name VG0001 LV UUID V6JgvS-CD33-WvBo-TfE2-qRu2-765V-0YAhyR LV Write Access read/write LV Status available # open 0 LV Size 52.00 MB Current LE 13 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Physical volumes --- PV Name /dev/sdb1 PV UUID EhMTvI-k3fq-eoRV-Hwkd-iA7G-p3Lk-QjSOsC PV Status allocatable Total PE / Free PE 999 / 986 PV Name /dev/sdb2 PV UUID zbmif7-hWP2-2VA2-sFNp-vbSw-O7Ce-rMErmL PV Status allocatable Total PE / Free PE 999 / 999 [root@localhost ~]# e2fsck -nfv /dev/VG0001/LV0001 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 11 inodes used (0.08%) 1 non-contiguous inode (9.1%) # of inodes with ind/dind/tind blocks: 0/0/0 6645 blocks used (12.48%) 0 bad blocks 0 large files 0 regular files 2 directories 0 character device files 0 block device files 0 fifos 0 links 0 symbolic links (0 fast symbolic links) 0 sockets -------- 2 files [root@localhost ~]#
- 再度マウントする
[root@localhost ~]# mount /dev/VG0001/LV0001 /mnt [root@localhost ~]# df Filesystem 1K-ブロック 使用 使用可 使用% マウント位置 /dev/sda2 10154020 3557132 6072768 37% / /dev/sda1 256666 37292 206122 16% /boot tmpfs 62192 0 62192 0% /dev/shm /dev/mapper/VG0001-LV0001 51559 4956 45006 10% /mnt [root@localhost ~]#
コメント
コメントを投稿