[root@pc10 ~]# lvcreate -L 5000m -n nas1 nas
Logical volume "nas1" created
[root@pc10 ~]# lvscan
ACTIVE '/dev/vg_pc6/lv_root' [35.57 GiB] inherit
ACTIVE '/dev/vg_pc6/lv_swap' [3.94 GiB] inherit
ACTIVE '/dev/nas/nas1' [4.88 GiB] inherit
[root@pc10 /]# lvcreate -L 5000m -n nas2 nas
Logical volume "nas2" created
[root@pc10 /]# lvscan
ACTIVE '/dev/vg_pc6/lv_root' [35.57 GiB] inherit
ACTIVE '/dev/vg_pc6/lv_swap' [3.94 GiB] inherit
ACTIVE '/dev/nas/nas1' [9.88 GiB] inherit
ACTIVE '/dev/nas/nas2' [4.88 GiB] inherit
(如出现: mount: unknown filesystem type 'LVM2_member' )
[root@pc10 ~]# yum install lvm2
查看物理卷状态
[root@pc10 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md0 nas lvm2 a-- 23.98g 19.10g
/dev/vda2 vg_pc6 lvm2 a-- 39.51g 0
查看卷组状态
[root@pc10 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
nas 1 1 0 wz--n- 23.98g 19.10g
vg_pc6 1 2 0 wz--n- 39.51g 0
[root@pc10 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_pc6/lv_root
LV Name lv_root
VG Name vg_pc6
LV UUID u0yl4k-8Qcr-5tXh-y26M-xBps-7qYe-AOfwIa
LV Write Access read/write
LV Creation host, time pc6, 2014-03-20 05:46:09 -0400
LV Status available
# open 1
LV Size 35.57 GiB
Current LE 9106
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vg_pc6/lv_swap
LV Name lv_swap
VG Name vg_pc6
LV UUID OS71YL-4YFK-xRCx-qCEE-48hM-wse8-l3mSaO
LV Write Access read/write
LV Creation host, time pc6, 2014-03-20 05:46:43 -0400
LV Status available
# open 1
LV Size 3.94 GiB
Current LE 1008
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/nas/nas1
LV Name nas1
VG Name nas
LV UUID mpphEV-alkV-THHI-MVGM-DV3h-eAC1-At0KVI
LV Write Access read/write
LV Creation host, time pc10, 2014-06-13 03:53:27 -0400
LV Status unenable
# open 0
LV Size 4.88 GiB
Current LE 1250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 6144
Block device 253:2
[root@pc10 ~]# vgchange -ay /dev/nas
1 logical volume(s) in volume group "nas" now active
--- Logical volume ---
LV Path /dev/nas/nas1
LV Name nas1
VG Name nas
LV UUID mpphEV-alkV-THHI-MVGM-DV3h-eAC1-At0KVI
LV Write Access read/write
LV Creation host, time pc10, 2014-06-13 03:53:27 -0400
LV Status available
# open 0
LV Size 4.88 GiB
Current LE 1250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 6144
Block device 253:2
4.格式化并加载
[root@pc10 ~]# mkfs.ext4 /dev/nas/nas1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=384 blocks
320000 inodes, 1280000 blocks
64000 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1312817152
40 block groups
32768 blocks per group, 32768 fragments per group
8000 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@pc10 ~]# mount -t ext4 /dev/nas/nas1 /mnt/lvm/
[root@pc10 ~]# ll /mnt/lvm/
total 16
drwx------. 2 root root 16384 Jun 13 04:11 lost+found
[root@pc10 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_pc6-lv_root 36G 2.2G 32G 7% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/vda1 485M 32M 428M 7% /boot
/dev/mapper/nas-nas1 4.9G 138M 4.5G 3% /mnt/lv
5.给分区,扩增5g
[root@pc10 ~]# lvextend -L +5G /dev/nas/nas1
Extending logical volume nas1 to 9.88 GiB
Logical volume nas1 successfully resized
[root@pc10 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_pc6-lv_root 36G 2.2G 32G 7% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/vda1 485M 32M 428M 7% /boot
/dev/mapper/nas-nas1 4.9G 138M 4.5G 3% /mnt/lvm
[root@pc10 ~]# umount /dev/nas/nas1
[root@pc10 ~]# resize2fs /dev/nas/nas1
resize2fs 1.41.12 (17-May-2010)
Please run 'e2fsck -f /dev/nas/nas1' first.
[root@pc10 ~]# e2fsck -f /dev/nas/nas1
e2fsck 1.41.12 (17-May-2010)
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/nas/nas1: 11/320000 files (0.0% non-contiguous), 55366/1280000 blocks
[root@pc10 ~]# resize2fs /dev/nas/nas1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/nas/nas1 to 2590720 (4k) blocks.
The filesystem on /dev/nas/nas1 is now 2590720 blocks long.
[root@pc10 ~]# mount /dev/nas/nas1 /mnt/lvm/
[root@pc10 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_pc6-lv_root 36G 2.2G 32G 7% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/vda1 485M 32M 428M 7% /boot
/dev/mapper/nas-nas1 9.8G 139M 9.1G 2% /mnt/lvm
已经在增加了容量:)