# Newbe File systems questions



## Gonefishing (Mar 6, 2011)

I'm new to FreeBSD and I'm building a little server for a small school to possibly replace the existing Linux sever. Most things are going well, however, I've had two power outages which have done damage to the file system and I've need to fsck on both occasions.

I've decided to rebuild the box from scratch using two hard drives in a raid 1 or similar. Firstly I want a journaled file system, UFS does not implement a journal? although it can be added? gjournal? what is UFS-J or UFS-S. 

Or should I use ZFS I would have thought UFS was better for a system with only 2 hard drives?

Any advise would be appreciated with links to howtos if possible.


----------



## SirDice (Mar 6, 2011)

A mirror does not save you from filesystem errors. Since both mirrors are the same they'll have the same errors. You use a mirror in case one the of the drives fail completely.

Journalling could help, and yes it can be added. See gjournal(8).


----------



## Gonefishing (Mar 6, 2011)

Thanks for the reply - sorry I realise that mirroring won't help with the file systm errors, which is why I want the journaling. 

I assumed (I guess wrongly) that UFS-J installed with Journaling enabled?


----------



## SirDice (Mar 6, 2011)

UFS-J is UFS+gjournal.


----------



## ian-nai (Mar 6, 2011)

It's possible to set up a zpool that acts similarly to a mirror.  Check out my similar question here:
http://forums.freebsd.org/showthread.php?t=22092

In summary:  A zpool acts similarly to a proper mirror, though some additional steps are required for some mirror specific configurations.

If you're new to the two filesystems then I suggest you create some sample file-backed filesystems.  Play around with how to properly label and format drives.  Create a file-backed UFS+journal mirror.  Then create a file-backed zpool with two file-backed datasets. 

Look up creating file-backed filesystems in the Handbook.  The relevant section is near the journaling article, *I think*


----------



## wblock@ (Mar 6, 2011)

Gonefishing said:
			
		

> I'm new to FreeBSD and I'm building a little server for a small school to possibly replace the existing Linux sever. Most things are going well, however, I've had two power outages which have done damage to the file system and I've need to fsck on both occasions.



Mirrors and journaling filesystems can protect against drive failure and filesystem corruption, but can't bring back data that was lost when the power went out.  UPS systems are cheaper than trying to recreate data.


----------



## Gonefishing (Mar 6, 2011)

When it (the server) is up I will be using a decent UPS - that will last about 4 hours - however we sometimes have long powercuts and I'm not always there. I've worked out my stupidity I don't have the journaling running, I installed from the PCBSD installer and must have selected UFS+S rather than UFS+J and this isn't what I needed for the large /usr partition.

So the plan is to use mirroring and gjournal on UFS - I think? Unless I really should be using ZFS?


----------



## wblock@ (Mar 6, 2011)

Gonefishing said:
			
		

> When it (the server) is up I will be using a decent UPS - that will last about 4 hours - however we sometimes have long powercuts and I'm not always there.



Small power blinks are more common here.  If you run sysutils/apcupsd on an APC UPS, it can monitor and do a controlled shutdown if necessary.  There's also sysutils/nut and sysutils/nut22.


----------



## jb_fvwm2 (Mar 6, 2011)

I've tended toward gjournalling because:

a... terse error messages on gmirror (vs graid3)
b... rsync-reliable (with bwlimit parameter) better on dicey sata chipsets  (than anything on older than (usb) 
the pre-new-v3 usb drivers, eagerly awaiting their release).
Sorry for the convuluted sentence.
But the main reason:
c... Easy to setup just by reading the gjournal manpage
(After fdisk setup with the "-f file" syntax of the 
partition.)
Still plain ufs2 on the primary filesystems though.


----------



## Gonefishing (Mar 8, 2011)

Started again using gjournal and everything went fine. FreeBSD documentation is good just need to remember to read it.


----------

