mercredi 16 septembre 2015

LVM pour les gros nuls

Créer un nouveau disque

[root@srvfratoulin06 apacheds-2]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa3f45d69.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2871, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2871, default 2871):
Using default value 2871

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


Extension du volume Virtuel

[root@srvfratoulin06 apacheds-2]# vgextend vg_frqtoulinsrv06 /dev/sdb1
  Volume group "vg_frqtoulinsrv06" successfully extended

Extension du Volume Logique 

[root@srvfratoulin06 apacheds-2]# lvextend -l  100%FREE /dev/vg_frqtoulinsrv06/lv_root
  Size of logical volume vg_frqtoulinsrv06/lv_root changed from 13.91 GiB (3561 extents) to 21.99 GiB (5629 extents).
  Logical volume lv_root successfully resized


Propager les modification sur le filesystem (Autrement on ne voit rien sur le df) 

[root@srvfratoulin06 apacheds-2]# resize2fs /dev/vg_frqtoulinsrv06/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_frqtoulinsrv06/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_frqtoulinsrv06/lv_root to 5764096 (4k) blocks.
The filesystem on /dev/vg_frqtoulinsrv06/lv_root is now 5764096 blocks long.