10.3 File System



The file system is mechanism which manages files and directories to store and take out the information and data.

There are file name, file creation time, file owner, etc. as the information of directories and files. The place where the data of the hard disk is written, and the place where data is not writing are also managed by the file system.

If you pass your data to the file system, a Linux system's program which handles file system writes the data into a hard disk. If you request some data to Linux system, the system reads the data from a hard disk by using index information. There are the following as major file systems.


   Contents  Maximum size  Maximum file size
 EXT2(2nd EXTended)  16-bit structure based on Berkeley Fast File System  16T Bytes  2T Bytes
 EXT3(3rd EXTended)  Journal function and functional expansion were added to EXT2  2 - 32T Bytes  16G Bytes - 2T Bytes
 ReiserFS  The journaling file system which is suitable for the treatment of small files  8T Bytes  16T Bytes
 XFS  A journaling file system by SGI  8E Bytes  8E Bytes
 JFS  A journaling file system by IBM  512T Bytes - 4P Bytes  8E Bytes

   Contents  Maximum size  Maximum file size
 FAT  The file system which manages sectors in onedimensional arrangement. There are FAT12, FAT16, and FAT32 by the disk size which can be treated. There is also VFAT which can handle long file names.  32M Bytes/2G Bytes/8T Bytes  32M Bytes/2G Bytes/4G Bytes
 NTFS  NTFS Journaling file system for NT/XP/Vista  256T Bytes(16E Bytes)  16T Bytes(16E Bytes)

ISO9660 - - - The file system standardized by ISO (International Standardization Organization). There are extensions of Joliet's, of RockRidge's, or of Apple's. This is used for DVD-ROM, too.
1M(Mega) Byte =1024K Bytes
1G(Giga) Byte =1024M Bytes
1T(Tera) Byte =1024G Bytes
1P(Peta) Byte =1024T Bytes
1E(Exa) Byte =1024P Bytes

Since EXT2 file system was used for the Linux route (/) file system widely, EXT3 file system which is expansion of the EXT2 file system is widely used now. But one distribution is using ReiserFS as standard file system, and other is using XFS.

Henceforth, the explanation is based on EXT3 (EXT2) file system.

10.3.1 Journaling Function

The journaling is a function which records the writing processing command to the file system in detail. The journaling function will be effective in the event of a failure such as abnormal termination of the computer.

If the computer is suddenly stopped and the data of the file is on the way to be written to the file system, it copes with the command which is not completed. Regarding files which are on the way to be written, since the writing can not be completed, the management information of the files is erased, so those files do not exist any more.

Many file systems after the EXT 3 file system incorporate this journaling function. The EXT 3 file system is a file system added the journaling function + α to the EXT 2 file system. In addition to EXT 3, ReiserFS, XFS, JFS are file systems with journaling function.


10.3.2 Display mount status

You can display a list of file systems that are currently mounted with the df command.

Practice : Check hard disk


# df ↵ Display a list of mounted file systems
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 4567236 3395908 935576 79% /
tmpfs 517660 0 517660 0% /dev/shm
/dev/hdc 3630332 3630332 0 100% /media/cdrom


The first partition /dev/sda1 of the sda hard disk is mounted in the / directory, the special device tmpfs is mounted in the /dev/shm directory, and the DVD-ROM /dev/hdc is mounted on /media/cdrom.


10.3.3 Create File System

In order to use the hard disk, after dividing it into partitions, create a file system. To create a file system, use the mkfs command.

Format

mkfs options


Create a file system.

Options

-t
Specify the type of file system to be created.

-c
Detect the broken part of the hard disk and do not use it.


Practice : Create hard disk


# mkfs -t ext3 -c /dev/sdc1 ↵ Create an ext3 format file system on sdc1
mke2fs 1.39 (29-May-2006) (the first partition of the third(c) interface)
Filesystem label=opt Label on hard disk
OS type: Linux
Block size=4096 (log=2) Size of hard disk partition
Fragment size=4096 (log=2)
70400 inodes, 140568 blocks
7028 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=146800640
5 block groups
32768 blocks per group, 32768 fragments per group
14080 inodes per group
Superblock backups stored on blocks:
32768, 98304
Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.


10.3.4 Label

A label is a name for recognizing a partition such as a hard disk.

You can specify a label when creating a file system on a primary partition or logical partition, or you can label it with the e2label command.

Format

e2label device [label]


Display the label of the partition. Label the partition.


Practice : Rename hard disk label with e2label command


You can check the label by specifying the device in the e2label command.

You can change the label of the device by specifying the device and label in the e2label command.


# e2label /dev/sda1 ↵         Display label of /dev/sda1
/1
# e2label /dev/sdc3 ↵         Display label of /dev/sdc3
opt
# e2label /dev/sdc3 opt2 ↵    Change label of /dev/sdc3 to opt2
# e2label /dev/sdc3 ↵         Display label of /dev/sdc3
opt2



Previous Next