Linux lvm 管理

[root@iZ23j4eax1iZ ~]# pvdisplay 
[root@iZ23j4eax1iZ ~]# fdisk -l

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078f9c

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1        2611    20970496   83  Linux

Disk /dev/xvdb: 1073.7 GB, 1073741824000 bytes
255 heads, 63 sectors/track, 130541 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/xvdc: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@iZ23j4eax1iZ ~]# pvcreate /dev/xvdc
  Physical volume "/dev/xvdc" successfully created
[root@iZ23j4eax1iZ ~]# pvdisplay 
  "/dev/xvdc" is a new physical volume of "500.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/xvdc
  VG Name               
  PV Size               500.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               sZ87zR-QwaO-5Ibi-2122-e2GK-B3tL-Y8SnuI
   
[root@iZ23j4eax1iZ ~]# vgcreate vg01 /dev/^C
[root@iZ23j4eax1iZ ~]# pvdisplay 
  "/dev/xvdc" is a new physical volume of "500.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/xvdc
  VG Name               
  PV Size               500.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               sZ87zR-QwaO-5Ibi-2122-e2GK-B3tL-Y8SnuI
   
[root@iZ23j4eax1iZ ~]# vgcreate vg01 /dev/xvdc 
  Volume group "vg01" successfully created
[root@iZ23j4eax1iZ ~]# vgdisplay 
  --- Volume group ---
  VG Name               vg01
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               500.00 GiB
  PE Size               4.00 MiB
  Total PE              127999
  Alloc PE / Size       0 / 0   
  Free  PE / Size       127999 / 500.00 GiB
  VG UUID               9QFqvp-mf6O-ovy2-HXXC-v7JM-0Fp3-buRZE2
   
[root@iZ23j4eax1iZ ~]# lvcreate -L 500G -n lv_data01 vg01
  Volume group "vg01" has insufficient free space (127999 extents): 128000 required.
[root@iZ23j4eax1iZ ~]# lvcreate -L 499G -n lv_data01 vg01
  Logical volume "lv_data01" created
[root@iZ23j4eax1iZ ~]# mk
mkdict            mkdumprd          mkfs              mkfs.ext3         mkfs.msdos        mkinitrd          mksock            
mkdir             mke2fs            mkfs.cramfs       mkfs.ext4         mkfs.vfat         mklost+found      mkswap            
mkdosfs           mkfifo            mkfs.ext2         mkfs.ext4dev      mkhomedir_helper  mknod             mktemp            
[root@iZ23j4eax1iZ ~]# mkfs
mkfs          mkfs.cramfs   mkfs.ext2     mkfs.ext3     mkfs.ext4     mkfs.ext4dev  mkfs.msdos    mkfs.vfat     
[root@iZ23j4eax1iZ ~]# mkfs.ext4 /dev/vg01/lv_data01 
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32702464 inodes, 130809856 blocks
6540492 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3992 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@iZ23j4eax1iZ ~]# mkdir /data01
[root@iZ23j4eax1iZ ~]# mount /dev/vg01/lv_data01 /data01
[root@iZ23j4eax1iZ ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             20G  1.5G   18G   8% /
tmpfs                 7.8G     0  7.8G   0% /dev/shm
/dev/mapper/vg01-lv_data01
                      492G  198M  467G   1% /data01
[root@iZ23j4eax1iZ ~]# vi /etc/rc.local 

你可能感兴趣的:(Linux lvm 管理)