To detect new Logical Unit Numbers (LUNs) on a Linux system, you can use several methods depending on your storage configuration, including SCSI, Fibre Channel, or iSCSI. Here are the general steps to detect and configure new LUNs:
- Scan for New LUNs:
- For SCSI Devices (e.g., SAS or SATA): Use the
rescan-scsi-buscommand to rescan the SCSI bus for new devices. You may need to install thesg3_utilspackage if it’s not already installed.bashCopy codesudo rescan-scsi-bus - For Fibre Channel Devices (FC): You can use the
rescan-scsi-bus.shscript, which is often available on Linux systems for rescanning the SCSI bus. Run it with the-aflag to scan all HBAs (Host Bus Adapters) or specify the HBA number.sudo rescan-scsi-bus.sh -a - For iSCSI Devices: To detect new iSCSI LUNs, you need to rescan the iSCSI target. This typically involves using the
iscsiadmcommand:sudo iscsiadm -m discovery -t st -p <target_IP_or_hostname> sudo iscsiadm -m node -L all
- For SCSI Devices (e.g., SAS or SATA): Use the
- Check for New Devices:After rescanning the bus or targets, you can check for the new devices that have been detected by examining the
/sys/class/scsi_device/directory. You can list the devices by running:bashCopy codels /sys/class/scsi_device/Each subdirectory corresponds to a SCSI device. - Rescan Partitions:If the newly detected devices include disk partitions, you should rescan the partitions to make them available. You can do this by running:
partprobe - Verify and Mount New LUNs:Once the new LUNs are detected, you should be able to use tools like
lsblk,fdisk, orpartedto verify the presence of new disks. For example:bashCopy codelsblk fdisk -lIf you find new disks, you can create partitions and mount them as needed. Make sure to update your/etc/fstabfile to ensure the mounts persist across reboots. - Update Multipathing (if applicable):If you’re using multipathing for redundancy, you may need to update the multipath configuration to include the new LUNs. This typically involves editing the
/etc/multipath.conffile and runningmultipath -v2to refresh the multipath devices. - Configure and Format:If the new LUNs are blank or need to be reformatted, use tools like
mkfsto format them with the desired filesystem (e.g., ext4 or XFS).
Remember that detecting and configuring new LUNs may vary based on your specific storage and Linux distribution. Always consult your storage and system documentation for any distribution-specific steps or tools to use. Additionally, ensure you have backups and take precautions when making changes to storage configurations to prevent data loss.