Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
E: enquiries@precedence.co.uk
FS-ResizeGPT

Jump To: Support > KB > NetManager > FS? > ResizeGPT

Resize GPT disk

  1. Resize the underlying disk itself (e.g. on your hypervisor) - could also be an expanded RAID array
  2. Check existing filesystem size:
    netmanager 1# df -h /dev/dk1
    Filesystem         Size       Used      Avail %Cap Mounted on
    /dev/dk1           496G       407G        64G  86% /usr/export/data
    
  3. Find underlying drive, in this case xbd3:
    netmanager 2# dmesg |grep dk1
    dk1 at xbd3: data
    dk1: 1048575903 blocks at 64, type: ffs
    
  4. Find underlying drive size:
    netmanager 3# dmesg | grep ^xbd3
    xbd3 at xenbus0 id 51776: Xen Virtual Block Device Interface
    xbd3: using event channel 23
    xbd3: 750 GB, 512 bytes/sect x 1572864000 sectors
    xbd3: GPT GUID: cf9a3535-df2f-49c4-9366-1d5fba8a4843
    
  5. View GPT partition table on the underlying drive. Note the index number of the existing partition. Also note that there is no secondary table as the drive has been extended so the secondary table data is no longer at the end so cannot be found:
    netmanager 4# gpt show xbd3
           start        size  index  contents
               0           1         PMBR
               1           1         Pri GPT header
               2          32         Pri GPT table
              34          30
              64  1048575903      1  GPT part - NetBSD FFSv1/FFSv2
      1048575967   524288033
    
  6. Resize GPT partition table for new disk size and check secondary table is now there:
    netmanager 5# gpt resizedisk xbd3
    netmanager 6# gpt show xbd3
           start        size  index  contents
               0           1         PMBR
               1           1         Pri GPT header
               2          32         Pri GPT table
              34          30
              64  1048575903      1  GPT part - NetBSD FFSv1/FFSv2
      1048575967   524288000
      1572863967          32         Sec GPT table
      1572863999           1         Sec GPT header
    
  7. Resize partition itself using the index number determined earlier (in this case 1):
    netmanager 7# gpt resize -i 1 xbd3
    Partition 1 resized, use:
            dkctl xbd3 addwedge <wedgename> 64 1572863903 <type>
    to create a wedge for it
    netmanager 8# gpt show xbd3
           start        size  index  contents
               0           1         PMBR
               1           1         Pri GPT header
               2          32         Pri GPT table
              34          30
              64  1572863903      1  GPT part - NetBSD FFSv1/FFSv2
      1572863967          32         Sec GPT table
      1572863999           1         Sec GPT header
    
  8. Umount filesystem:
    netmanager 9# umount /usr/export/data
    
  9. Rescan disk and update wedge data. Note how dk1 has changed size from 1048575903 to 1572863903:
    netmanager 10# dkctl xbd3 listwedges
    /dev/rxbd3d: 1 wedge:
    dk1: data, 1048575903 blocks at 64, type: ffs
    netmanager 11# dkctl xbd3 makewedges
    successfully scanned /dev/rxbd3d.
    netmanager 12# dkctl xbd3 listwedges
    /dev/rxbd3d: 1 wedge:
    dk1: data, 1572863903 blocks at 64, type: ffs
    
  10. Check filesystem in preparation for resize. Note must use /dev/rdk1, not /dev/dk1:
    netmanager 13# fsck -fy /dev/rdk1
    ** /dev/rdk1
    ** File system is already clean
    ** Last Mounted on /usr/export/zoom
    ** Phase 1 - Check Blocks and Sizes
    ** Phase 2 - Check Pathnames
    ** Phase 3 - Check Connectivity
    ** Phase 4 - Check Reference Counts
    ** Phase 5 - Check Cyl groups
    2779 files, 106692566 used, 23351202 free (650 frags, 2918819 blocks, 0.0% fragmentation)
    
  11. Do the resize itself:
    netmanager 14# resize_ffs -vy /dev/rdk1
    Growing fs from 131071987 blocks to 196607987 blocks.
    
  12. Re-mount and check used space:
    netmanager 15# mount -a
    netmanager 16# df /dev/dk1
    Filesystem    1K-blocks       Used      Avail %Cap Mounted on
    /dev/dk1      780259672  426770264  314476428  57% /usr/export/data
    
© Copyright Precedence Technologies 1999-2024
Page last modified on February 09, 2021, at 02:37 PM by sborrill