Skip to content

Instantly share code, notes, and snippets.

@hunzo
Last active April 20, 2022 09:22
Show Gist options
  • Save hunzo/1828cece7f5f8992a6eb14fb818a2e2e to your computer and use it in GitHub Desktop.
Save hunzo/1828cece7f5f8992a6eb14fb818a2e2e to your computer and use it in GitHub Desktop.

iSCSI config example

ref.

https://www.server-world.info/en/note?os=Ubuntu_21.04&p=iscsi&f=3
https://linoxide.com/how-to-backup-lvm-configuration-on-linux/

Config iSCSI

  • install
apt -y install open-iscsi

Edit /etc/iscsi/iscsid.conf

vi /etc/iscsi/iscsid.conf
# line 59 : uncomment
node.session.auth.authmethod = CHAP
# line 70,71: uncomment and specify the username and password you set on the iSCSI target server
node.session.auth.username = username
node.session.auth.password = password

Login iSCSI

iscsiadm -m discovery -t sendtargets -p 10.10.11.96
iscsiadm --mode node --targetname iqn.2004-04.com.qnap:ts-ec1280u:iscsi.pocbackup.26c32c --portal 10.10.11.96:3260 --login
iscsiadm --mode node --targetname iqn.2004-04.com.qnap:ts-ec1280u:iscsi.pocbackup.26c32c --portal 10.10.11.96:3260 --logout

iscsiadm --mode node -o delete
iscsiadm --mode node -o show
iscsiadm -m session -o show

Parted

parted /dev/sdb
(parted) mklabel GPT
(parted) mkpart primary 2048s 100%
(parted) q

LVM config

Add Disk-01:

pvcreate /dev/sdb1
vgcreate data-iscsi-vg /dev/sdb1
lvcreate -l 100%FREE -n backup-iscsi-lv data-iscsi-vg
mkfs.xfs /dev/data-iscsi-vg/backup-iscsi-lv
mount /dev/data-iscsi-vg/backup-iscsi-lv /test-backup/

Add Disk-02:

pvcreate /dev/sdd1
vgextend data-iscsi-vg /dev/sdd1
lvextend -l +100%FREE /dev/data-iscsi-vg/backup-iscsi-lv

Extend Storage

xfs_growfs /test-backup

Backup LVM config

vgcfgbackup -f  test_vg_config_bkk data-iscsi-vg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment