On this page
UFS: Disk usage in UFS
Operating System | FreeBSD 9 |
Website | FreeBSD Website |
Last Update | 14/06/2012 |
Introduction
Today with BTRFS and ZFS, it’s super simple to create and delete partitions, etc., but with UFS (the old way), it’s less obvious, although not very complicated. I’ll talk about some common practices here :-)
Creating a slice
First, let’s display the content of our disk:
> gpart show ada0
=> 34 976773101 ada0 GPT (465G)
34 128 1 freebsd-boot (64k)
162 41943040 2 freebsd-ufs (20G)
41943202 924843904 - free - (441G)
966787106 8388608 3 freebsd-swap (4.0G)
975175714 1597421 - free - (780M)
Here we can see I have 3 slices. The idea is to add a slice (for backup needs, so we’ll call it backups) on this GPT partition table. I specify this because we’re going to use the gpt command and not fdisk! Let’s add 50G:
> gpart add -t freebsd-ufs -l backups -s 50G ada0
ada0p4 added
And if we display it now:
> gpart show ada0
=> 34 976773101 ada0 GPT (465G)
34 128 1 freebsd-boot (64k)
162 41943040 2 freebsd-ufs (20G)
41943202 104857600 4 freebsd-ufs (50G)
146800802 819986304 - free - (391G)
966787106 8388608 3 freebsd-swap (4.0G)
975175714 1597421 - free - (780M)
Oh yeah! Now we just need to format it as UFS:
> newfs -U /dev/gpt/backups
/dev/gpt/backups: 51200.0MB (104857600 sectors) block size 32768, fragment size 4096
[...]
And mount it:
mount /dev/gpt/backups /mnt/
If we want persistence, we need to add a line in fstab:
# Device Mountpoint FStype Options Dump Pass#
/dev/ada0p3 none swap sw 0 0
/dev/ada0p2 / ufs rw 1 1
/dev/ada0p4 /mnt ufs rw 2 2
References
Last updated 14 Jun 2012, 12:30 CEST.