复习下LVM知识:
LVM的结构简图如下:
hda1 hdc1 sdc (PV:s 物理卷,一般为分区或整个硬盘)
\ | /
\ | /
diskvg (VG卷组由物理卷组成)
/ | \
/ | \
usrlv rootlvvarlv (LV:s 逻辑卷在卷组上创建)
| | |
ext2 reiserfs xfs (建立在逻辑卷上的文件系统)
PV: 实体分割区(Partition)/dev/had...
VG: 虚拟硬盘 /dev/vg_name
LV:虚拟分割区 /dev/vg_name/lv_name
因为要做备份需要对/home目录进行扩容,首先查看各个目录当前的使用情况
root@ecis_db_1:/>df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 4.00 1.00 75% 12267 5% /
/dev/hd2 6.00 1.91 69% 55227 11% /usr
/dev/hd9var 3.00 0.90 71% 9644 5% /var
/dev/hd3 3.00 2.72 10% 1955 1% /tmp
/dev/hd1 3.00 1.71 44% 5209 2% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 8.00 2.57 68% 23614 4% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 10.00 7.07 30% 7258 1% /sybiq
/dev/fslv01 10.00 4.72 53% 9841 1% /sybase
/dev/odm 0.00 0.00 -1% 6 100% /dev/odm
/dev/vx/dsk/sybaseiqdg/vol01 100.00 44.03 56% 16968 1% /data_sybaseiq
发现/home目录只有3G,对于备份实在是小了,在对目录进行扩容之前先查看还有多少剩余的可扩空间
使用lsvg命令来查看卷组信息,因为是第一次使用lsvg命令,使用之前先man lsvg,发现man文档已经给出了几个很好的实例
LSVG COMMAND
Purpose
Displays information about volume groups.
Examples
1 To display the names of all active volume groups, enter the following command: lsvg -o
2 To display the names of all volume groups within the system, enter the following command:
lsvg
3 To display information about volume group vg02, enter the following command:
lsvg vg02
The characteristics and status of both the logical and physical partitions of volume group vg02 are displayed.
4 To display the names, characteristics, and status of all the logical volumes in volume group vg02, enter the following
command: lsvg -l vg02
查看当前活动卷组
root@ecis_db_1:/>lsvg -o
rootvg
查看rootvg卷组信息
root@ecis_db_1:/>lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 00f7c31700004c000000013976ae6a37
VG STATE: active PP SIZE: 512 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 1116 (571392 megabytes)
MAX LVs: 256 FREE PPs: 484 (247808 megabytes) -- 剩余247.808G
LVs: 15 USED PPs: 632 (323584 megabytes)
OPEN LVs: 13 QUORUM: 1 (Disabled)
TOTAL PVs: 2 VG DESCRIPTORS: 3
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 2 AUTO ON: yes
MAX PPs per VG: 32512
MAX PPs per PV: 1016 MAX PVs: 32
LTG size (Dynamic): 1024 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable
PV RESTRICTION: none INFINITE RETRY: no
bash-3.2$ lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 128 256 2 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 8 16 2 open/syncd /
hd2 jfs2 12 24 2 open/syncd /usr
hd9var jfs2 6 12 2 open/syncd /var
hd3 jfs2 6 12 2 open/syncd /tmp
hd1 jfs2 100 200 2 open/syncd /home
hd10opt jfs2 16 32 2 open/syncd /opt
hd11admin jfs2 1 2 2 open/syncd /admin
lg_dumplv sysdump 8 8 1 open/syncd N/A
livedump jfs2 1 2 2 open/syncd /var/adm/ras/livedump
ptfs_lv jfs2 12 24 2 closed/syncd /ptfs
fslv00 jfs2 20 20 1 open/syncd /sybiq
fslv01 jfs2 20 20 1 open/syncd /sybase
$ su 切换用户
root's Password:
# chfs -a size=50G /home 将/home目录的空间从3G调整为50G
# exit
bash-3.2$ df -g 再次查看
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 4.00 1.00 75% 12267 5% /
/dev/hd2 6.00 1.91 69% 55227 11% /usr
/dev/hd9var 3.00 0.90 71% 9646 5% /var
/dev/hd3 3.00 2.72 10% 1955 1% /tmp
/dev/hd1 50.00 48.70 3% 5209 1% /home
/dev/hd11admin 0.50 0.50 1% 5 1% /admin
/proc - - - - - /proc
/dev/hd10opt 8.00 2.57 68% 23614 4% /opt
/dev/livedump 0.50 0.50 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 10.00 7.07 30% 7258 1% /sybiq
/dev/fslv01 10.00 4.72 53% 9841 1% /sybase
/dev/odm 0.00 0.00 -1% 6 100% /dev/odm
/dev/vx/dsk/sybaseiqdg/vol01 100.00 44.14 56% 16855 1% /data_sybaseiq