# Resizing /usr



## hitchup (Dec 21, 2009)

Portupgrades have left my system bumping up against the limit of space in /usr. I am running freeBSD as a virtual box guest. I have virtual box set to auto resize however, that doesn't increase the size of /usr.

How can i increase the size of /usr? I have read several posts and am still not sure how to continue.


----------



## Beastie (Dec 22, 2009)

Check growfs(8).


----------



## SirDice (Dec 22, 2009)

Move /usr/ports to it's own filesystem (with lots of room).


----------



## aragon (Dec 22, 2009)

I second SD's suggestion...


----------



## fronclynne (Dec 22, 2009)

SirDice said:
			
		

> Move /usr/ports to it's own filesystem (with lots of room).



or move /usr/local, & symlink /usr/ports to /usr/local/ports.

of course with a virtual machine it shouldn't be a huge deal to mount a second virtual hard drive, make the new partitions the sizes you want, dump | restore to the new virtual drive (set up the boot code &cet obviously), & restart with the new virtual drive.


----------



## hitchup (Dec 23, 2009)

I have an additional 6+GB(unused) on drive ad0, I have unsucessfully tried to add slice s2 using sysinstall. It fails on Write in that ad0s1 is in use and can't be written to(i think). I desire to add this as an additional file system and assign it a mount point say /usr/local and then mkdir ports and move the contents of /usr/ports to it and then symlink to it from /usr/ports.

How do I add the slice so that it persists? Is my logic correct?

Thanks


----------



## fronclynne (Dec 23, 2009)

hitchup said:
			
		

> I have an additional 6+GB(unused) on drive ad0, I have unsucessfully tried to add slice s2 using sysinstall. It fails on Write in that ad0s1 is in use and can't be written to(i think). I desire to add this as an additional file system and assign it a mount point say /usr/local and then mkdir ports and move the contents of /usr/ports to it and then symlink to it from /usr/ports.
> 
> How do I add the slice so that it persists? Is my logic correct?
> 
> Thanks



Sounds fine, you need to do `#  sysctl kern.geom.debugflags=16` before you can edit the boot disk.


----------



## hitchup (Dec 23, 2009)

I goofed.

I added the new partition ad0s2d to fstab.

It is detecting an error. No Superblock found.

How can I recover? The file system comes up read only and I can't invoke any editors.


----------



## SirDice (Dec 23, 2009)

hitchup said:
			
		

> How can I recover? The file system comes up read only and I can't invoke any editors.



Standard procedure, see my signature 


```
# fsck -y
# mount -u /
# mount -t ufs -a
# swapon -a
```


----------



## hitchup (Dec 24, 2009)

@SirDice
Thanks, File system rw and edited fstab.
fsck -u:


```
/dev/ados2d
Cannot find file system superblock
ioctl (GCINFO): Inappropriate ioctl for device
fsck_ufs: can't read disk label
```

Okay, How do make the label? And, make it persist?


----------



## Beastie (Dec 24, 2009)

Using bsdlabel(8) and reading the handbook (especially section 18.3.2.1).

And yes, be very careful with these commands, read their man pages, check the options used and make sure you're writing to the device you want.


----------



## hitchup (Dec 24, 2009)

No longer working on this. Starting over. Messed up the partition table.


----------



## Beastie (Dec 24, 2009)

Then you don't know partition tables can be edited entirely using `# fdisk -u`.


----------

