- A partition is a physically contiguous section of a disk, or what appears to be so in some advanced setups.
- A filesystem is a method of storing/finding files on a hard disk (usually in a partition), is a prominent aspect of the kernel. In Linux, “Everything is a file”.
- Each filesystem on a Linux system occupies a disk partition. Partitions help to organize the contents of disks according to the kind and use of the data contained. One advantage of this kind of isolation by type and variability is that when all available space on a particular partition is exhausted, the system may still operate normally.
gparted can displays the partition with device node and mount point.
- In Linux, Filesystems Structured like a tree. Merge all the file stores into a single hierarchy, which allows users and applications to access data by knowing its location within that hierarchy: such as
/, /home/user_name, /home/user_name/Desktop/file.txt
tree -aCd -L 1 /tree -aCd -L 1 /usrtree -aCd -L 2 /hometree -aCd -L 1 /var
- Linux supports a number of native filesystem types:
ext2, ext3, ext4 are widely used in Linux. Formating command: ‘mkfs.ext3’ (Make FileSystem)
squashfs
btrfs
- Linux also offers implementations of filesystems used on other alien operating systems.
fat, vfat, ntfs: DOS and Windows
NFS, CIFS (also termed SAMBA): Network Filesystems, may have all its data on one machine or have it spread out on more than one network node.
xfs: SGI
jfs: IBM
hfs, hfs+: MacOS
- The most advanced filesystem types in common use are the
journaling varieties: ext4, xfs, btrfs, and jfs. These have many state-of-the-art features and high performance, and are very hard to corrupt accidentally.
Mounting and Unmounting
- Before you can start using a filesystem, you need to mount it on the filesystem tree at a
mount point. This is simply a directory (which may or may not be empty) where the filesystem is to be grafted on. Sometimes, you may need to create the directory if it does not already exist.
- WARNING: If you mount a filesystem on a non-empty directory, the former contents of that directory are covered-up and not accessible until the filesystem is unmounted. Thus, mount points are usually empty directories.
mount | head -10 # mount: show all presently mounted filesystemsdf -Th # df: disk free, T: filesystem Typedf -Hcat /proc/mountssudo mount /dev/sda5 /home # /dev/sda5: device node, /home: mount point# There are other ways to specify the partition other than the device node, such as using the disk label or UUID.sudo umount /home# To be automatically available every time the system starts up,# edit /etc/fstab (filesystem table)man fstab
NFS on the Server
- NFS uses daemons (built-in networking and service processes in Linux) and other system servers are started at the command line:
sudo systemctl start nfs
- The text file
/etc/exports contains the directories and permissions that a host is willing to share with other systems over NFS. A very simple entry in this file: /projects *.example.com(rw). This entry allows the directory /projects to be mounted using NFS with read and write (rw) permissions and shared with other hosts in the example.com domain.
cat /etc/exports
- After modifying the /etc/exports file:
exports -av # notify Linux about the directories you are allowing to be remotely mountedsudo systemctl restart nfssudo systemctl enable nfs# Note: On RHEL/CentOS 8, the service is called nfs-server, not nfs
NFS on the Client