Increasing size of UFS partition on GPT scheme

I have installed FreeBSD 9.0-RELEASE on a 250GB HD, using UFS and the GPT scheme. I did not choose to use all the disk, as I wasn't sure I would keep using FreeBSD. However, I really like it, and I would like to use more of the disk for FreeBSD.

Here is the output of % my df -h:
Code:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ada0p2      3G    305M    2.4G    11%    /
devfs          1.0k    1.0k      0B   100%    /dev
/dev/ada0p4      3G    313M    2.4G    11%    /var
/dev/ada0p5      3G     25M    2.7G     1%    /tmp
/dev/ada0p6    9.9G    3.9G    5.2G    42%    /usr
/dev/ada0p7    9.9G    1.2G    7.9G    13%    /usr/home

And here is the output of % gpart show ada0:
Code:
         34  488394988  ada0  GPT  (232G)
         34        128     1  freebsd-boot  (64k)
        162    6291328     2  freebsd-ufs  (3G)
    6291490    6291456     3  freebsd-swap  (3.0G)
   12582946    6291456     4  freebsd-ufs  (3.0G)
   18874402    6291456     5  freebsd-ufs  (3.0G)
   25165858   20971520     6  freebsd-ufs  (10G)
   46137378   20971520     7  freebsd-ufs  (10G)
   67108898  421286124        - free -  (200G)

I would like to make my /usr/home partition bigger [but perhaps leave a few gigabytes free for a second OS - most likely PCBSD].

I don't have many packages installed, nor do I have much important data, so I realise a fresh install would probably be the most sensible / easiest approach.

However, the whole point of me using FreeBSD was to learn something, so I would prefer to try to manipulate the filesystem using tools such as growfs, gpart, fdisk, etc, if possible.

I have read all the man pages, plus a good few guides on the internet, but everything I have seen so far refers to slices and contains disk layouts such as:
Code:
ad0s1a
ad0s1b
etc

And it seems to me I have no slices. Is this even possible?

The growfs man page says:
Code:
If you wish to grow a file system beyond the boundary of the slice it
resides in, you must re-size the slice using gpart(8) before running growfs.

So my question is this:

With my current disk layout, is it possible to "grow" the /home partition?

Would it be possible to install a second UNIX-like OS on such a setup?

I'm not asking for a HOWTO but if someone could point me in the direction of some relevant documentation, it would be very much appreciated.
 
Your disk does not have slices, which are part of the old MBR partitioning scheme. Instead, it has simpler and more capable GPT partitions. Rather than ada0s1a, that disk has just ada0p2. (p1 is a small partition for bootcode.)

The thing about growfs(8) is that it increases the filesystem size but can't move existing structures. Things that look for those structures in the expected spots may no longer find them, and there have been reports about problems with labels no longer being seen.

The traditional alternative is to back up the partition with dump(8), use gpart(8) to destroy the partition and recreate it with more space, then restore to the new partition. In particular, that would be:

1. Back up partitions ada0p6 and ada0p7 to dump files on external media or another computer. Actually, back up all those partitions, even if you are going to use growfs(8).

2. Boot with mfsBSD and use gpart to delete the last two partitions and recreate them with a larger size. Or skip the extra complication of a separate /home and just create one partition for both. Force GEOM to retaste the partitions with true > /dev/ada0, then newfs(8) the new partitions.

3. Still using mfsBSD, restore from the backup.

For reference: Backup Options For FreeBSD.
 
Labels are usually stored at the end of the partition and thus are shredded when the FS is growing. So that is to be expected. Since you use a seperate partition for home you may get away with booting to single user and unmounting it. Then, as described already (tip of hat) by wblock, delete the last partition (your home) and recreate it with a bigger size. As long as the start of the partition is not moved, it should work. Having backups in place is highly recommeded in any case. Then try the growfs on the new partition, it should extend the FS. Using any glabel would require to apply this before the growfs.
 
The problem was with filesystem labels, which are stored in the filesystem. It's easy to imagine a situation where a utility would look for a label at the original offset, but it is no longer there because the filesystem has grown.
 
Back
Top