{"id":7508,"date":"2021-06-24T06:14:47","date_gmt":"2021-06-24T06:14:47","guid":{"rendered":"https:\/\/linuxways.net\/?p=7508"},"modified":"2021-06-24T06:14:47","modified_gmt":"2021-06-24T06:14:47","slug":"how-to-mount-a-drive-on-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-mount-a-drive-on-linux\/","title":{"rendered":"How to Mount a Drive on Linux"},"content":{"rendered":"<p>Before you can access and use any kind of storage device, it must first be mounted on the operating system. This is what is referred to as mounting. The storage medium has to be mounted for the OS to recognize its filesystem and interpret the data written on it. In this guide, you will learn how to mount a drive on Linux. The commands herein are global and are distribution-agnostic.<\/p>\n<h2><strong>Listing mounted file systems<\/strong><\/h2>\n<p>The mount\/umount commands are used for attaching or detaching storage devices in Linux \/ UNIX systems. To list the currently attached or mounted devices, run the <strong>mount<\/strong> command as follows:<\/p>\n<pre><strong>$ mount<\/strong><\/pre>\n<p>The output includes all filesystems including virtual filesystems such as sysfs, proc, and cgroup. Every line consists of the device&#8217;s name, directory on which the device is mounted, filesystem type, and the mount options.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"929\" height=\"253\" class=\"wp-image-7509\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-661.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-661.png 929w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-661-300x82.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-661-768x209.png 768w\" sizes=\"auto, (max-width: 929px) 100vw, 929px\" \/><\/strong><\/p>\n<p>To narrow down to specific file systems, pass the <strong>-t<\/strong> option followed by the filesystem type. The command below displays all mounted <strong>ext4 <\/strong>filesystems on the system.<\/p>\n<pre><strong>$ mount -t ext4<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"183\" class=\"wp-image-7510\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-662.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-662.png 865w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-662-300x63.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-662-768x162.png 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/strong><\/p>\n<h2><strong>How to mount a drive<\/strong><\/h2>\n<p>Mounting a filesystem is quite a straightforward process. You must first create a mount directory on which the device will be mounted and thereafter mount the device using the <strong>mount <\/strong>command.<\/p>\n<p>Usually, USB drives are automounted when plugged in. However, sometimes, they are be accidentally unmounted and in such cases, you might need to mount them manually.<\/p>\n<p>In this example, I have a drive plugged in labeled as <strong>\/dev\/sdb1.<\/strong> You can get a list of attached devices or volumes using the <strong>lsblk <\/strong>command.<\/p>\n<pre><strong>$ lsblk<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"439\" class=\"wp-image-7511\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-663.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-663.png 859w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-663-300x153.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-663-768x392.png 768w\" sizes=\"auto, (max-width: 859px) 100vw, 859px\" \/><\/p>\n<p>To mount the device I will first, create a directory or mountpoint to mount the drive. In this example, I have created the <strong>\/media\/winnie <\/strong>mount point as shown.<\/p>\n<pre><strong>$ sudo mkdir -p \/media\/winnie\/<\/strong><\/pre>\n<p>To mount the USB drive on the mount point, the command will be:<\/p>\n<pre><strong>$ sudo mount \/dev\/sdb1 \/media\/winnie\/<\/strong><\/pre>\n<p>To confirm that the drive has been mounted, run the <strong>df<\/strong> command and <strong>grep <\/strong>utility to search for the volume.<\/p>\n<pre><strong>$ df -Th | grep -i sdb<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"866\" height=\"235\" class=\"wp-image-7512\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-664.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-664.png 866w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-664-300x81.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-664-768x208.png 768w\" sizes=\"auto, (max-width: 866px) 100vw, 866px\" \/><\/strong><\/p>\n<p>We\u2019ve successfully managed to mount a USB drive. Let\u2019s now see how you can mount an ISO image<\/p>\n<h2><strong>How to mount an ISO file<\/strong><\/h2>\n<p>Mounting an ISO file, such as an ISO image allows you to access its contents, the same way we did with the USB drive. It\u2019s the equivalent of the files being written on a physical medium which is then plugged in.<\/p>\n<p>The procedure of mounting an ISO file is similar to what we did when mounting a drive.<\/p>\n<p>First, create a mount point.<\/p>\n<pre><strong>$ sudo mkdir -p \/media\/winnie\/iso<\/strong><\/pre>\n<p>Then mount the ISO using the syntax shown. This mounts the ISO file in read-only mode.<\/p>\n<pre><strong>$ sudo mount \/path\/to\/iso\/image\/ \/mount\/directory -o loop<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"202\" class=\"wp-image-7513\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-665.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-665.png 932w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-665-300x65.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-665-768x166.png 768w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/strong><\/p>\n<h2><strong>How to unmount a drive<\/strong><\/h2>\n<p>To detach a drive, simply run the command<\/p>\n<pre><strong>$ sudo umount device<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"615\" height=\"80\" class=\"wp-image-7514\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-666.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-666.png 615w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-666-300x39.png 300w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>Mounting and unmounting a drive or an ISO image is just as simple as that. Hopefully, you are now comfortable mounting and unmounting your drives.<\/p>","protected":false},"excerpt":{"rendered":"<p>Before you can access and use any kind of storage device, it must first be mounted on the operating system. This is what is referred to as mounting.&hellip;<\/p>","protected":false},"author":1,"featured_media":7657,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[384],"class_list":["post-7508","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-disk-drive"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/7508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=7508"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/7508\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/7657"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=7508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=7508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=7508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}