{"id":50465,"date":"2022-09-29T07:58:49","date_gmt":"2022-09-29T14:58:49","guid":{"rendered":"https:\/\/linuxhint.com\/?p=50465"},"modified":"2022-10-01T21:06:48","modified_gmt":"2022-10-02T04:06:48","slug":"mount_usb_drive_debian","status":"publish","type":"post","link":"https:\/\/linuxhint.com\/mount_usb_drive_debian\/","title":{"rendered":"How to Mount a USB Drive in Debian 11"},"content":{"rendered":"<div id=\"wpbody\">Removable USB drives allow you to easily transfer the files from one system to another. When you plug in a USB drive to your system&#8217;s USB port, it automatically mounts it. In Linux, it is mounted usually under the \u201c\/media\u201d directory and can be accessed using the File Manager. However, in some scenarios, your system may not mount the USB drive automatically after you plug it in and you will be required to mount it manually in order to transfer the files between systems.<\/p>\n<p>In this post, we will describe how you can mount a USB drive in a Debian OS in case it is not detected by the system automatically.<\/p>\n<p>We use the Debian 11 OS to describe the procedure mentioned in this article. This procedure is also applicable to the previous Debian releases.<\/p>\n<h2>Mounting a USB drive<\/h2>\n<p><strong>Step 1<\/strong>: Plug in the USB drive to any of the available USB ports in your computer.<\/p>\n<p><strong>Step 2<\/strong>:\u00a0Once you plugged in the USB drive, check the USB drive name and the file system type drive used. To do this, launch the terminal application in your Debian 11 OS and issue the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">fdisk<\/span>\u00a0-l<\/div><\/div>\n<p>You will receive an output that is similar to that in the following screenshot. Scroll down the output and you will see your USB drive possibly at the end of the output labeled as sda, sdb, sdc, sdd, etc. Note down the name of your USB drive and the file system as you may need it later. In our scenario, the USB drive name is\u00a0\u201c\/dev\/sdb1\u201d\u00a0and the file system is \u201cFAT32\u201d.<\/p>\n<p><img decoding=\"async\" width=\"782\" height=\"58\" class=\"wp-image-233137\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-1.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/1-40.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-1.png 782w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-1-300x22.png 300w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-1-768x57.png 768w\" sizes=\"(max-width: 782px) 100vw, 782px\" \/><\/p>\n<p><strong>Step 3:<\/strong>\u00a0The next step is to create a directory that serves as the mount point for the USB drive. To create the mount point directory, issue the following command in the terminal:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">mkdir<\/span>\u00a0<span class=\"sy0\">\/<\/span>media<span class=\"sy0\">\/&lt;<\/span>mountpoint_name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Let\u2019s create a mount point directory named <strong>USB<\/strong> under the <strong>\/media<\/strong> directory:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">mkdir<\/span>\u00a0<span class=\"sy0\">\/<\/span>media<span class=\"sy0\">\/<\/span>USB<\/div><\/div>\n<p><img decoding=\"async\" width=\"520\" height=\"28\" class=\"wp-image-233138\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-2.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/2-36.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-2.png 520w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-2-300x16.png 300w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><\/p>\n<p><strong>Step 4:<\/strong>\u00a0Then, to mount the USB drive to the mount point that you created, issue the following command in the terminal:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">mount<\/span>\u00a0<span class=\"sy0\">&lt;<\/span>device_name<span class=\"sy0\">&gt;<\/span>\u00a0<span class=\"sy0\">&lt;<\/span>mountpoint_directory<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our scenario, we will mount the USB drive\u00a0\/dev\/sdb1\u00a0to the mount point\u00a0that we created as \/media\/USB\/. The command is as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">mount<\/span>\u00a0<span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>sdb1\u00a0<span class=\"sy0\">\/<\/span>media<span class=\"sy0\">\/<\/span>USB<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p><img decoding=\"async\" width=\"628\" height=\"31\" class=\"wp-image-233139\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-3.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/3-39.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-3.png 628w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-3-300x15.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/p>\n<p><strong>Step 5:<\/strong>\u00a0To verify if the USB drive is mounted on the mount point successfully, issue the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">mount<\/span>\u00a0<span class=\"sy0\">|<\/span>\u00a0<span class=\"kw2\">grep<\/span>\u00a0<span class=\"sy0\">&lt;<\/span>USB_drive_name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our scenario, the command would be:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">mount<\/span>\u00a0<span class=\"sy0\">|<\/span>\u00a0<span class=\"kw2\">grep<\/span>\u00a0sdb1<\/div><\/div>\n<p>The output in the following screenshot shows that our USB drive <strong>\/dev\/sdb1<\/strong> has been mounted on the mount point <strong>\/media\/USB<\/strong>. In case the command does not show any output, it means that the device is not mounted.<\/p>\n<p><img decoding=\"async\" width=\"865\" height=\"75\" class=\"wp-image-233140\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-4.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/4-36.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-4.png 865w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-4-300x26.png 300w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-4-768x67.png 768w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-4-810x70.png 810w\" sizes=\"(max-width: 865px) 100vw, 865px\" \/><\/p>\n<p><strong>Step 6:<\/strong>\u00a0To explore the mounted USB drive, move inside the mounted directory using the cd command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw3\">cd<\/span>\u00a0<span class=\"sy0\">\/<\/span>media<span class=\"sy0\">\/<\/span>USB<span class=\"sy0\">\/<\/span><\/div><\/div>\n<p>Now, you can navigate the directories in the USB drive in the same way as you do with the other directories in your file system. To list the files in the USB, use the <em>ls<\/em> command.<\/p>\n<p><img decoding=\"async\" width=\"822\" height=\"92\" class=\"wp-image-233141\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-5.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/5-35.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-5.png 822w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-5-300x34.png 300w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-5-768x86.png 768w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-5-810x91.png 810w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/p>\n<p>You can also access and explore the USB drive through the File manager of your system.<\/p>\n<p><img decoding=\"async\" width=\"899\" height=\"502\" class=\"wp-image-233142\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-6.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/6-35.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-6.png 899w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-6-300x168.png 300w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-6-768x429.png 768w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-6-810x452.png 810w\" sizes=\"(max-width: 899px) 100vw, 899px\" \/><\/p>\n<h2>Auto-Mount the USB Drive in Debian 11<\/h2>\n<p>You can also auto-mount the USB drive when it is plugged into the system. To do this, edit the \/etc\/fstab file in a text editor using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">nano<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>fstab<\/div><\/div>\n<p>Add the following entry at the end of the file, replacing the \/dev\/sdb1 and vfat with your USB device name and filesystem:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>sdb1 <span class=\"sy0\">\/<\/span>media<span class=\"sy0\">\/<\/span>USB vfat defaults <span class=\"nu0\">0<\/span> <span class=\"nu0\">0<\/span><\/div><\/div>\n<p>Then, save and exit the text editor.<\/p>\n<p>Now, run\u00a0the following command to mount all the devices:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$ <\/span><span class=\"kw2\">mount<\/span> <span class=\"re5\">-a<\/span><\/div><\/div>\n<p>This command mounts all the USB drives that are added to the \/etc\/fstab file but have not yet been mounted. Also, the next time you restart your system with a USB drive plugged in, your USB drive will be automatically mounted.<\/p>\n<h2>Unmounting a USB Drive<\/h2>\n<p>If you no longer want to use the mounted USB drive, you can unmount or detach it. However, before attempting to unmount it, make sure that there are no other operations in progress on the mounted USB drive. Otherwise, the drive won&#8217;t detach and you&#8217;ll get an error message.<\/p>\n<p>To unmount the USB drive, type\u00a0<em>umount<\/em>\u00a0followed by the mount point directory or the device name as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">umount<\/span>\u00a0<span class=\"sy0\">&lt;<\/span>mountpoint_directory<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Or<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">umount<\/span>\u00a0<span class=\"sy0\">&lt;<\/span>USB_drive_name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our scenario, it would be:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">umount<\/span>\u00a0<span class=\"sy0\">\/<\/span>media<span class=\"sy0\">\/<\/span>USB<\/div><\/div>\n<p><img decoding=\"async\" width=\"530\" height=\"33\" class=\"wp-image-233143\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-7.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/7-33.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-7.png 530w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-7-300x19.png 300w\" sizes=\"(max-width: 530px) 100vw, 530px\" \/><\/p>\n<p>If you see no output, it means that all went well and your USB drive is unmounted from the system. You can also confirm it from your File Manager\u2019s left sidebar.<\/p>\n<p><img decoding=\"async\" width=\"899\" height=\"500\" class=\"wp-image-233144\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-8.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/8-28.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-8.png 899w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-8-300x167.png 300w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-8-768x427.png 768w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-8-810x451.png 810w\" sizes=\"(max-width: 899px) 100vw, 899px\" \/><\/p>\n<p>To delete the mount point directory, issue the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"co4\">$<\/span>\u00a0<span class=\"kw2\">sudo<\/span>\u00a0<span class=\"kw2\">rmdir<\/span>\u00a0<span class=\"sy0\">&lt;<\/span>mountpoint_directory<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img decoding=\"async\" width=\"557\" height=\"32\" class=\"wp-image-233145\" src=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-9.png\" alt=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/9-26.png\" srcset=\"https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-9.png 557w, https:\/\/linuxhint.com\/wp-content\/uploads\/2019\/11\/https-linuxhint-com-wp-content-uploads-2019-11-9-300x17.png 300w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>In this article, you learned how to mount a USB drive in a Debian OS and how to unmount it when you need to remove the drive. I hope it will be helpful whenever you need to mount\/unmount a USB drive in your system.\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Comprehensive tutorial on how to mount a USB drive in a Debian OS if it is not detected automatically and how to unmount it when you need to remove the drive.<\/p>\n","protected":false},"author":72,"featured_media":233146,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1486],"tags":[],"class_list":["post-50465","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/posts\/50465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/users\/72"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/comments?post=50465"}],"version-history":[{"count":0,"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/posts\/50465\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/media\/233146"}],"wp:attachment":[{"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/media?parent=50465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/categories?post=50465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhint.com\/wp-json\/wp\/v2\/tags?post=50465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}