toplogo.png
up Home Computers Ufs Dvd
From http://craig.backfire.ca/pages/computers/ufs-dvd

What's a UFS DVD?

UFS DVD is a term I made up to describe a DVD with a Unix filesystem on it, instead of a traditional ISO9660 or UDF filesystem. They are pretty easy to make, and have a few worthwhile benefits.

Why Bother?

There are a few good reasons to make a DVD with a UFS filesystem on it. The first one that comes to mind is that if it is to be used for backup purposes, the UFS will be able to preserve everything from permissions and modification times, to flags and ACLs. Another good reason is that there is no need to worry about funny filename characters, directory depth, or any of that other headache that using an ISO9660 filesystem (even with extensions) usually brings. Further, the image could probably be encrypted with GBDE, making it a nice way of securely transporting data.

Note that the logic in this article could be applied to putting any filesystem on any media, such as an ext2 on a CD-R, or whatever.

What's the Catch?

The bad thing about putting a UFS onto a DVD is that it is (obviously) only readable on a computer that can read UFS filesystems at all. Of course, going from one FreeBSD machine to another is not a problem. In the case of using this as a backup medium, this won't be much of an issue.

Creating the Image

Since DVDs aren't writable in the same way that a hard disk is, a DVD-sized md device will need to be created. After, it will need to be newfsed and mounted. Here's an example:

# Create a dvd-sized image
dd if=/dev/zero of=./ufs.dvd bs=1m count=4480
# set it up as an md(4)
mdconfig -a -t vnode -f ufs.dvd
# mdconfig will print the device name. From here on,
# let's assume its "md0"
#
# newfs the disk. small blocksize to save space,
# and no reserved free space.
newfs -m 0 -O1 -b 4096 -f 2048 /dev/md0
# mount it, making it usable.
mount /dev/md0 /mountpoint

At this point, an everyday file-backed filesystem will be available at /mountpoint, ready to be filled with data. Once the data is all on there and it's time to burn onto a DVD, this is what needs to be done:

# unmount.
umount /mountpoint
# unconfig the md(4) device.
mdconfig -d -u md0

From here, its ready to be burned onto a DVD. There is nothing special about this part, other than the fact that the DVD writing program should be instructed to burn the UFS filesystem as an Image. This would be done with growisofs using this:

growisofs -speed=8 -Z /dev/cd0=./ufs.dvd

Once the image is finished being burned, the DVD is finished and ready for use.

Reading the DVD

Using the UFS DVD is simple; it just needs to be mounted. Note that the entry for the DVD drive in fstab will not work, as it is almost certainly configured to mount the drive as an ISO9660 filesystem. Instead, issue a mount command similar to this**:

mount -o ro,noatime /dev/cd0 /mountpoint

** NOTE: If the ro option is not specified, the operating system will mount it read-write, which is of course wrong. This will be a huge problem when it comes time to try to unmount it, since the kernel will try to update the filesystem's superblock. Even umount -f will fail with "Resource Temporarily Unavailable." Also, shutting down won't help because the final sync process will also fail, causing all disks to need to be checked upon next boot. Mounting the DVD as read-write can only lead to trouble, so don't do it.

That's it! Email me if there's false or missing information, or if there is a part that is not clear.

Rate This Page

Mouse over the nuts to rate. ZERO NutsOne NutTwo NutsThree NutsFour NutsFive Nuts 

Page last modified on December 29, 2009 16:55:45. (ID=72)