ISCSI: Difference between revisions
Line 34: | Line 34: | ||
mkfs.ext4 /dev/sda1 | mkfs.ext4 /dev/sda1 | ||
(what disk filesystem you use depends on need, but assuming backup etc. is taken care of, EXT4 probably best all-round performance option) | (what disk filesystem you use depends on need, but assuming backup etc. is taken care of, EXT4 probably best all-round performance option) | ||
''NB if using ext4, the defaults leave 5% of space reserved for root operations. If the volume is for use for data storage, then you should reduce this with | |||
tune2fs -m 1 /dev/sda1 | |||
To ensure your iscsi volume is available on reboot | To ensure your iscsi volume is available on reboot |
Revision as of 05:32, 29 April 2017
Information in configuring open-iscsi by clients (not to become a storage provider)
Setup and initial configuration
Install
apt-get install open-iscsi
This should create your unique initiator name which if you need to configure access control on the iscsi server you can get by
tail -n1 /etc/iscsi/initiatorname.iscsi
Once you know there is a volume available for use with the server being configured use
iscsiadm -m discovery -t sendtargets -p portal.ip.add.ress
NB portal IP address may not be the same address as used for managing the SAN
to get the name of the volume available to the server. This will be in the form of
storage.ip.add.ress:port,1 uniqueinitiatornameofstorage-volumename
Depending on the storage server, the initiator name can be quite long, but you just need to be able to cut and paste parts into the next command:
iscsiadm -m node -T uniqueinitiatornameofstorage-volumename -p storage.ip.add.ress:port -l
The iscsi volume should now be available as a disk device to be managed by the OS. Check by
ls /dev/disk/by-path/
The output will tell you what disk device to address e.g.
# ls -l /dev/disk/by-path/ total 0 lrwxrwxrwx 1 root root 9 Nov 1 16:38 ip-storage.ip.add.ress:3260-uniqueinitiatornameofstorage-volumename-lun-0 -> ../../sda
where sda is the key element. Using that information create a volume on the drive:
parted /dev/sda
Then create a filesystem as needed
mkfs.ext4 /dev/sda1
(what disk filesystem you use depends on need, but assuming backup etc. is taken care of, EXT4 probably best all-round performance option)
NB if using ext4, the defaults leave 5% of space reserved for root operations. If the volume is for use for data storage, then you should reduce this with
tune2fs -m 1 /dev/sda1
To ensure your iscsi volume is available on reboot
vi /etc/iscsi/iscsid.conf
and set
node.startup = automatic
Then edit the settings for your iscsi node
vi /etc/iscsi/nodes/uniqueinitiatornameofstorage-volumename/ip-storage.ip.add.ress,3260,1/default
and set
node.conn[0].startup = automatic
Note if you only have one iscsi volume on a server, there will only be one nodes subdirectory so Tab autocomplete is your friend.
Now mount the volume (note if this is to extend space in use you may need to mount the volume at a temporary location, move existing data and then remount at the desired permanent location. This best done with the UUID, which got created when the volume did.
mkdir /path/to/mymountpoint ls -l /dev/disk/by-uuid mount /dev/disk/by-uuid/youruuid /path/to/mymountpoint
Assuming success (best to test you can write to the mounted volume) next make the mount auto remount on reboot by
vi /etc/fstab
and appending a line of the form
UUID=youruuid /path/to/mymountpoint ext4 defaults,relatime,_netdev 0 0
for normal file stores, and
UUID=youruuid /path/to/mymountpoint ext4 defaults,noatime,_netdev 0 0
for backups (where noatime means access times are not recorded, which should preserve the accesstime from when the file was last accessed on the active store). Where a key option is _netdev, which tells the operating system not to try and mount this volume until the network is up.
Troubleshooting
Logging out of ISCSI sessions
If you need to logout of the iscsi storage to allow changes to the volume etc., unmount it and run
iscsiadm -m node -T uniqueinitiatornameofstorage-volumename -p storage.ip.add.ress:port -u
To logout of all just run
General information
To see all known nodes
iscsiadm -m node
To see current active sessions
iscsiadm -m session -P 3