Grow Multipath Block Device

From LUG
Revision as of 12:26, 3 January 2018 by Dawes001 (talk | contribs) (Created page with "= Enlarging a multipath device = multipath -ll should show you: <code># multipath -ll san4_Data</code> <nowiki>san4_Data (360002ac00000000000000dfa00004ca6) dm-3 3PARdata,V...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Enlarging a multipath device

multipath -ll should show you:

# multipath -ll san4_Data

san4_Data (360002ac00000000000000dfa00004ca6) dm-3 3PARdata,VV             
size=250G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 0:0:1:2 sdb 8:16  active ready running
  `- 1:0:1:2 sdg 8:96  active ready running

Or possibly, after peer persistence:

san4_Data (360002ac000000000000003bb0000d16e) dm-9 3PARdata,VV
size=1.5T features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 0:0:1:2 sdg 8:96  active ready running
| `- 1:0:1:2 sdq 65:0  active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  |- 0:0:0:2 sdb 8:16  active ghost running
  `- 1:0:0:2 sdl 8:176 active ghost running

Also, dmsetup should give you something like this:

# dmsetup status san4_Data

0 524288000 multipath 2 0 1 0 1 1 A 0 2 0 8:16 A 0 8:96 A 0

One way to do this is to rescan the partition table for each device:

# blockdev --rereadpt /dev/sdg

But by far the quickest method is to rescan each SCSI device from the kernel. This is done with:

# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan

Either way, once the capacity changes you should see this in dmesg: # dmesg

</nowiki>[4849955.387134] sdg: detected capacity change from 214748364800 to 322122547200</nowiki>

Having trouble? Try rescanning the entire scsi bus again with: # echo "- - -" > /sys/class/scsi_host/host1/scan

Once you see the dmesg line, then resize the path in multipathd with:

# multipathd -k"resize multipath san4_Data"

Once that's done, multipath will now report the larger size:

# multipath -ll san4_Data

san4_Data (360002ac00000000000000dfa00004ca6) dm-3 3PARdata,VV             
size=350G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 0:0:1:2 sdb 8:16  active ready running
  `- 1:0:1:2 sdg 8:96  active ready running

Now you can proceed to enlarge the upper level components, the Physical Volume, and/or the filesystem:

# pvresize /dev/mapper/san4_Data

  Physical volume "/dev/dm-10" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

# lvresize /dev/mapper/Vsan4-Ldata -l +100%FREE

  Extending logical volume Vsan4/Ldata to 350.00 GB
  Logical volume Ldata successfully resized

Lastly, resize the filesystem. First example, ext4:

# resize2fs /dev/mapper/Vsan4-Ldata

resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/Vsan4-Ldata is mounted on /san4; on-line resizing required
Performing an on-line resize of /dev/mapper/Vsan4-Ldata to 30145536 (4k) blocks.
The filesystem on /dev/mapper/Vsan4-Ldata is now 30145536 blocks long.

Or for XFS:

# xfs_growfs /dev/mapper/Vsan4-Ldata

meta-data=/dev/mapper/Vsan4-Ldata  isize=256    agcount=16, agsize=3276796 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=52428736, imaxpct=25
         =                       sunit=4      swidth=4096 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=25600, version=2
         =                       sectsz=512   sunit=4 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 52428736 to 78643200

# df -h /san4

Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/Vsan4-Ldata      350G  185G   66G  74% /san4