# Curiosities while following RAID1 guide



## klaus (Apr 19, 2013)

Hi

I have followed the RAID guide and I have had a few experiences which doesn't fully correspond with the guide. http://www.freebsd.org/doc/en/books/handbook/geom-mirror.html (Creating a Mirror with an Existing Drive).

First, I experienced that unless you disabled the SU-J options for all UFS devices during bsdinstall, it would be difficult to dump the filesystems. I thought I could disable journaling and soft updates relatively easy by using tunefs in singleuser mode

[cmd=]tunefs -j disable <filesystem>[/cmd]
[cmd=]tunefs -n disable <filesystem>[/cmd]

This ultimately gave a bunch of errors and at this early point I just reinstalled and let bsdinstall take care of it. I naturally forgot to save the exact error messages, but some of them were messages saying it failed to update the super block (again, the exact message is lost). However, it also said that soft updates and journaling were disabled for the filesystem despite the 3-4 accompanying error messages. The problems with SU-J made any attempt to dump a filesystem fail:


```
$ dump -C16 -b64 -0aL -f - /usr | (cd /mnt/usr && restore -rf -)
mksnap_ffs: Cannot create snapshot //.snap/dump_snapshot: /: Snapshots are not yet supported when running with journaled soft updates: Operation not supported
dump: Cannot create //.snap/dump_snapshot: No such file or directory
```

Now because of bsdinstall I disabled as previously mentioned SU-J options on all filesystems and dump worked like a charm. Have any of you experienced this?

*Now, when that was circumvented by bsdinstall, I hit another oddity later on:*

At one point I thought I had shot myself in the foot. This was after doing the dump and restores of the filesystems on ada0 onto the RAID, i.e.

[cmd=]dump -C16 -b64 -0aL -f - /usr | (cd /mnt/usr && restore -rf -)[/cmd]

This, at least on my FreeBSD 9.1-RELEASE, will create a dump but not restore anything else than the restoresymboltable file. I wondered why my system crashed hard after dumping all the data until I realized that filesystems like /usr, /var etc. were empty.

I had to manually dump to a file and then restore the file to achieve a successful dump->restore, like this:

Mount mirror version of /usr:
[cmd=]$ mount /dev/mirror/gm0s1d /mnt[/cmd]

Dump /usr on ada0:
[cmd=]$ dump -C16 -b64 -0aL -f /mnt/usr.dmp /usr[/cmd]

Restore ada0 contents on mirrored version:

```
$ cd /mnt
$ restore -rf usr.dmp
```

And then after waiting a long while, the /usr filesystem is successfully restored onto the mirror device.

Now, I got it working but I am still pondering a bit whether this could be related to changes (patches, natural evolution, etc) or simply me having done something wrong at some point. It is not really important since I got it working, but I'd still like to get some insight in why the commands in the guide only creates a symbolrestoretable file.

And hopefully someone else can use these experiences in the future to try out if they experience similar oddities.

All in all, I think that this little process despite the issues (which may entirely be to blame on myself) was a good learning to get a bit more comfortable with software RAIDs instead of simply setting a RAID up in your hardware RAID controller's BIOS.


----------



## kpa (Apr 19, 2013)

Disable the journaling but leave soft updates on for now. UFS snapshots are still broken when journaling is on.


----------



## wblock@ (Apr 19, 2013)

With a freshly-installed system, boot in single user mode and disable SUJ (-j).  This would be on the original filesystem, not the mirror.

With that done, using dump(8) piped into restore(8) should work fine.  The commands in that section were tested multiple times.  If you only get restoresymtable, my guess would be that you are dumping the wrong filesystem, an empty one.  But it's hard to say.

If you use a dumpfile, don't put it on the device being restored, head contention will make the restore even slower.


----------



## kpa (Apr 19, 2013)

The -n flag is for softupdates, the -j flag for SU journaling.


----------



## wblock@ (Apr 19, 2013)

Remember, this is the "creating a mirror with an existing drive" section.  The existing filesystem is the non-mirror one that was created by bsdinstall(8), and so would have SUJ enabled.  That Handbook section creates a single-drive mirror, dumps the existing filesystems to it, and then finally adds the old drive to the mirror.

Anyway, the point is that SUJ must be disabled on the existing filesystem to make it possible to dump it to a new filesystem on the mirror (or anywhere, really).


----------



## klaus (Apr 20, 2013)

Hi

Thanks for your replies!

I am surely going to test them as I've got a few more spare parts to throw together into a test machine. I am particularily interested in giving some more attempts to disable/enable the SU-J on an already installed system.

Either that, or I am just going to throw together some virtualized machine and throw a couple of disks at it and see what happens.

At least I am happy to report that with a bit of trial and error and with your timely help and advice, the server, and in particular the mirror, is now fully operational. This was a first for me with UFS software RAID :stud

This is surely easier with hardware RAID, but this was an interesting and learning experience to have.

/Klaus


----------

