Sig-I/O (Posts about resize)https://sig-io.nl/categories/resize.atom2023-05-25T20:58:02ZMark JanssenNikolaOnline resizing of multipath devices in Linux dm-multipathhttps://sig-io.nl/posts/online-resizing-of-multipath-devices-in-linux-dm-multipath/2011-04-07T23:26:24+02:002011-04-07T23:26:24+02:00Mark Janssen<p>Linux doesn’t automatically re-size multipath devices, so this procedure must be used to have online re-sizing of multipath. (Offline re-size is automatic, just remove the mapping and reload)</p>
<ul class="simple">
<li><p>this example will use multipath device /dev/mpath/testdisk, with scsi disks /dev/sdx and /dev/sdy</p></li>
<li><p>Resize the lun on the underlying storage layer (iscsi / san)</p></li>
<li><p>Check which sd? devices are relevant, and re-scan these:</p>
<ul>
<li><p>multipath -ll testdisk</p></li>
<li><p>blockdev –rereadpt /dev/sdx</p></li>
<li><p>blockdev –rereadpt /dev/sdy</p></li>
<li><p>blockdev –getsz /dev/sdx</p></li>
<li><p>blockdev –getsz /dev/sdy</p></li>
</ul>
</li>
<li><p>Take note of the new size returned by getsz.</p></li>
<li><p>Dump the dmsetup table to a file (and a backup)</p>
<ul>
<li><p>dmsetup table testdisk | tee mapping.bak mapping.cur</p></li>
</ul>
</li>
<li><p>Edit the table stored in ‘mapping.cur’</p>
<ul>
<li><p>vi mapping.cur, replace field 2 (size) with the new size from getsz</p></li>
</ul>
</li>
<li><p>Suspend I/O, reread the table, and resume I/O</p>
<ul>
<li><p>dmsetup suspend testdisk; dmsetup reload testdisk mapping.cur; dmsetup resume testdisk</p></li>
</ul>
</li>
<li><p>The multipath device should now be resized:</p></li>
<li><p>multipath -ll</p></li>
</ul>
<p>You can now resize the filesystem on the multipath device, or the LVM-PV if you use LVM on the LUN.</p>