Add new disk ( RAID 1 ) and extend capaticy ( LVM )


[root@01-ovm ~]# umount /home/

[root@01-ovm ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               ovm
  PV Size               929.37 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              237917
  Free PE               2
  Allocated PE          237915
  PV UUID               Dc6XFm-Y1bt-SKDR-GP0b-7VuU-2OEF-zHmj8E

  
[root@01-ovm ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

[root@01-ovm ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               ovm
  PV Size               929.37 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              237917
  Free PE               2
  Allocated PE          237915
  PV UUID               Dc6XFm-Y1bt-SKDR-GP0b-7VuU-2OEF-zHmj8E
  
  "/dev/sdb1" is a new physical volume of "930.39 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name              
  PV Size               930.39 GiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               2tQuA7-1zun-d799-L86F-96z8-6k8Q-FKBFpT
  
[root@01-ovm ~]# vgdisplay
  --- Volume group ---
  VG Name               ovm
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               929.36 GiB
  PE Size               4.00 MiB
  Total PE              237917
  Alloc PE / Size       237915 / 929.36 GiB
  Free  PE / Size       2 / 8.00 MiB
  VG UUID               vBEcvK-33rW-owxL-qLUE-cG0L-c0xK-tUNwSV
  
[root@01-ovm ~]# vgdisplay ovm
  --- Volume group ---
  VG Name               ovm
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               929.36 GiB
  PE Size               4.00 MiB
  Total PE              237917
  Alloc PE / Size       237915 / 929.36 GiB
  Free  PE / Size       2 / 8.00 MiB
  VG UUID               vBEcvK-33rW-owxL-qLUE-cG0L-c0xK-tUNwSV
  
[root@01-ovm ~]# vgextend ovm /dev/sdb1
  Volume group "ovm" successfully extended

[root@01-ovm ~]# vgdisplay
  --- Volume group ---
  VG Name               ovm
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               1.82 TiB
  PE Size               4.00 MiB
  Total PE              476096
  Alloc PE / Size       237915 / 929.36 GiB
  Free  PE / Size       238181 / 930.39 GiB
  VG UUID               vBEcvK-33rW-owxL-qLUE-cG0L-c0xK-tUNwSV
  
[root@01-ovm ~]# lvextend -l 100%VG /dev/mapper/ovm-home
  Size of logical volume ovm/home changed from 681.13 GiB (174370 extents) to 1.57 TiB (412551 extents).
  Logical volume home successfully resized

[root@01-ovm ~]# mount -a

[root@01-ovm ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ovm-root   40G  9.6G   28G  26% /
tmpfs                 3.7G     0  3.7G   0% /dev/shm
/dev/sda1             1.1G   63M  918M   7% /boot
/dev/mapper/ovm-home  671G  272G  365G  43% /home

  
[root@01-ovm ~]# lvdisplay /dev/ovm/home
  --- Logical volume ---
  LV Path                /dev/ovm/home
  LV Name                home
  VG Name                ovm
  LV UUID                RPwrDG-nspM-uCWZ-gN9I-J2jp-BR4D-H63yq1
  LV Write Access        read/write
  LV Creation host, time 01-ovm.ainosi.com, 2015-12-29 05:09:04 +0700
  LV Status              available
  # open                 0
  LV Size                1.57 TiB
  Current LE             412551
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:3
  
[root@01-ovm ~]# resize2fs /dev/mapper/ovm-home
resize2fs 1.43-WIP (20-Jun-2013)
Please run 'e2fsck -f /dev/mapper/ovm-home' first.

[root@01-ovm ~]# e2fsck -f /dev/mapper/ovm-home
e2fsck 1.43-WIP (20-Jun-2013)
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/mapper/ovm-home: 73/44646400 files (5.5% non-contiguous), 73995131/178554880 blocks

[root@01-ovm ~]# resize2fs /dev/mapper/ovm-home
resize2fs 1.43-WIP (20-Jun-2013)
Filesystem at /dev/mapper/ovm-home is mounted on /home; on-line resizing required
old_desc_blocks = 43, new_desc_blocks = 101
The filesystem on /dev/mapper/ovm-home is now 422452224 blocks long.

[root@01-ovm ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdb (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

[root@01-ovm ~]# mount -a

[root@01-ovm ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ovm-root   40G  9.6G   28G  26% /
tmpfs                 3.7G     0  3.7G   0% /dev/shm
/dev/sda1             1.1G   63M  918M   7% /boot
/dev/mapper/ovm-home  1.6T  272G  1.3T  18% /home
  
and this was before :
[root@01-ovm ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ovm-root   40G  9.6G   28G  26% /
tmpfs                 3.7G     0  3.7G   0% /dev/shm
/dev/sda1             1.1G   63M  918M   7% /boot
/dev/mapper/ovm-home  671G  272G  365G  43% /home





http://rgheck.blogspot.co.id/2012/07/how-to-add-to-lvm-drive.html

No comments:

Post a Comment