Resize Slice?

Hi,

I have an older virtual machine (bhyve) that is running out of disk space. I resized the zvol underneath and claimed the space. Now I want to use the additional space. What is the was to go? Expanding the Slice and creating a new Partition? Creating a new slice and a partiion within that? I can't seem to find a tutorial or something how to do this properly.

The disk looks as follows:
Code:
 gpart show
=>       63  838860737  vtbd0  MBR  (400G)
         63          1         - free -  (512B)
         64  419430335      1  freebsd  [active]  (200G)
  419430399  419430401         - free -  (200G)

=>        0  419430335  vtbd0s1  BSD  (200G)
          0  398458880        1  freebsd-ufs  (190G)
  398458880   12582912        4  freebsd-ufs  (6.0G)
  411041792    8388542        2  freebsd-swap  (4.0G)
  419430334          1           - free -  (512B)

Any help would be appreciated.

Ben
 
Ah, the joy of a combined MBR scheme and ufs file system...

In short, you have to use gpart(8) and growfs(8).

First of all, determine which partition you need to enlarge. Because just add a slice and a partition won't magically informs the system to use them in addition to the full one.

After that, well... It depends if it is the 6 GiB or the 190 GiB partition to resize. It depends what you have inside.

In all cases, it will be dangerous. I advise you to try on a USB key or another zvol that mimics your existing partitions, before.
 
I already gave an example here:

In your case it will look like this
Note you can resize only vtbd0s1d (the 6Gb partition that you have) (index4) because it's your last partition after the removal of the swap partition.

Create a full backup. In case you mess up you need to restore it.

Boot from LiveCD

Resize the BSD partition (Index1)
gpart resize -i 1 -a 4k -s 399G vtbd0
Double check if the index "2" inside vtbd0s1 is your SWAP partition because you have two UFS partitions index 1 and index 4 using
gpart list vtbd0s1
Delete the swap partition if it's index2 otherwise replace the "-i 2" with the index number of your swap partition
gpart delete -i 2 vtbd0s1
Resize index4 (the 6GB partition) and leave 4gb at the end so you can add again the swap partition
gpart resize -i 4 -a 4k -s 205G vtbd0s1
Add again the swap partition at the end
gpart add -t freebsd-swap -s 4G vtbd0s1
expand the UFS from 6GB to 205GB
growfs /dev/vtbd0s1d
 
Note you can resize only vtbd0s1d (the 6Gb partition that you have) (index4) because it's your last partition after the removal of the swap partition.
You can resize the partition with index 1. You just need to save the content of the 6 GiB partition and delete it. Hence: "it depends what you have inside".

Delete the swap partition if it's index2 otherwise replace the "-i 2" with the index number of your swap partition
Is there no need to run swapoff before?

expand the UFS from 6GB to 205GB
growfs /dev/da0s1d
Shouldn't it be vtbd0s1d?
 
Yes if you need to resize the partition the space after the partition need to be empty.

No need to do swapoff as it's booted from LiveCD.

Yes i fix the last part it's should be vtbd0s1d instead of da0s1d
 
Back
Top