First, we create a little script to scan for the new iSCSI disk (alternatively, you can reboot the server)

[root@RHEL tmp]# nano iscsi_rescan.sh

for BUS in /sys/class/scsi_host/host*/scan
do
   echo "- - -" >  ${BUS}
done

[root@RHEL tmp]# chmod +x iscsi_rescan.sh
[root@RHEL tmp]# ./iscsi_rescan.sh

Now, let’s create the new partition

[root@RHEL tmp]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.

[root@RHEL tmp]# vgcreate  backup_vg /dev/sdb
  Volume group "backup_vg" successfully created

[root@RHEL tmp]# vgdisplay backup_vg | grep "Free"
  Free  PE / Size       314572 / <1.20 TiB

[root@RHEL tmp]# lvcreate -L1.19TiB -n backup_lv backup_vg
  Rounding up size to full physical extent 1.19 TiB
  Logical volume "backup_lv" created.

We format the new partition to xfs

[root@RHEL tmp]# mkfs.xfs /dev/backup_vg/backup_lv
meta-data=/dev/backup_vg/backup_lv isize=512    agcount=4, agsize=79859712 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=319438848, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=155976, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Finally, we mount the new partition, using fstab

[root@RHEL tmp]# mkdir /backup

[root@RHEL tmp]# nano /etc/fstab
/dev/backup_vg/backup_lv   /backup                   xfs     defaults        0 0

[root@RHEL tmp]# mount -a

Leave a Reply