LVM-HOWTO/学习笔记(二)

  

1.         3scsi磁盘上创建lv

Run pvcreate on the disks

# pvcreate /dev/sda

# pvcreate /dev/sdb

# pvcreate /dev/sdc

Create a volume group

# vgcreate my_volume_group /dev/sda /dev/sdb /dev/sdc/

 

Run vgdisplay to verify volume group

# vgdisplay

# vgdisplay

--- Volume Group ---

VG Name               my_volume_group

VG Access             read/write

VG Status             available/resizable

VG #                  1

MAX LV                256

Cur LV                0

Open LV               0

MAX LV Size           255.99 GB

Max PV                256

Cur PV                3

Act PV                3

VG Size               1.45 GB

PE Size               4 MB

Total PE              372

Alloc PE / Size       0 / 0

Free  PE / Size       372/ 1.45 GB

VG UUID               nP2PY5-5TOS-hLx0-FDu0-2a6N-f37x-0BME0Y

 

创建lv

# lvcreate -L1G -nmy_logical_volume my_volume_group
lvcreate -- doing automatic backup of "my_volume_group"
    
lvcreate -- logical volume "/dev/my_volume_group/my_logical_volume" successfully created

创建文件系统

# mke2fs /dev/my_volume_group/my_logical_volume
mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
    
Filesystem label=
    
OS type: Linux
    
Block size=4096 (log=2)
    
Fragment size=4096 (log=2)
    
131072 inodes, 262144 blocks
    
13107 blocks (5.00%) reserved for the super user
    
First data block=0
    
9 block groups
    
32768 blocks per group, 32768 fragments per group
    
16384 inodes per group
    
Superblock backups stored on blocks:
    
        32768, 98304, 163840, 229376
    

    
      
    
Writing inode tables: done
    
Writing superblocks and filesystem accounting information: done

测试文件系统

Mount the logical volume and check to make sure everything looks correct

# mount /dev/my_volume_group/my_logical_volume /mnt

# df

Filesystem           1k-blocks      Used Available Use% Mounted on

/dev/hda1              1311552    628824    616104  51% /

/dev/my_volume_group/my_logical_volume

                       1040132        20    987276   0% /mnt

 

2.         3scsi磁盘上创建条带化的lv

Run pvcreate on the disks:

# pvcreate /dev/sda

# pvcreate /dev/sdb

# pvcreate /dev/sdc

Create a volume group

# vgcreate my_volume_group /dev/sda /dev/sdb /dev/sdc

             

Run vgdisplay to verify volume group

# vgdisplay

--- Volume Group ---

VG Name               my_volume_group

VG Access             read/write

VG Status             available/resizable

VG #                  1

MAX LV                256

Cur LV                0

Open LV               0

MAX LV Size           255.99 GB

Max PV                256

Cur PV                3

Act PV                3

VG Size               1.45 GB

PE Size               4 MB

Total PE              372

Alloc PE / Size       0 / 0

Free  PE / Size       372/ 1.45 GB

VG UUID               nP2PY5-5TOS-hLx0-FDu0-2a6N-f37x-0BME0Y

 

The logical volume will be a striped set using for the 4k stripe size. This should increase the performance of the logical volume

# lvcreate -i3 -I4 -L1G -nmy_logical_volume my_volume_group
lvcreate -- rounding 1048576 KB to stripe boundary size 1056768 KB / 258 PE
    
lvcreate -- doing automatic backup of "my_volume_group"
    
lvcreate -- logical volume "/dev/my_volume_group/my_logical_volume" successfully created

Note

 

If you create the logical volume with a '-i2' you will only use two of the disks in your volume group. This is useful if you want to create two logical volumes out of the same physical volume, but we will not touch that in this recipe.

创建文件系统

# mke2fs /dev/my_volume_group/my_logical_volume
mke2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09
    
Filesystem label=
    
OS type: Linux
    
Block size=4096 (log=2)
    
Fragment size=4096 (log=2)
    
132192 inodes, 264192 blocks
    
13209 blocks (5.00%) reserved for the super user
    
First data block=0
    
9 block groups
    
32768 blocks per group, 32768 fragments per group
    
14688 inodes per group
    
Superblock backups stored on blocks:
    
        32768, 98304, 163840, 229376
    

    
      
    
Writing inode tables: done
    
Writing superblocks and filesystem accounting information: done

查看文件系统

mount /dev/my_volume_group/my_logical_volume /mnt

              

and check to make sure everything looks correct

# df

Filesystem           1k-blocks      Used Available Use% Mounted on

/dev/hda1              1311552    628824    616104  51% /

/dev/my_volume_group/my_logical_volume

                       1040132        20    987276   0% /mnt

         

 

 

你可能感兴趣的:(职场,学习笔记,lvm,howto,休闲)