LVM磁盘划分

iZ94n1h2di9Z:~ # fdisk -l

Disk /dev/hda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008620d

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *        2048    41943039    20970496   83  Linux

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

Disk /dev/xvdb doesn't contain a valid partition table

Disk /dev/xvdc: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders, total 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvdc doesn't contain a valid partition table
iZ94n1h2di9Z:~ # pvcreate /dev/xvdb
  Physical volume "/dev/xvdb" successfully created
iZ94n1h2di9Z:~ # pvdisplay 
  "/dev/xvdb" is a new physical volume of "500.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/xvdb
  VG Name               
  PV Size               500.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               vbM8CY-hIr8-qa7V-bMr3-77fI-yyAv-6RI1aF
   
iZ94n1h2di9Z:~ # vgcreate vgdisk /dev/xvdb
  Volume group "vgdisk" successfully created
iZ94n1h2di9Z:~ # vgdisplay 
  --- Volume group ---
  VG Name               vgdisk
  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               SL5E0Z-B9hZ-xLWK-1OSP-C8hQ-8AIO-R7CaGC
   
iZ94n1h2di9Z:~ # lv create -L 100G -n app vgdisk
If 'lv' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found lv
-bash: lv: command not found
iZ94n1h2di9Z:~ # lvcreate -L 100G -n app vgdisk
  Logical volume "app" created
iZ94n1h2di9Z:~ # lvcreate -L 380G -n data vgdisk
  Logical volume "data" created
iZ94n1h2di9Z:~ # lvdisplay 
  --- Logical volume ---
  LV Name                /dev/vgdisk/app
  VG Name                vgdisk
  LV UUID                uvRr5M-SAiV-B9A3-r3ei-F59D-lX39-XxrifI
  LV Write Access        read/write
  LV Creation host, time iZ94n1h2di9Z, 2015-11-25 19:52:45 +0800
  LV Status              available
  # open                 0
  LV Size                100.00 GiB
  Current LE             25600
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           252:0
   
  --- Logical volume ---
  LV Name                /dev/vgdisk/data
  VG Name                vgdisk
  LV UUID                W4f5wT-QuGc-gike-FRws-ocNI-vOEr-cjlmKl
  LV Write Access        read/write
  LV Creation host, time iZ94n1h2di9Z, 2015-11-25 19:53:39 +0800
  LV Status              available
  # open                 0
  LV Size                380.00 GiB
  Current LE             97280
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           252:1
   
iZ94n1h2di9Z:~ # cd /home
iZ94n1h2di9Z:/home # ls
iZ94n1h2di9Z:/home # cd /data
-bash: cd: /data: No such file or directory
iZ94n1h2di9Z:/home # cd /
iZ94n1h2di9Z:/ # mkdir data
iZ94n1h2di9Z:/ # cd /data
iZ94n1h2di9Z:/data # ls
iZ94n1h2di9Z:/data # mkfs -t xfs /dev/vgdisk/app
meta-data=/dev/vgdisk/app        isize=256    agcount=4, agsize=6553600 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=26214400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
iZ94n1h2di9Z:/data # mkfs -t xfs /dev/vgdisk/data
meta-data=/dev/vgdisk/data       isize=256    agcount=4, agsize=24903680 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=99614720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=48640, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
iZ94n1h2di9Z:/data # mount /dev/vgdisk/app /home
iZ94n1h2di9Z:/data # mount /dev/vgdisk/data /data
iZ94n1h2di9Z:/data # df -k
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/hda1                20641404 2227356  17365524  12% /
udev                      4095364     128   4095236   1% /dev
tmpfs                     4095364     220   4095144   1% /dev/shm
/dev/mapper/vgdisk-app  104806400   32928 104773472   1% /home
/dev/mapper/vgdisk-data 398264320   32928 398231392   1% /data
iZ94n1h2di9Z:/data # mkfs -t xfs /dev/xvdc
meta-data=/dev/xvdc              isize=256    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
iZ94n1h2di9Z:/data # cd /
iZ94n1h2di9Z:/ # mkdir db
iZ94n1h2di9Z:/ # mount /dev/xvdc /db
iZ94n1h2di9Z:/ # df -k
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/hda1                20641404 2227360  17365520  12% /
udev                      4095364     128   4095236   1% /dev
tmpfs                     4095364     220   4095144   1% /dev/shm
/dev/mapper/vgdisk-app  104806400   32928 104773472   1% /home
/dev/mapper/vgdisk-data 398264320   32928 398231392   1% /data
/dev/xvdc                52403200   32928  52370272   1% /db
iZ94n1h2di9Z:/ # 

 

最后将挂载信息写入挂载表,系统启动时自动挂载

/dev/hda1            /                    ext3       acl,user_xattr        1 1
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/vgdisk/app      /home                xfs        rw                    0 0
/dev/vgdisk/data     /data                xfs        rw                    0 0
/dev/xvdc            /db                  xfs        rw                    0 0

 

你可能感兴趣的:(LVM磁盘划分)