#/home目录由逻辑卷/dev/mapper/VolGroup01-LogVol00挂载,并用占用空间4.8G,现在需要减少占用空间
[root@localhost /]# df -h
/dev/sda1 3.8G 638M 3.0G 18% /
/dev/mapper/VolGroup01-LogVol00
4.8G 138M 4.4G 4% /home
/dev/mapper/VolGroup01-LogVol01
3.8G 3.5G 100M 98% /usr
/dev/mapper/VolGroup00-LogVol00
7.6G 254M 7.0G 4% /var
/dev/mapper/VolGroup00-LogVol01
1.9G 36M 1.8G 2% /tmp
tmpfs 506M 0 506M 0% /dev/shm
.host:/ 39G 35G 4.6G 89% /mnt/hgfs
[root@localhost /]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/VolGroup01-LogVol00 on /home type ext3 (rw)
/dev/mapper/VolGroup01-LogVol01 on /usr type ext3 (rw)
/dev/mapper/VolGroup00-LogVol00 on /var type ext3 (rw)
/dev/mapper/VolGroup00-LogVol01 on /tmp type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
#卸载/home
[root@localhost /]# umount /home
#检查文件系统
[root@localhost /]# e2fsck -f /dev/mapper/VolGroup01-LogVol00
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/mapper/VolGroup01-LogVol00: 23/1277952 files (4.3% non-contiguous), 75341/1277952 blocks
#更改文件系统大小
[root@localhost /]# resize2fs /dev/mapper/VolGroup01-LogVol00 2000M
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/VolGroup01-LogVol00 to 512000 (4k) blocks.
The filesystem on /dev/mapper/VolGroup01-LogVol00 is now 512000 blocks long.
#更改逻辑卷大小
[root@localhost ~]# lvresize -L 2000M /dev/mapper/VolGroup01-LogVol00
Rounding up size to full physical extent 1.97 GB
WARNING: Reducing active logical volume to 1.97 GB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce LogVol00? [y/n]: y
Reducing logical volume LogVol00 to 1.97 GB
Logical volume LogVol00 successfully resized
#查看更改后逻辑卷大小
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup01/LogVol00
VG Name VolGroup01
LV UUID udSSl6-MVve-m0Zs-2lsH-63KM-m60d-Jf93ZO
LV Write Access read/write
LV Status available
# open 0
LV Size 1.97 GB
Current LE 63
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup01/LogVol01
VG Name VolGroup01
LV UUID wmtoaH-2vUu-21F9-iRu9-o7KE-WIIW-770gPx
LV Write Access read/write
LV Status available
# open 1
LV Size 3.91 GB
Current LE 125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID IbhPC2-hSg0-etvX-iWqd-OYPa-I2so-1NECH0
LV Write Access read/write
LV Status available
# open 1
LV Size 7.81 GB
Current LE 250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID nA8JQj-yarg-obrO-X3tC-sxyN-EIu2-Ym0ZCE
LV Write Access read/write
LV Status available
# open 1
LV Size 1.94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
#重新挂载/home
[root@localhost ~]# mount /dev/mapper/VolGroup01-LogVol00 /home
#查看卷组大小变化
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name VolGroup01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 8.78 GB
PE Size 32.00 MB
Total PE 281
Alloc PE / Size 188 / 5.88 GB
Free PE / Size 93 / 2.91 GB
VG UUID wXgIzn-v37a-MZpY-kjiM-89Qq-39q2-syx3WF
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 9.75 GB
PE Size 32.00 MB
Total PE 312
Alloc PE / Size 312 / 9.75 GB
Free PE / Size 0 / 0
VG UUID xkMReC-ijq3-fpPi-4dmB-TcYe-clE7-DqUoTE
#查看所有逻辑卷 或lvdisplay
[root@localhost VolGroup01]# lvmdiskscan
/dev/ramdisk [ 16.00 MB]
/dev/VolGroup01/LogVol00 [ 1.97 GB]
/dev/ram [ 16.00 MB]
/dev/root [ 3.91 GB]
/dev/VolGroup01/LogVol01 [ 3.91 GB]
/dev/ram2 [ 16.00 MB]
/dev/sda2 [ 9.77 GB] LVM physical volume
/dev/VolGroup00/LogVol00 [ 7.81 GB]
/dev/ram3 [ 16.00 MB]
/dev/sda3 [ 8.79 GB] LVM physical volume
/dev/VolGroup00/LogVol01 [ 1.94 GB]
/dev/ram4 [ 16.00 MB]
/dev/VolGroup01/lv3invg01 [ 512.00 MB]
/dev/ram5 [ 16.00 MB]
/dev/sda5 [ 2.00 GB]
/dev/ram6 [ 16.00 MB]
/dev/ram7 [ 16.00 MB]
/dev/ram8 [ 16.00 MB]
/dev/ram9 [ 16.00 MB]
/dev/ram10 [ 16.00 MB]
/dev/ram11 [ 16.00 MB]
/dev/ram12 [ 16.00 MB]
/dev/ram13 [ 16.00 MB]
/dev/ram14 [ 16.00 MB]
/dev/ram15 [ 16.00 MB]
3 disks
20 partitions
0 LVM physical volume whole disks
2 LVM physical volumes
# 系统->管理->逻辑卷管理器
#物理卷查看
[root@localhost cache]# pvscan
PV /dev/sda3 VG VolGroup01 lvm2 [8.78 GB / 2.41 GB free]
PV /dev/sda2 VG VolGroup00 lvm2 [9.75 GB / 0 free]
Total: 2 [18.53 GB] / in use: 2 [18.53 GB] / in no VG: 0 [0 ]
#在卷组VolGroup01中创建逻辑卷lv3invg01,并指定大小500M
[root@localhost ~]# lvcreate -L 500M VolGroup01 -n lv3invg01
Rounding up size to full physical extent 512.00 MB
Logical volume "lv3invg01" created
#查看新增的逻辑卷
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/VolGroup01/LogVol00
VG Name VolGroup01
LV UUID udSSl6-MVve-m0Zs-2lsH-63KM-m60d-Jf93ZO
LV Write Access read/write
LV Status available
# open 1
LV Size 1.97 GB
Current LE 63
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup01/LogVol01
VG Name VolGroup01
LV UUID wmtoaH-2vUu-21F9-iRu9-o7KE-WIIW-770gPx
LV Write Access read/write
LV Status available
# open 1
LV Size 3.91 GB
Current LE 125
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/VolGroup01/lv3invg01
VG Name VolGroup01
LV UUID Qkmthf-y0AO-3DVN-d8Et-HRSh-oPad-033Nj9
LV Write Access read/write
LV Status available
# open 0
LV Size 512.00 MB
Current LE 16
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:4
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID IbhPC2-hSg0-etvX-iWqd-OYPa-I2so-1NECH0
LV Write Access read/write
LV Status available
# open 1
LV Size 7.81 GB
Current LE 250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID nA8JQj-yarg-obrO-X3tC-sxyN-EIu2-Ym0ZCE
LV Write Access read/write
LV Status available
# open 1
LV Size 1.94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
#/dev/VolGroup01目录下会多出lv3invg01文件
[root@localhost ~]# cd /dev/VolGroup01/
[root@localhost VolGroup01]# ls
LogVol00 LogVol01 lv3invg01
[root@localhost VolGroup01]# mkfs.ext3 /dev/VolGroup01/lv3invg01
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
64 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#挂载逻辑卷
[root@localhost VolGroup01]# mkdir /mnt/lv3invg01
[root@localhost VolGroup01]# mount /dev/VolGroup01/lv3invg01 /mnt/lv3invg01/