Creating a new volume group, adding a disk to it and making it usable
Scan HBA for new LUN’s:
#echo ‘- – -‘ > /sys/class/scsi_host/hostX/scan
#fdisk /dev/sda5 (or /dev/mapper/mpathx if multipathing) … create new partition, type lvm (8e), write changes to disk
#partprobe
#pvscan
#pvdisplay
#kpartx -a /dev/mapper/mpathX if it’s a multipathed device using dm-mulipath, otherwise skip this step
#pvcreate /dev/sda5 or /dev/mapper/mpathXpX (initializes partition for LVM)
#vgcreate vg02 /dev/sda5 or /dev/mapper/mpathXpX (or vgextend vg02 /dev/sda5 or /dev/mapper/mpathXpX to add to a volume group)
#lvcreate -L 500G -n lvora_backup vg02 (or lvextend to add)
#mkfs -V -t ext3 /dev/mapper/vg02-lvora_backup (or resize2fs to extend the fs)
#mount /dev/mapper/vg02-lvora_backup /ora_backup
edit /etc/fstab:
/dev/vg02/lvora_backup /ora_backup ext3 defaults 1 2
Extending a logical volume if the vg has available space
lvextend -L +512M /dev/rootvg/lvtmp
resize2fs /dev/rootvg/lvtmp (If it’s ext3, if not then use your specific filesystem tools)
If it’s GFS2, Find what it’s mounted as using cat /proc/mounts, we’ll look for /home3 in this example:
[root@linuxserver ~]# cat /proc/mounts |grep /home3
/dev/dm-54 /home3 gfs2 rw,noatime,nodiratime,hostdata=jid=0,localflocks,data=writeback 0 0
Next we’ll do a test run to make sure we don’t bugger anything up:
[root@linuxserver ~]# gfs2_grow -T /home3
(Test mode–File system will not be changed)
FS: Mount Point: /home3
FS: Device: /dev/dm-54
FS: Size: 31457278 (0x1dffffe)
FS: RG size: 65535 (0xffff)
DEV: Size: 51132416 (0x30c3800)
The file system grew by 76856MB.
gfs2_grow complete.
Looks good, let’s run it without the -T flag:
[root@linuxserver ~]# gfs2_grow /home3
FS: Mount Point: /home3
FS: Device: /dev/dm-54
FS: Size: 31457278 (0x1dffffe)
FS: RG size: 65535 (0xffff)
DEV: Size: 51132416 (0x30c3800)
The file system grew by 76856MB.
gfs2_grow complete.
Der Autor ist ein Held und sollte Bücher schreiben.