Skip to main content

Command Palette

Search for a command to run...

6.8 Evaluate and compare the basic file system features and options (findmnt, remount)

Updated
2 min read
6.8 Evaluate and compare the basic file system features and options (findmnt, remount)
V

I'm Vijay Kumar Singh, a Linux, DevOps, Cloud enthusiast learner and contributor in shell scripting, Python, networking, Kubernetes, Terraform, Ansible, Jenkins, and cloud (Azure, GCP, AWS) and basics of IT world. 💻✨ Constantly exploring innovative IT technologies, sharing insights, and learning from the incredible Hashnode community. 🌟 On a mission to build robust solutions and make a positive impact in the tech world. 🚀 Let's connect and grow together!

#PowerToCloud

Introduction:

The findmnt command is a useful tool for listing all mounted file systems on a Linux system and provides information about their targets, sources, file system types, and mount options. Below, I'll summarize the basic features and options of findmnt, as well as demonstrate how to use the remount command to change mount options on a mounted file system.

Basic Features and Options of findmnt:

  • TARGET: Shows the target mount point.

  • SOURCE: Shows the source device or location.

  • FSTYPE: Shows the type of file system.

  • OPTIONS: Shows the mount options for each file system.

Examples of findmnt Usage:

  1. List all mounted file systems:

     findmnt
    
  2. List mounted file systems of specific types (e.g., xfs):

     findmnt -t xfs
    
  3. Change mount options of a mounted file system (e.g., remount as read-only):

     sudo mount -o remount,ro /dev/vdb2 /mnt
    
  4. View mounted file systems after changing mount options:

     findmnt -t xfs
    
  5. Apply mount options persistently using /etc/fstab:

     sudo vim /etc/fstab
     # Add or update the entry for /dev/vdb2 to include desired mount options
     /dev/vdb2 /mnt xfs ro,noexec,nosuid 0 0
    
  6. Reboot the system to apply changes made in /etc/fstab:

     sudo systemctl reboot
    
  7. Verify changes to mount options after reboot:

     findmnt -t xfs
    

Using remount to Change Mount Options:

The remount option is used with the mount command to change mount options on a mounted file system without unmounting it first. This is useful for applying changes to mount options while the file system is in use.

sudo mount -o remount,rw,noexec,nosuid /dev/vdb2 /mnt

This command remounts the /dev/vdb2 file system at the /mnt mount point with the specified mount options (rw, noexec, nosuid). It allows for dynamic changes to mount options without requiring the file system to be unmounted and remounted.

More from this blog

P

PowerToCloud

85 posts

Talks about bridging the between Dev & Ops using Cloud-Native solutions, Automation. Refining DevOps skills , Excelling in Multi-cloud environment, community engagement & IT solutions.