Next Previous Contents

3.2 FAT filesystem usage

Filesystem implementation supports 12/16/32 bit FAT variants. It supports booth short 8+3 MSDOS names, long VFAT names and long VFAT names plus additionally stored inode attributes (file modes, rights,...).

You can specify a lot of parameters for import and export. Ordinary FAT doesn't support file ownership and Unix file attributes, so you can set them for the import. The codepage used for filename storage is not specified by the filesystem, so you must change it manually. You can force the cluster_size and fat_bits for the export, if you want. If surprise doesn't detect the fat_bits well, you can force it for imported filesystems too.

FAT parameters

cluster_size

number 512|1024|2048|4096|8192|16384|32768|65536, import, export. Specifies the size of filesystem cluster. Every non-empty file would be at least cluster_size bytes long. This parameter is 100% detected for imported filesystems. If you want to force this parameter for exported filesystem, set this value and force_cluster_size parameter, else surprise is allowed choose the best value. The next parameter fat_bits can be forced by simmilar way.

fat_bits

12|16|32, import (can be forced), export. Specifies the FAT type. It can be forced for exported filesystems as well as cluster_size.

Sometimes it is not clear whether the imported FAT type is 12 or 16. If you know what are you doing, you can preset the fat_bits value for imported filesystems too. Set fat_bits and force_fat_bits in detected attributes and suprise will use that value.

fats

number 1..8, import, export. Specifies the number of FAT copies. You can force the value for exported filesystems. Usuall value is 2.

rootdir_entries

number 16..65520, import, export. The space allocated for root directory entries. If you use VFAT, every filename could be more than 1 entry long! Don't use too small values, the default value is 512. FAT32 ignores this parameter, because root directory is stored as ordinary file.

codepage

string, import (must be forced), export. Specifies the codepage used for short filenames. Long filenames are always stored in Unicode UCS2, so you need not to worry about it if you use VFAT. Default value is IBM437.

uid

number, import (must be forced). Specified the uid of every file in the filesystem. You can store anything to it, or use default value 0 (root).

gid

number, import (must be forced). Specified the gid of every file in the filesystem. You can store anything to it, or use default value 0 (root).

mask

number, import (must be forced). Specified the mask of every file in the filesystem. You can store anything to it, or use default value 0644 in octal (rw-r--r--).

system_id

string up to 8 characters long, import, export. One of the 3 strings stored in filesystem superblock. You can store anything there.

volume_name

string up to 11 characters long, import, export. One of the 3 strings stored in filesystem superblock. You can store anything there.

fat_name

string up to 8 characters long, import, export. One of the 3 strings stored in filesystem superblock. You can store anything there.

long_name_type

none|vfat|vfat+rights, import (can be forced), export. It specifies whether to use RAW msdos 8+3 names or vfat long filenames. All exported names are uniquely shortened to MSDOS 8+3 dir slot, long names are written only if choosed.

If vfat+rights is set, additional inode attributes are also read/written (unfortunately it does NOT support hardlinks). This option is used for your insurance to prevent lost of metadata if you decide to convert ext2 to FAT and back. The vfat+rights system is NOT compatible with another solutions (like UMSDOS) and is used only for insurance.

numtail

boolean, export. It set, short filenames corresponding to long filenames always have numeric tail. If not set a filename without tail is tried at first. Don't care about it.

force_cluster_size

boolean, export. If you set this parameter, the cluster_size value is forced to created filesystem. If surprise is unable to create such filesystem, it will print an error. If you unset this, surprise will try to use the given value at first and try to other possible value then.

force_fat_bits

boolean, import, export. You can force your fat_bits value here -- for exported and imported filesystems.

save_bootsector

boolean, import. If set, the bootsector OS loader will be saved before conversion and restored back after. It is applied only if FAT is converted to FAT and if it isn't a conversion of non-FAT32 to FAT32 (because of different structure of superblock).

Parameters system_id, volume_name, fat_name can be modified without rebuilding the whole filesystem. If surprise detects only these parameters (plus service parameters uid, gid, mask, numtail, force_*) are changed, it will just modify the superblock.

FAT parameters warning

If you convert any Unix filesystem to FAT, you will certainly lost a lot of meta-information about files if you don't use long_name_type==vfat+rights (it isn't enabled by default). Ordinary FAT/VFAT doesn't support file rights, ownership, special directory entries (deviced, symlinks, hardlinks, fifos,...).

Setting vfat+rights is NOT enough to save all your metadata, because

  1. Surprise doesn't support hardlinks in vfat+rights yet.
  2. VFAT doesn't allow to create filenames different only in case of characters, so filenames different in ext2 (such as `hello' and `Hello') MUST be renamed in all cases. Surprise appends a random postfix to the second filename.
As you can see, any filesystem converted to VFAT will lost some metadata. Don't convert to VFAT if you don't know what are you doing.

The file names containing national characters are usually stored in longnames. If they do so, you need not to worry about them, they will be certainly converted well. If they don't, you can save them by correct setting of codepage parameter -- if you know, which encoding does your operating system use to store them. The default value IBM437 is certainly bad choose for you. You can use CP852 encoding (PC-Latin 2) for Eastern Europe characters. Be careful to set codepage in section of detected parameters (not in parameters for exported filesystem).


Next Previous Contents