# UFS - How can I extend the last partition on FreeBSD 7.2?



## IT_Architect (Sep 25, 2013)

*Problem:* My /home partition, the last partition, is running out of space.

*Situation:*  I'm running FreeBSD 7.2 on VMware ESXi 5.1. My current virtual disk is 36GB, and I need to expand it to 40GB. To make the virtual disk larger, I can simply increment a spin box.  

*Question:* How can I expand the /home partition, which is the last partition? If it were Windows, after I expanded the virtual disk, the additional space would show up as unpartitioned space. I would then drag the partition boundary to the end, and the partition and file system would become the new size. How can I accomplish this in FreeBSD?

Thanks!


----------



## ph0enix (Sep 25, 2013)

Try gparted. Download the ISO, burn it to CD and boot the system with it. Make a backup of the virtual HDD before making changes in case something goes wrong.


----------



## IT_Architect (Sep 25, 2013)

I'll try it.

Thanks Tons!


----------



## junovitch@ (Sep 25, 2013)

I would be careful there.  Gparted may handle Linux file systems fine but it doesn't look like it can handle UFS.  https://en.wikipedia.org/wiki/GParted.  I'm not familiar with the exact syntax but the tools gpart() to extend the partition and growfs() to grow the file system should do the trick.


----------



## DutchDaemon (Sep 25, 2013)

FreeBSD 7.2 expired on June 30, 2010, see http://forums.freebsd.org/showthread.php?t=40469#EOL -- please upgrade to a supported version.


----------



## IT_Architect (Sep 26, 2013)

> junovitch said: Gparted may handle Linux file systems fine but...


 I also checked out gparted and one of my stops was also Wikipedia. I thought that perhaps the information was out of date, so I hawked threads of guys that tried to use gparted in this capacity as late as 2012, and they also found that gparted only detects, moves, and copies UFS, and has no support for UFS2 or ZFS. As you've mentioned, I'm only finding threads using Live CD, gpart and growfs. I shouldn't need the Live CD since I'm not messing with the root partition, but the gpart and growfs is a common theme.  

Things look like this:

```
server# fdisk
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=4699 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=4699 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 75489372 (36860 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

server# df
Filesystem  1K-blocks     Used   Avail Capacity  Mounted on
/dev/da0s1a   1012974   471728  460210    51%    /
devfs               1        1       0   100%    /dev
/dev/da0s1h  14208252 12836846  234746    98%    /home
/dev/da0s1d   1012974     2438  929500     0%    /tmp
/dev/da0s1f  10154158  6583910 2757916    70%    /usr
/dev/da0s1g   5077038  2497078 2173798    53%    /var
/dev/da0s1e   1012974     1314  930624     0%    /var/tmp
procfs              4        4       0   100%    /proc
```

I'm thinking...
1.  Spin the virtual disk up from 36 to 40 gigs GB.
2.  Run `gpart resize -i 1 da0s1h` (No -s since I want to use up all of the remaining space for this partition.)
3.  Run `growfs /dev/da0s1h`

What are your thoughts?

PS:  Actually, I remembered doing this before, and found where I documented it, but the process I used, used sysinstall, fdisk, disklabel, and lots of math. It appears that gpart makes this easier.


----------



## wblock@ (Sep 26, 2013)

Back up the partition, resize with gpart(8), restore.  Or you can try growisofs(8), but I prefer the backup/restore method.  As far as I know, there isn't any software that can resize a UFS filesystem in place.  See Backup Options For FreeBSD for detailed specifications on using dump(8) and restore(8).


----------



## IT_Architect (Sep 26, 2013)

I do have a method that works that I've used in the past when I made a generic FreeBSD VM install, and copied it several times. Then I adjusted the size of /home to match the individual requirements. I still have my detailed notes on that, and I KNOW that works because the VMs are still running. So if I don't get gpart to work, I can always use my previous method.

Thanks!


----------



## junovitch@ (Sep 26, 2013)

Given how old the system is and that it is running on an ESXi host, is there anything keeping you on FreeBSD 7.2?  Why not set up a new VM with 9.2-RC4 and migrate only your data over?


----------



## IT_Architect (Sep 27, 2013)

junovitch said:
			
		

> Given how old the system is and that it is running on an ESXi host, is there anything keeping you on FreeBSD 7.2?  Why not set up a new VM with 9.2-RC4 and migrate only your data over?


It would be a pretty big job.  It is a shared hosting web server.  I'd have to reinstall DirectAdmin, make sure it worked right, and then restore the clients with DA, and there will be compatibility issues to work through.  I do have 9.x VMs also, just not this one.

Thanks


----------

