# Create UFS system for backups



## Cesc (Jul 11, 2021)

Hello everyone, I have an extra hard drive and I would like to use it for small backups, How can I format it in UFS and add it in fstab?


----------



## SirDice (Jul 11, 2021)

18.2. Adding Disks


----------



## Alain De Vos (Jul 11, 2021)

Remove the USB cable and plug it back in.
You can see which device it is /var/log/messages or via command "dmesg".
Create a partition table and partition.
man 8 gpart
Create a ufs filesystem
man 8 newfs


----------



## a6h (Jul 11, 2021)

_-- Notes:_
`$` means run as normal user
`#` means run as root

*1. *List and find the name of your external disk:
`$ grep -i disk /var/run/dmesg.boot`
OR
`# gpart show`

_-- Output:_

```
.
.
ada0 ...
ada1 ...
da0 ...
da1 GPT (512G)
.
.
```

_-- Attention: _suppose, the 512G is the correct one => `da1` is the name, aka `/dev/da1`

*2. *Create a GPT partition scheme
`# gpart create -s gpt /dev/da1`

*2.1. *Check that everything is OK:
`# gpart show da1`

_-- Output:_

```
da1 GPT (512G)
- free - (512G)
```

*3. *Add a new partition to the partitioning scheme:
`# gpart add -t freebsd-ufs -a 1M /dev/da1`

_-- Notes:_
`-t`type of partition (freebsd-ufs)
`-a` alignment (to 1MB boundary)

*4. *Then Format it:
`# newfs -U /dev/da1p1`

_-- Note:_
`-U` (Enable soft updates)

*5. *Create a mountpoint e.g. /backup
`# mkdir /backup`

*6. *Add the new partition to the /etc/fstab
`# vi /etc/fstab`

*7. *Add this line to the /etc/fstab

```
/dev/da1p1    /backup        ufs    rw    2    2
```

*8. *Mount it manually:
`# mount /backup`

*9. *Done

*0. *RTFM
man(1), vi(1), grep(1), mkdir(1), df(1), mount(1), gpart(8), newfs(8), fstab(5)


----------



## Alain De Vos (Jul 11, 2021)

"newfs -j -U" for softupdates & softupdates-journaling


----------



## bsduck (Jul 12, 2021)

Or just `newfs -j`, `-j` implies `-U`.


----------



## Deleted member 67440 (Jul 12, 2021)

I do not suggest at all using UFS, least of all for backups.
For internal: go to zfs without thinking twice.
For external (USB): go to NTFS, without thinking twice.


----------



## Alain De Vos (Jul 12, 2021)

I use zfs on my external USB drives. Works fine.
For sharing you can use FAT32 and .tar.xz the contents.


----------



## Deleted member 67440 (Jul 13, 2021)

FAT32 is limited to 4GB, much better a USB-NTFS-zpaqqed archive, that retain backup just like zfs' snapshot, forever.

You can't just compare archaic tar-based methods, it's like comparing UFS to zfs.


----------

