1. 查看所有可用磁盘
[root@hostname ~]# fdisk -l
Disk /dev/sda: 146.1 GB, 146163105792 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 33 265041 83 Linux
/dev/sda2 34 17769 142464420 8e Linux LVM
Disk /dev/sdb: 292.3 GB, 292326211584 bytes
255 heads, 63 sectors/track, 35539 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
[root@hostname ~]#
2.查看当前所有pv
[root@hostnamedwdev01 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a- 135.84G 67.84G
/dev/sdc hostnameetlstg01_vol lvm2 a- 64.00G 0
/dev/sdd hostnameetlstg01_vol lvm2 a- 64.00G 63.99G
/dev/sde hostnamedwpro01_vol lvm2 a- 64.00G 0
/dev/sdf hostnamedwpro01_vol lvm2 a- 64.00G 63.99G
/dev/sdg hostnamedwpro01_vol lvm2 a- 64.00G 64.00G
/dev/sdh hostnamedwdev01_vol lvm2 a- 64.00G 0
/dev/sdi hostnamedwdev01_vol lvm2 a- 64.00G 34.00G
[root@hostnamedwdev01 ~]#
3. 将一个可用磁盘创建成为pv。
[root@hostname ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
[root@hostname ~]#
4. 创建vg,:vgcreate vg名称 pv名称
[root@hostname ~]# vgcreate appvg /dev/sdb
Volume group "appvg" successfully created
[root@hostname ~]#
5. 创建lv,:lvcreate -L 空间大小 -n lv名称 vg名称
[root@hostname ~]# lvcreate -L 25G -n appaiclv appaicvg
Logical volume "appaiclv" created
[root@hostname ~]#
6. 格式化lv
[root@hostname ~]# mkfs.ext3 /dev/appaicvg/appaiclv
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3276800 inodes, 6553600 blocks
327680 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
200 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@hostname ~]#
7. 新建一个目录
[root@hostname /]# mkdir /appdevaic
[root@hostname /]#
[root@hostname /]#
8. 挂在新的lv到新的目录下。
[root@hostname /]# mount /dev/appaicvg/appaiclv /appdevaic/
9. 查看一下新挂在的分区
[root@hostname /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootvol
59G 42G 14G 76% /
/dev/sda1 251M 27M 212M 12% /boot
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/mapper/appaicvg-appaiclv
25G 173M 24G 1% /appdevaic
10.设置开机自动挂载
[root@hostname /]# vim /etc/fstab
[root@hostname /]# cp -rap /etc/fstab /etc/fstab.2012092501
[root@hostname /]#
[root@hostname /]# vim /etc/fstab
[root@hostname /]#
[root@hostname /]#
[root@hostname /]# umount /appdevaic/
[root@hostname /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootvol
59G 42G 14G 76% /
/dev/sda1 251M 27M 212M 12% /boot
tmpfs 7.8G 0 7.8G 0% /dev/shm
[root@hostname /]# mount -a
[root@hostname /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootvol
59G 42G 14G 76% /
/dev/sda1 251M 27M 212M 12% /boot
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/mapper/appaicvg-appaiclv
25G 173M 24G 1% /appdevaic
[root@hostname /]#
11. [liul@hostname ~]$ cat /etc/fstab
/dev/rootvg/rootvol / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/rootvg/swapvol swap swap defaults 0 0
/dev/mapper/appaicvg-appaiclv /appdevaic ext3 defaults 1 2
[liul@hostname ~]$
阅读(2174) | 评论(0) | 转发(0) |