A Guide to Linux Mount Points and File System Configuration

In the Linux operating system, mount points play a crucial role in making file systems accessible at specific locations in the directory tree. This guide provides examples of Linux mount points and file system configurations using the mount command.

Mounting a Partition

To mount a partition, use the following syntax:

sudo mount /dev/sdXn /mnt/mydata
  • /dev/sdXn: The partition to be mounted.
  • /mnt/mydata: The chosen mount point directory.

Mounting an ISO Image

To mount an ISO image, utilize the loop option with the mount command:

sudo mount -o loop image.iso /mnt/iso
  • image.iso: The path to the ISO file.
  • /mnt/iso: The mount point directory.

Mounting a Network Share (CIFS/SMB)

For mounting a network share, use the mount command with the -t option for the CIFS file system:

sudo mount -t cifs //server/share /mnt/network -o username=user,password=pass
  • //server/share: The network share path.
  • /mnt/network: The mount point directory.
  • -o username=user,password=pass: Specifies the username and password.

Mounting a File System at Boot (Edit /etc/fstab)

To mount a file system at boot, edit the /etc/fstab file with an entry like this:

# /etc/fstab entry
/dev/sdXn   /mnt/mydata   ext4    defaults    0   2
  • /dev/sdXn: The partition.
  • /mnt/mydata: The mount point.
  • ext4: The file system type.
  • defaults: Default mount options.
  • 0: Dump frequency (backup utility).
  • 2: Filesystem check order.

Unmounting

To unmount a file system, use the umount command:

sudo umount /mnt/mydata

File System Types and Examples

Ext4 (Fourth Extended File System)

Create an ext4 file system on a partition:

sudo mkfs.ext4 /dev/sdXn

XFS (XFS File System)

Create an XFS file system:

sudo mkfs.xfs /dev/sdXn

Btrfs (B-tree File System)

Create a Btrfs file system:

sudo mkfs.btrfs /dev/sdXn

FAT32 (File Allocation Table 32)

Create a FAT32 file system:

sudo mkfs.fat -F32 /dev/sdXn

NTFS (New Technology File System)

Create an NTFS file system:

sudo mkfs.ntfs /dev/sdXn

Swap

Create a swap file system:

sudo mkswap /dev/sdXn
sudo swapon /dev/sdXn

Replace /dev/sdXn with the appropriate device identifier for your system. Exercise caution with these commands, as they directly impact storage devices and data.