Scan for new FC volume in Linux (RHEL/CentOS/OEL)

Sometimes we need to map new DISK/LUN from SAN Storage to a running Linux Server (RHEL/CentOS/OEL) and we need to make new filesystem on it or extend an existing LVM VG or LV partition.

Following activities are required:

First of all collect information about the host -

uname -a (running kernel version)

cat /etc/redhat-release (exact version of OS)

fdisk -l (existing disks & partitions)

blkid (identify existing block devices and information like UUID, Filesystem Type etc)

lsblk (identify disks & partitions in a tree like format)

ls -alrth /sys/class/fc_host/ (identify no of FC HBAs in the system)

pvdisplay (lists LVM PV devices)

vgdisplay (lists LVM Volume Groups)

lvdisplay (lists LVM partitions)

Next Step - Scan the HBAs to identify new LUNs mapped to this host server:

echo "1" > /sys/class/fc_host/host1/issue_lip
echo "1" > /sys/class/fc_host/host2/issue_lip
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan

Adjust the "host1" or "host2" in above commands as per output from "ls -alrth /sys/class/fc_host/"
Then check if new disk is showing in "fdisk -l" output -
for example -
fdisk -l

Disk /dev/sda: 145.9 GB, 145999527936 bytes
255 heads, 63 sectors/track, 17750 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       17750   142472452+  8e  Linux LVM

Disk /dev/sdb: 579.8 GB, 579820584960 bytes
255 heads, 63 sectors/track, 70492 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
 
--> we can see "/dev/sdb" is a blank disk of 579.8 GB in size. Crosscheck the disk size with storage team.
 
Next Step - create partition in this new disk:
 
fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 61440.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-61440, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-61440, default 61440):
Using default value 61440

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@DB-NODE-1 ~]# partprobe 

Final Step:

you can now format the partition and mount -

mkfs.ext4 /dev/adb1

mkdir /newmount

mount /dev/sdb1 /newmount

Note:
Its advisable to use blkid to check for the UUID of new partition and use that to mount the new volume in /etc/fstab

Comments

Popular posts from this blog

Access Oracle OCI Object Storage through GUI Client

Instance OS Baseline Configuration Runbook

Accessing OCI Compute Instances Using VNC Console (Instance Console Connection)