File systems

[#whichfs]: Deciding which filesystem(s) to use

There is a section about deciding which file system(s) to use. Influential in such a decision may be details about the various popular filesystem formats.

Decisions to make

There are options on how the partitions should be laid out on a hard drive. Many times many users will simply choose what seems like the simplest of all options: Use an entire disk for the native file that is most frequently recommended for the operating system being installed.

However, is that best? In some cases (particularly if old-style hibernation support would lead to data loss) the answer is a resounding “No!”

Of the various reasons to not use a single large hard drive space, support for multiple operating systems may be foremost in the list of reasons that technicians commonly think of quickly. However, there are some other reasons. Allocating all of the space immediately, even before the operating system is installed, is very often unnecessary and that approach does have one significant drawback: it limits options. (See the section about partition size to determine some recommendations that allow more flexibility.)

Interaction/Compatibility with system/hardware's startup sequence code
...
Disk Layout

Filesystem volumes are often stored within the boundaries of a defined disk layout. Further information about handling a disk layout, such as adjusting editing a partition (using a traditional MBR partition layout), are available.

[#mkfilsys]: Creating/making a new filesystem/format
See: creating/making/formatting a new filesystem volume.
[#adjflsys]: Adjusting/Tuning properties of a file system
Perhaps described by setupos.htm. (especially section about adjusting how frequently something is mounted. Perhaps info should be moved here, or to pages about individual filesystems?)
FAT drives

FAT drives have a label, as well as a “serial number”/“Volume ID”. These may commonly show up when people run the dir command. Less commonly, the Vol command may also show such information.

Volume label

The label may up to 11 characters. Further precise limitations may vary between operationg systems. Windows XP Pro Product Documentation says, “FAT volume labels cannot contain any of the following characters:”:
* ? / \ | . , ; : + = [ ] < > "
Windows XP Pro Product Documentation: “New ways to do familiar tasks” says “The caret (^) and ampersand (&) symbols can be used in a volume label.” (This implies that older Microsoft operating systems may not have had that option.)

The precise location of the volume label may be dependent on the operating system: Microsoft KB Q140418: Detailed Explanation of FAT Boot Sector (for Windows NT 3.x) says that a field in the boot sector “was used to store the volume label, but the volume label is now stored as a special file in the root directory.”

In DOS, a command called label may adjust the label. The disk label is typically shown when viewing the list of files using the dir command.

In Unix, the mtools package has an mlabel command. (A graphical interface may be available using MToolsFM.sf.net's software which uses the GPL.)

Serial Number

This may get automatically created, without any possible user intervention to customize the value, when the filesystem is created.

Perhaps VolumeID by Sysinternals may handle this? (See the NTFS section for a hyperlink for that software.)

In Unix, the mtools package has an mlabel command.

NTFS
Label
Similar to a FAT drive, the label command may be able to be used to adjust the label. The label may be up to 32 characters long.
Volume ID
VolumeID by Sysinternals
Ext2 and successors

(This paragraph's information may need to be verified. Also the next paragraph may need to be reviewed at that same time.) The command to tune the native filesystem type is tunefs. In operating systems using a Linux kernel, the command to tune Ext2 and similar file systems is tunefs. In other operating systems which are largely compatible, such as BSD, the same command (tunefs) might instead be meant for other filesystems.

Especially for systems that do not use Ext2 as the native command, the the e2fsprogs package at http://e2fsprogs.sf.net may contain a command called tune2fs. To keep these instructions fairly generic, the example command shown may be tune2fs. However, note that for many popular operating systems, a pre-existing tunefs command is what people generally use.

(A symbolic link from tune2fs to tunefs could be created for compatibility/genericization. Use which tunefs to find the command's location. Then place a symbolic link whereever that command is found, which can be done using something like the following command: “sudo ln -s /sbin/tunefs /sbin/tune2fs ”. Then check the results, including permissions.)

Routine checking

To adjust how often mount checks occur, one may use:

(Note: This documentation will likely include the default values. However, this documentation does not yet have that information. One way to see the defaults may be to make a partition.).
tune2fs -c 2 -i 2

e.g.:

sudo tune2fs -c 2 -i 2 /dev/wd1m

The tune2fs man page (fix hyperlink: See if official man page is somewhere, like on main site? maybe TexInfo file, or maybe tune2fs man page from third party site?) says, “It is strongly recommended that either -c (mount-count-dependent) or -i (time-dependent) checking be enabled to force periodic full e2fsck checking of the filesystem. Failure to do so may lead to filesystem corruption (due to bad disks, cables, memory, or kernel bugs) going unnoticed, ultimately resulting in data loss or corruption.” (Quote modified to alter formatting.)

It might be true that one can tell whether the next mount will force an fsck by viewing the will show “Mount count” and “Maximum mount count” lines in the output of “tune2fs -l /dev/drv0

Notes: tune2fs -l shows some current values. Some of the values that may be changed, and which are related to the perceived need to automatically start a disk checking process, include:

tune2fs -c (set max count) and tune2fs -C (set current count), tune2fs -i (interval of time between checks) and tune2fs -T (time when last check happened).

e.g. of some output lines of tune2fs:

Mount count:              0
Maximum mount count:      28
Last checked:             Tue Jun  7 23:55:30 2011
Check interval:           15552000 (6 months)
Next check after:         Sun Dec  4 22:55:30 2011
Ext3 journal mode

If using Ext3 file systems, the default may be to use the “Ordered” level of journaling. This may be sacrificing some level of safety when files are being overwritten, with the expected benefit to be speed. Additional safety may be made by switching to the “Journal” level of journaling. Those who really want to live on the edge may want to switch to “Writeback”. That poses greater risk of file system corruption occurring due to a power outage, although still any such risk is only likely to be to some of the most recent files. For those who are willing to lose the latest copy of the data, relying on backups which may be a bit outdated, there may be some speed benefit at the cost of data being more likely to be right.

tune2fs -o +journal_data,^journal_data_ordered,^journal_data_writeback /dev/someHDD

In the above example, the name of the device (“someHDD”) is expected to need to be customized.

Waste less space

Use tune2fs with appropriate -m and -r parameters.

For instance, Zimba's Performance Tuning Guidelines for Large Deployments: section about file systems says, “Only 2% needs to be reserved for root on large filesystems.” However, there's nothing all that magical about the amount of 2% either. mke2fs manual page (hosted on a third party website) describes an effect of reducing fragmentation and allowing processes owned by root, such as the example of a daemon like syslogd, “to continue to function correctly after non-privileged processes are prevented from writing to the filesystem.” On a large drive, there may be quite a lot of space being reserved for just one user. Using -m number with a lower number may free up some space.

-r also affects the number of reserved filesystem blocks, but instead of specifying a percentage, an actual precise number of filesystem blocks is defined. This would seem to be preferable when done with an automated process which can easily calculate a percentage (in contrast to doing things by hand, where specifying a percentage may be more convenient for somebody who just traditionally always uses a specific amount of reserved space). Also, specifying a percentage may also be done with mke2fs.

To see the current amount of reserved blocks, use “ tune2fs -l /dev/someHDD ” and check for “Reserved block count”.

Label
A label of up to 16 characters can be specified. e2label and/or tune2fs -L. (The mke2fs command also supports a -L command line switch.)
Misc
...???
[#bsdlbprp]: BSD disklabel/bsdlabel properties

The “BSD disklabel”/“bsdlabel” can store a name (perhaps a default is “QEMU HARDDISK   ”, although it also seems like more than 16 characters may be accepted) and a numeric (16-hexadecimal digit) identifier for each disklabel.

OpenBSD FAQ (14): Disks and Partitions: section on “Disklabel Unique Identifiers” states, “It is worth noting that the DUID is a property of the disklabel, though as OpenBSD only supports one disklabel per disk, this is mostly” trivial knowledge that is fairly unimpactful.

In OpenBSD's “ disklabel -E ”, l command will “list”(/show/display) some of the disklabel's properties, including both the “name” label and the duid. The numeric DUID may be changed with the i (to change the ID).

Changing the name

The name may be modified by using e to edit the disklabel's record of “device parameters”. (Changing the DUID is safe. Changing (m)any of the other parameters may often fairly unsafe.)

When editing the device parameters, several questions will be asked: the disk type (usually ESDI (Enhanced Small Disk Interface)), the name of the disk, sec/track, track/cyl, sec/cyl, num/cyl, total sec

Naturally, just as the l command could list the initial values before changes where made, the same command can be used to list the updated values after changes are made.

The w command writes changes to the disklabel. The q command writes changes to the disklabel and then quits (and says “No label changes.” if there were no changes since the disklabel was either loaded or written). Alternatively, the x command will exit without writing to the disklabel (although the “exit” command does not undo any changes that were already written to the disk).

FFS(2)/UFS(2)
Fragmentation handling

Perhaps run:

tunefs -o space /

(specifying a mount point) or...

tunefs -o space /dev/sd0a

(specifying a disk device). This is discussed further by topics related to fragmentation on FFS drives.

label

Unlike a FAT filesystem volume, or an Ext2 filesystem volume, it seems that FFS(2)/UFS(2) filesystem might not provide support for storing a unique name for each filesystem. However, the BSD disklabel/bsdlabel does. (See: )

[#tstrpafs]: Testing/repairing a file system

Information is available about testing/repairing a file system. (A similar topic: Info about checking a disk is available in the section about testing hardware.

Mounting a file system

(This section may need furhter clean-up) see: mounting an ISO image, section about mount points?

This documentation should (but might currently not) : describe how to mount via command line, via fstab e.g. mounting later. Perhaps described by Tutorial for setting up an operating system installation. (Perhaps info should move here, and that tutorial should hyperlink here)

Converting a filesystem
Converting to a filesystem in the Ext family

Switching between ext2 and ext3 may be rather painless (if certain characteristics about the filesystem(s) are true).

Converting to Ext2
Converting from Ext3 (to Ext2)

Note that Ext2 cannot use a journal.

...

Converting to Ext3
Converting from Ext2 (to Ext3)

Ext4 Wiki at Kernel.org: section on “Converting an ext3 filesystem to ext4” has a guide for converting ext3 to ext4 (and ext2 to ext3, simply by adding a journal with tune2fs -j). That guide references an acknowledgement of an error message being “expected&Rdquo;.

Converting to Ext4
Converting from Ext3 to Ext4

Ext4 Wiki at Kernel.org: section on “Converting an ext3 filesystem to ext4” has a guide for converting ext3 to ext4 (and ext2 to ext3, simply by adding a journal with tune2fs -j). That guide references an acknowledgement of an error message being “expected&Rdquo;.

Converting to FAT32
Converting from FAT16 (to FAT32)

FAT: TechNet: Win98 RK Part 2: System Configuration, Chapter 10: Disks and File Systems mentions Drive Converter Wizard, etc. Microsoft KB Q307881: How to convert a FAT16 volume or a FAT32 volume to an NTFS file system in Windows XP

Converting to NTFS
Converting from FAT16 or FAT32 to NTFS

Consider the impact of the loss of compatibility: FAT is more widely supported than NTFS. Are there features of NTFS that are really worth going through this step?

Microsoft KB Q307881: How to convert a FAT16 volume or a FAT32 volume to an NTFS file system in Windows XP, Microsoft KB Q295723: The Autoconvert Tool Does Not Convert a File Allocation Table Partition to an NTFS File System Partition, Microsoft KB Q156560: Free Space Required to Convert FAT to NTFS (Win2K/NT4), Microsoft KB Q314875: The Free Space That Is Required to Convert FAT to NTFS (WinXP)

Conversions involving HPFS
Microsoft KB Q100012 describes CUHPFS.DLL as being related to “HPFS file system conversion” The article states that it applies to Windows NT 3.1.