LUN expansion on Linux host without a reboot
10:01 PM
Expanding a LUN on a Linux host is possible without a reboot but a maintenance window is required
If a single linux (MSDOS) partition exists, after the rescan, fdisk must be used to delete/recreate the partition with the new start/end blocks. (Remeber MAXIMUM 2TB filesystem limit)
Execute partprobe to tell the OS of partition changes.
echo 1 > /sys/block/sda/device/rescan
If these commands do not work then a reboot is required.
Each device that is used for the multipath map must be rescanned to detect the new LUN size and multipath restarted.
[size=50G][features=0][hwhandler=0][rw]
_ round-robin 0 [prio=2][active]
_ 0:0:0:3 sda 8:0 [active][ready]
_ 1:0:0:3 sdd 8:48 [active][ready]
e2fsck -f /dev/mapper/mpath3
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
echo 1 > /sys/block/sda/device/rescan
echo 1 > /sys/block/sdd/device/rescan
(detect capacity change)
dmesg
SCSI device sda: 419430400 512-byte hdwr sectors (214748 MB)
sda: Write Protect is off
sda: Mode Sense: 7f 00 10 08
SCSI device sda: drive cache: write back w/ FUA sda: detected capacity change from 53687091200 to 214748364800
SCSI device sdd: 419430400 512-byte hdwr sectors (214748 MB)
sde: Write Protect is off
sde: Mode Sense: 7f 00 10 08
SCSI device sdd: drive cache: write back w/ FUA sdd: detected capacity change from 53687091200 to 214748364800
sudo /sbin/service multipathd restart
mpath3 (350002ac0009b0ace) dm-0 3PARdata,VV
[size=200G][features=1 queue_if_no_path][hwhandler=0][rw]
_ round-robin 0 [prio=2][active]
_ 0:0:0:3 sda 8:0 [active][ready]
_ 1:0:0:3 sdd 8:48 [active][ready]
Once the host recognizes the new size of the LUN the filesystem can be checked again and resized.
If has a single linux partition, use fdisk to delete and recreate the linux partition. DO NOT MAKE ANY OTHER MODIFICATIONS TO THE PARTITION OR DATA COULD BE CORRUPTED (REMEMBER THE 2TB LIMIT)
fdisk /dev/mapper/mpath3
delete partition 1
create new primary partition 1 with starting and ending blocks using all available blocks.
write partition.
e2fsck -f /dev/mapper/mpath3
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/mpath3: 13/2562240 files (7.7% non-contiguous), 124671/214748364800 blocks
sudo /sbin/resize2fs /dev/mapper/mpath3 (do not specify a size to use all avalable LUN space)
resize2fs /dev/mapper/mpath3
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/mpath3 to 214748364800 (4k) blocks.
The filesystem on /dev/mapper/mpath3 is now 214748364800 blocks long.
LUN expansion on Linux host without a reboot (umount still required)
LUN expansion is possible without rebooting a RHEL 5/6 host after the storage team has expanded the LUN under the following conditions:
- A FULL backup of the LUN has been created before you start.
- The LUN does NOT have multiple linux partitions defined. (example: /dev/sdd1 /dev/sdd2 ) The 'linux' partition is actually an MSDOS partition.
If a single linux (MSDOS) partition exists, after the rescan, fdisk must be used to delete/recreate the partition with the new start/end blocks. (Remeber MAXIMUM 2TB filesystem limit)
Execute partprobe to tell the OS of partition changes.
- NOTE: partprobe does not work 100% of the time and a reboot may be required. if partprobe does not work some other commands may help to re-read the partition
echo 1 > /sys/block/sda/device/rescan
If these commands do not work then a reboot is required.
- If there are more than one partition on the LUN DO NOT use these procedures, it is better to start with a NEW LUN with a larger size and copy data.
The LUN must NOT be part of an LVM volume - The LUN must have an ext3/ext4 partition. Oracle OCFS2 partitions can also be expanded but are not covered here.
- Don't try this with Oracle RAW partitions.
Summary
The LUN must be umounted and the work performed during a maintenance window, The LUN integrity is checked with e2fsck -f and then increased with resize2fs.Each device that is used for the multipath map must be rescanned to detect the new LUN size and multipath restarted.
Determine what devices are the in the multipath map of the LUN you are working with.
Example: for mpath3, devices /dev/sda, /dev/sdd are used.
mpath3 (350002ac0009b0ace) dm-0 3PARdata,VV[size=50G][features=0][hwhandler=0][rw]
_ round-robin 0 [prio=2][active]
_ 0:0:0:3 sda 8:0 [active][ready]
_ 1:0:0:3 sdd 8:48 [active][ready]
umount the filesystem
umount /mountpoint (stop all access to the device by stopping services, killing processes, etc.)Force check the integrity of the unmounted filesystem
sudo /sbin/e2fsck -f /dev/mapper/mpath3e2fsck -f /dev/mapper/mpath3
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Rescan the devices to report the new sizes to the OS
Once the filesystem integrity is checked, Send an "1" to the devices to rescan for the new sizeecho 1 > /sys/block/sda/device/rescan
echo 1 > /sys/block/sdd/device/rescan
Confirm size changes
After the rescan commands are sent. check dmesg to confirm for device changes.(detect capacity change)
dmesg
SCSI device sda: 419430400 512-byte hdwr sectors (214748 MB)
sda: Write Protect is off
sda: Mode Sense: 7f 00 10 08
SCSI device sda: drive cache: write back w/ FUA sda: detected capacity change from 53687091200 to 214748364800
SCSI device sdd: 419430400 512-byte hdwr sectors (214748 MB)
sde: Write Protect is off
sde: Mode Sense: 7f 00 10 08
SCSI device sdd: drive cache: write back w/ FUA sdd: detected capacity change from 53687091200 to 214748364800
Restart multipathd
After the device has been rescanned, restart multipathd to display the new sizes for the multipath map.sudo /sbin/service multipathd restart
Confirm the new multipath map size.
sudo /sbin/multipath -llmpath3 (350002ac0009b0ace) dm-0 3PARdata,VV
[size=200G][features=1 queue_if_no_path][hwhandler=0][rw]
_ round-robin 0 [prio=2][active]
_ 0:0:0:3 sda 8:0 [active][ready]
_ 1:0:0:3 sdd 8:48 [active][ready]
Once the host recognizes the new size of the LUN the filesystem can be checked again and resized.
Recheck filesystem integrity
If the LUN has no linux partition, move onto Reconfirm filesystem integrityIf has a single linux partition, use fdisk to delete and recreate the linux partition. DO NOT MAKE ANY OTHER MODIFICATIONS TO THE PARTITION OR DATA COULD BE CORRUPTED (REMEMBER THE 2TB LIMIT)
fdisk /dev/mapper/mpath3
delete partition 1
create new primary partition 1 with starting and ending blocks using all available blocks.
write partition.
Reconfirm the integrity of the filesystem before expanding with resize2fs
sudo /sbin/e2fsck -f /dev/mapper/mpath3e2fsck -f /dev/mapper/mpath3
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/mpath3: 13/2562240 files (7.7% non-contiguous), 124671/214748364800 blocks
Resize the ext3/ext4 partition
Resize the ext3 partition with resize2fs to increase the size of the multipath map.sudo /sbin/resize2fs /dev/mapper/mpath3 (do not specify a size to use all avalable LUN space)
resize2fs /dev/mapper/mpath3
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/mpath3 to 214748364800 (4k) blocks.
The filesystem on /dev/mapper/mpath3 is now 214748364800 blocks long.
0 comments