How to add a unused slice to 'ROOT' to increase root size?

I have an extra slice below ad0s1f (the /usr slice), known as ad0s1g (extra). I’m lucky that I did this when I installed FreeBSD 10.0 because now I realize I need more root space for whatever reason, but I don’t want to reinstall the entire system to make this happen.

Since I have this extra_slice of 20 GB in size, my question is; how would I create a link (soft, hard or whatever it takes) to this extra slice so to increase root space area that the system will see and use as part of root as-one? Here is what I have.


Code:
/dev/ada0s1a  /    4096-mb

/dev/ada0s1b  swap    4096-mb

/dev/ada0s1d  /tmp    4526-mb

/dev/ada0s1e  /var    2048-mb

/dev/ada0s1f  /usr  30720-mb

/dev/ada0s1h  /extra  20480-mb
 
I think the best you could do is duplicate (dump()/restore()) s1a to s1h, then modify /boot/loader.conf to use that as the root filesystem.

However, I would instead back it all up, repartition, then restore. Having an unusual partition layout can make for unpleasant surprises when it is inevitably forgotten.

See Backup Options For FreeBSD.
 
I think the best you could do is duplicate (dump()/restore()) s1a to s1h, then modify /boot/loader.conf to use that as the root filesystem.

However, I would instead back it all up, repartition, then restore. Having an unusual partition layout can make for unpleasant surprises when it is inevitably forgotten.

See Backup Options For FreeBSD.

I actually thought linking root would be the solution because something like that does work for tmp, swap and var slices and more. I once read a lot about this and I tried. The plan was to combine tmp and var-tmp, and/or to link-up more swap-space. Maybe it was by way of files and not partition slices (I’m getting confused and sleepy).

Now after thinking as I write this reply, I’m looking up those old notes I been keeping. See the commands below (but thinking the root way). I will try it myself by Tuesday. My 12/4 (four on/four off) is wearing me out but those are the types of hours that I must do. I thought this was the the best way to work but you mostly only sleep your four days off.

Anyway, for another who has time and good backup, maybe you can try this just to see what happens. If it’s proven or said that there is no way to do this with root, than I will no longer waste time, and will deal with the standard way of doing things:

]However, I would instead back it all up, repartition, then restore.

I know this is the best way wblock@, but I was hoping something by way of root can come out of this. If not, to the dumpster it goes.

Code:
ls -lo /var
ls -lo /usr/var/var/tmp  -->  /usr/var/tmp/tmp
mount -u /  # re-mount root partition as read-write
mount -a    # mount all partitions in fstab

(I'm not sure about the above. They could have been just notes to get me started. Below is documented stuff that I found while I was googling this a few years back and after playing with it, it worked. Now I wonder if it can work for the root slice. I keep the original web-page copy to give credit where credit is due but it's so deep among thousands of others saved pages and I can’t search my hard-drive right now for it. Please force me to make the effort if needed soon.

Code:
chflags -R noschg /var/empty
chflags -R noschg /var/run/devd.pipe
mv /var  /usr/var/var  # move var to usr-var
mv /usr/var/var/tmp  /usr/var/tmp/tmp  # move usr-var-tmp to usr-tmp
mv /tmp    /usr/tmp/tmp  # tmp is a sylink to a none writeable area
ln -fs /usr/var/tmp/tmp  /usr/var/var/tmp
ln -fs /usr/var/var  /var
ln -fs /usr/tmp/tmp  /tmp
ln -s /extra/src/sys  /usr/sys  #  /sys  linked to  /extra/src/sys
ln -s /extra/src  /usr/src  #  /usr/src  linked to  /extra/src
chflags schg /usr/var/var/empty
 
The root filesystem is where all those links are based. Playing games with the root filesystem is more likely to cause problems than fix them.

I can't tell what the procedure shown is trying to accomplish. It looks like something that will come back to be a problem later.

There are lots of hacky ways of getting more space in root. Delete the swap partition and use growfs(8) to add that space, for example. But these all are probably trying to solve the wrong problem, which is using the root filesystem for data storage rather than a different filesystem that is not as critical to the operating system.

If not, to the dumpster it goes.

If the system is so near to being discarded as that, it's probably not worth spending more time on it.
 
Delete the swap partition and use growfs(8) to add that space

My situation would be a perfect reason to try growfs(8) since the swap is right there under root. But I’m going to do what you said in the first place and just re-install the system.

The reason behind this silly thing is that I have a 4 GB VirtualBox partition with Windows XP. My XP CD is broken and MS no longer support XP (but they will give you another copy for $290.00) so my plan was to copy it to a bigger partition so to have the last big XP on disk with tons of applications in it. This vdi was created using fixed-disk because I knew no better back then. Now it will not move or grow dynamically unless you do a two-step VirtualBox operation. Sadly to say, it do all of this inside of root and I do not have enough root space. This is one big surprise that no FreeBSD user should ever witness.

So again, all of my ideas about the expansion of root now goes straight to the dumpster (never the system). 10.1-RELEASE will be out soon so I’ll declare a bigger root size when I install it, for sake of VirtualBox and other gotcha programs.


But I learn a lot through nearly every single word you wrote … I read a little about growfs(8) but seen it as difficult to use, but now I understand all just because of your suggestion (use swap or something)… I will try that just to see how it works since I've got to wait for 10.1 anyway. Coming out of deep trouble using growfs(8) may pay off today. J

Thanks a million wblock@
 
Back
Top