UFS Increase BSD from MBR space

Hi,

My current status is:
Code:
=>       63  125829057  da0  MBR  (60G)
         63   62910477    1  freebsd  [active]  (30G)
   62910540       1972       - free -  (986K)
   62912512   62916608    2  linux-data  (30G)

=>       0  62910477  da0s1  BSD  (30G)
         0        16         - free -  (8.0K)
        16  60813309      1  freebsd-ufs  (29G)
  60813325         4         - free -  (2.0K)
  60813329   2097144      2  freebsd-swap  (1.0G)
  62910473         4         - free -  (2.0K)
I would like to increase the freebsd-ufs (da0s1) from 29G to 58G taking the space from linux-data which is on da0.

Can someone provide the correct commands in order to achieve it?

Thanks!
 
Back up da0s2, the Linux slice, using whatever tool is appropriate. Back up da0s1a with dump(8)/restore(8) (see Backup Options For FreeBSD).

Then repartition to the desired size and restore.

If destroying all data on the Linux slice is acceptable, the freebsd-swap (da0s1b) and Linux slice (da0s2) can be deleted and growfs(8) can be used. However, the backup of any data that you want to keep is still needed, and a full backup along with a repartition is still preferable.

I don't know of any other tool that can non-destructively resize UFS filesystems.
 
I've deleted freebsd-swap and linux slice so gpart(8) show gives

Code:
=>       63  125829057  da0  MBR  (60G)
         63   62910477    1  freebsd  [active]  (30G)
   62910540   62918580       - free -  (30G)

=>       0  62910477  da0s1  BSD  (30G)
         0        16         - free -  (8.0K)
        16  60813309      1  freebsd-ufs  (29G)
  60813325   2097152         - free -  (1.0G)

However, executing growfs da0s1 gives:
Code:
superblock not recognized
Executing growfs da0s1a gives:
Code:
gives "growfs: requested size 29GB is not larger than the current filesystem size 29GB"

Suggestions?
 
What FreeBSD version? On FreeBSD 10.0+ this can be done on a read write filesystem. This is actually how images for VMs and images for devices like the Beaglebone are distributed. They automatically resize upon first boot using the /etc/rc.d/growfs script. Before this, file systems would have to be read-only to be changed.

http://www.freebsd.org/releases/10.0R/relnotes.html
UFS filesystems can now be enlarged with growfs(8) while mounted read-write. This is especially useful for virtual machines, allowing the addition of more harddrive space without interruption of service. r243246

Remember this is a two part process. Depending on your version you would either need to be mounted read-only or read write. With that, you first have to resize the partition with gpart(8) then you can resize the UFS filesystem on it with growfs(8). Based off the error you have shown, it doesn't appear you have resized the partition before resizing the file system on it.
 
I am on 10.1

How can I resize my partition first and after that resize the UFS file system?

I mean it seems to me that the system is actually sees 2 different disks, da0 and da0s1. How can I take the free space from da0 to da0s1 and after that resize my partition (da0s1a)?

Edit: Finally did it with
gpart resize -i 1 -a 4k da0

Moving on and letting you know
 
Last edited by a moderator:
After executing

gpart resize -i 1 -a 4k da0

I got in gpart show, my slice extended. After that it was easy:
  • Delete swap partition
  • Increase-resize freebsd-ufs partition to 57G leaving 3GB for swap partition
  • Create swap partition.

All set

Thanks everyone for the help!
 
Back
Top