NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Resizing a GPT disk, for the record



For the record, I'm presenting a transcript of dealing with a resized virtual disk with a GPT table. The disk has been resized from 10G to 20G. Note the secondary GPT table cannot be located because it is no longer at the end of the disk.

(aside: when I first did this, after the recover step the free space was no longer listed. I could not repeat this, but I expect a gpt resize -s <existing size> -i 1 xbd1 would have brought it back).

builder7# gpt show xbd1
     start      size  index  contents
         0         1         PMBR
         1         1         Pri GPT header
         2        32         Pri GPT table
        34  20971453      1  GPT part - NetBSD FFSv1/FFSv2
  20971487  20971553
builder7# gpt resize -i 1 xbd1
gpt: rxbd1d: error: no secondary GPT header; run recover
builder7# gpt recover xbd1
gpt: rxbd1d: recovered secondary GPT table from primary
gpt: rxbd1d: recovered secondary GPT header from primary
builder7# gpt show xbd1
     start      size  index  contents
         0         1         PMBR
         1         1         Pri GPT header
         2        32         Pri GPT table
        34  20971453      1  GPT part - NetBSD FFSv1/FFSv2
  20971487  20971520
  41943007        32         Sec GPT table
  41943039         1         Sec GPT header
builder7# gpt resize -i 1 xbd1
Partition 1 resized, use:
        dkctl xbd1 addwedge <wedgename> 34 41942973 <type>
to create a wedge for it
builder7# gpt show xbd1
     start      size  index  contents
         0         1         PMBR
         1         1         Pri GPT header
         2        32         Pri GPT table
        34  41942973      1  GPT part - NetBSD FFSv1/FFSv2
  41943007        32         Sec GPT table
  41943039         1         Sec GPT header
builder7# resize_ffs /dev/rdk0
It's required to manually run fsck on file system before you can resize it

 Did you run fsck on your disk (Yes/No) ? yes
New fs size 5242863 = old fs size 5242863, not growing.
builder7# dkctl xbd1 makewedges
successfully scanned /dev/rxbd1d.
builder7# dmesg | grep ^dk
dk0 at xbd1: 8f7dbfb4-0f7f-11e5-895b-5acb6b8c1887
dk0: 20971453 blocks at 34, type: ffs
dk0 at xbd1 (8f7dbfb4-0f7f-11e5-895b-5acb6b8c1887) deleted
dk0 at xbd1: 8f7dbfb4-0f7f-11e5-895b-5acb6b8c1887
dk0: 41942973 blocks at 34, type: ffs
builder7# resize_ffs /dev/rdk0
It's required to manually run fsck on file system before you can resize it

 Did you run fsck on your disk (Yes/No) ? yes
builder7# mount /dev/dk0 /mnt
builder7# df -h /mnt
Filesystem         Size       Used      Avail %Cap Mounted on
/dev/dk0            19G       9.3G       9.1G  50% /mnt

--
Stephen


Home | Main Index | Thread Index | Old Index