{"id":461,"date":"2026-10-14T14:41:10","date_gmt":"2026-10-14T14:41:10","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2015\/12\/12\/20-mount-and-unmount-filesystem-partition-commands-in-linux-unix\/"},"modified":"2026-10-14T14:41:10","modified_gmt":"2026-10-14T14:41:10","slug":"20-mount-and-unmount-filesystem-partition-commands-in-linux-unix","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/20-mount-and-unmount-filesystem-partition-commands-in-linux-unix\/","title":{"rendered":"Linux mount and umount Commands: Practical Examples, \/etc\/fstab, and Safe Unmounting"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Mounting connects a filesystem (disk partition, USB drive, ISO, or network-backed device) to a directory so Linux can access it. This guide is for Linux admins, DevOps engineers, and support teams who need clear, production-safe <code>mount<\/code> and <code>umount<\/code> workflows.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Originally published on 2015-12-12; fully revised and updated.<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2015\/12\/mount-and-unmount-filesyste.png\" alt=\"partition commands in linux unix\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Mounting lifecycle at a glance<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In practice, mounting is a repeatable flow: prepare a mount point, mount with the right filesystem type and options, verify, and optionally persist in <code>\/etc\/fstab<\/code>.<\/p>\n\n\n\n<pre class=\"mermaid\">\nflowchart TD\n    A[Device or image is available] --> B[Create mount point directory]\n    B --> C[Mount with type and options]\n    C --> D[Verify with mount findmnt or df]\n    D --> E{Need persistence}\n    E -- yes --> F[Add entry to \/etc\/fstab]\n    F --> G[Validate with mount -a]\n    E -- no --> H[Use as temporary mount]\n    G --> I[Unmount when no longer needed]\n    H --> I\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Filesystem types and -t values you will commonly use<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-t<\/code> option sets filesystem type explicitly. If you use <code>-t auto<\/code>, Linux tries to detect the filesystem automatically.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Type<\/th><th>Typical use<\/th><th>Example command<\/th><\/tr><\/thead><tbody><tr><td>auto<\/td><td>Auto-detect type when uncertain<\/td><td><code>sudo mount -t auto \/dev\/sdb1 \/mnt\/data<\/code><\/td><\/tr><tr><td>ext4<\/td><td>Common Linux filesystem<\/td><td><code>sudo mount -t ext4 \/dev\/sdb1 \/mnt\/data<\/code><\/td><\/tr><tr><td>ext3<\/td><td>Older Linux systems<\/td><td><code>sudo mount -t ext3 \/dev\/sdb1 \/mnt\/legacy<\/code><\/td><\/tr><tr><td>ntfs<\/td><td>Windows partitions or external disks<\/td><td><code>sudo mount -t ntfs \/dev\/sdc1 \/mnt\/windows<\/code><\/td><\/tr><tr><td>vfat<\/td><td>FAT\/FAT32 removable media<\/td><td><code>sudo mount -t vfat \/dev\/sdc1 \/mnt\/usb<\/code><\/td><\/tr><tr><td>iso9660<\/td><td>Optical media and ISO images<\/td><td><code>sudo mount -t iso9660 -o ro \/dev\/cdrom \/mnt\/cdrom<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Core mount and umount commands<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>General syntax<\/strong>: mount a source (device\/image) to a destination directory (mount point).<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">sudo mount -t FILESYSTEMTYPE DEVICE MOUNT_POINT<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Create mount points before mounting:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">sudo mkdir -p \/mnt\/data\nsudo mkdir -p \/mnt\/cdrom\nsudo mkdir -p \/mnt\/iso<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Common examples:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Mount a Linux partition<\/span>\nsudo mount -t ext4 \/dev\/sdb1 \/mnt\/data\n\n<span class=\"hljs-comment\"># Mount CD-ROM read-only<\/span>\nsudo mount -t iso9660 -o ro \/dev\/cdrom \/mnt\/cdrom\n\n<span class=\"hljs-comment\"># Mount an ISO file via loop device<\/span>\nsudo mount -t iso9660 -o loop .\/pdf_collections.iso \/mnt\/iso<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">List mounted filesystems:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">mount\nfindmnt\ndf -hT<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Unmount when done (command name is <code>umount<\/code>, not <code>unmount<\/code>):<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\">sudo umount \/mnt\/data\n<span class=\"hljs-comment\"># or<\/span>\nsudo umount \/dev\/sdb1<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">If you need to move an already mounted filesystem from one mount point to another, use:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">sudo mount --move \/mydata \/mnt<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">mount vs findmnt vs df<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Best for<\/th><th>Notes<\/th><\/tr><\/thead><tbody><tr><td><code>mount<\/code><\/td><td>Quick list of mounts<\/td><td>Also performs mounting operations.<\/td><\/tr><tr><td><code>findmnt<\/code><\/td><td>Structured mount tree output<\/td><td>Usually easier to read and script than raw <code>mount<\/code> output.<\/td><\/tr><tr><td><code>df -hT<\/code><\/td><td>Capacity and filesystem type view<\/td><td>Good for troubleshooting space and type together.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Persist mounts with \/etc\/fstab<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>\/etc\/fstab<\/code> when a mount should survive reboots. After editing, always validate with <code>mount -a<\/code> to catch syntax or option errors before rebooting.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># \/etc\/fstab format:<\/span>\n<span class=\"hljs-comment\"># DEVICE   MOUNT_POINT   FSTYPE   OPTIONS   DUMP  PASS<\/span>\n\n\/dev\/sdb1  \/data         ext4     defaults  <span class=\"hljs-number\">0<\/span>     <span class=\"hljs-number\">2<\/span>\n\/dev\/sdc1  \/windows      ntfs     defaults  <span class=\"hljs-number\">0<\/span>     <span class=\"hljs-number\">0<\/span>\n\/dev\/sdd1  \/usb          vfat     defaults  <span class=\"hljs-number\">0<\/span>     <span class=\"hljs-number\">0<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">sudo mount -a<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><code>mount -a<\/code> attempts to mount eligible entries from <code>\/etc\/fstab<\/code> (entries marked <code>noauto<\/code> are skipped).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common unmount errors and quick fixes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If unmount fails with <em>target is busy<\/em>, a process is still using the filesystem.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Find open files under the mount point<\/span>\nsudo lsof +f -- \/mnt\/data\n\n<span class=\"hljs-comment\"># Or identify PIDs using the mount<\/span>\nsudo fuser -vm \/mnt\/data\n\n<span class=\"hljs-comment\"># Retry unmount<\/span>\nsudo umount \/mnt\/data<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Use lazy unmount only when necessary:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">sudo umount -l \/mnt\/data<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Best practices and common pitfalls<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Always create and verify mount points before mounting.<\/li><li>Prefer explicit filesystem type (<code>-t<\/code>) when you know it.<\/li><li>Use read-only options (<code>-o ro<\/code>) for media that should not be modified.<\/li><li>Validate <code>\/etc\/fstab<\/code> changes with <code>sudo mount -a<\/code> before rebooting.<\/li><li>Use <code>umount<\/code> (correct command spelling), and ensure no process is holding the mount.<\/li><li>Avoid broad <code>umount -a<\/code> on active systems unless you fully understand impact.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Source attribution<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Original reference cited in the legacy post: <a href=\"http:\/\/www.thegeekstuff.com\/2013\/01\/mount-umount-examples\/\" target=\"_blank\" rel=\"noopener\">http:\/\/www.thegeekstuff.com\/2013\/01\/mount-umount-examples\/<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to mount and unmount filesystems reliably on Linux, from one-off commands to persistent \/etc\/fstab entries. This guide covers common filesystem types, command comparisons, and safe troubleshooting steps.<\/p>\n","protected":false},"author":1,"featured_media":3177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4957],"tags":[378,1262,460,1267,536,1269,1264,1263,1266,1268,169,1261,1270,1265],"class_list":["post-461","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-commands","tag-filesystem","tag-linux","tag-linux-unix","tag-mount","tag-mount-command","tag-mount-filesystem","tag-partition","tag-partition-commands","tag-system","tag-unix","tag-unmount","tag-unmount-command","tag-unmount-filesystem"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=461"}],"version-history":[{"count":5,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/461\/revisions"}],"predecessor-version":[{"id":79344,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/461\/revisions\/79344"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3177"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}