{"id":2523,"date":"2023-03-18T20:32:19","date_gmt":"2023-03-18T15:02:19","guid":{"rendered":"https:\/\/smarttech101.com\/?p=2523"},"modified":"2023-03-22T17:15:09","modified_gmt":"2023-03-22T11:45:09","slug":"how-to-mount-a-drive-in-linux","status":"publish","type":"post","link":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/","title":{"rendered":"How to Mount a Drive in Linux"},"content":{"rendered":"\n<p>In this article, I will tell you how to mount and unmount a drive (hard drive, SSD, pen drive, android device) using mount\/umount, gio, and udisksctl commands in Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table of Contents<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#installation_and_early_preparation\">Installation and early preparation<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_mount_a_drive_in_linux_using_the_mount_command\">How to mount a drive in Linux using the mount command<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#how_to_mount_a_device_using_its_uuid\">How to mount a device using its UUID<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_mount_a_device_using_its_partuuid\">How to mount a device using its PARTUUID<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_mount_iso_images_and_virtual_hard_disks_in_linux\">How to mount iso images and virtual hard disks in Linux<\/a><\/li>\n\n\n\n<li><a href=\"#what_are_bind_mounts_in_mount_command_in_linux\">what are &#8216;bind mounts&#8217; in the mount command in Linux<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#how_to_mount_a_device_in_linux_using_udiskctl\">How to mount a device in Linux using udiskctl<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_mount_using_a_device_using_gio_mount_in_linux\">How to mount using a device using &#8216;gio mount&#8217; in Linux<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_unmount_a_drive_in_linux\">How to unmount a drive in Linux<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#unmount_using_umount_command\">Unmount using umount command<\/a><\/li>\n\n\n\n<li><a href=\"#unmount_using_udisksctl\">Unmount using udisksctl<\/a><\/li>\n\n\n\n<li><a href=\"#unmount_using_gio\">Unmount using gio<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installation_and_early_preparation\">Installation and early preparation<\/h2>\n\n\n\n<p>Before mounting any device in Linux, make sure that you have installed appropriate packages such as NTFS-3g for NTFS file system, dosfstools for file systems of the FAT family, and mtools for MS-DOS disks (typically a floppy disk). I will talk about further installations in the upcoming headings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_mount_a_drive_in_linux_using_the_mount_command\">How to mount a drive in Linux using the mount command<\/h2>\n\n\n\n<p>The <code>mount<\/code> command in Linux is a very powerful command. Using it you can do a lot of things.<\/p>\n\n\n\n<p><strong>Basic structure of <code>mount<\/code> command<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount &lt;source&gt; &lt;destination&gt;<\/code><\/pre>\n\n\n\n<p>Where, <code>&lt;source&gt;<\/code> is the drive you want to mount and <code>&lt;destination&gt;<\/code> is the location where you want to mount.<\/p>\n\n\n\n<p>The name of the <code>&lt;source&gt;<\/code> device can be obtained using the <code>lsblk<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u276f lsblk --paths\nNAME             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS\n\/dev\/loop0         7:0    0    56G  0 loop \/mnt\/VHD\n\/dev\/nvme1n1     259:0    0 931.5G  0 disk \n\u251c\u2500\/dev\/nvme1n1p1 259:1    0    16M  0 part \n\u2514\u2500\/dev\/nvme1n1p2 259:2    0 931.5G  0 part<\/code><\/pre>\n\n\n\n<p><strong>Example<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount \/dev\/nvme1n1p2 \/mnt\/crucial<\/code><\/pre>\n\n\n\n<p>You can also omit the <code>&lt;destination&gt;<\/code>. In that case, <code>mount<\/code> will search for it in the <code>\/etc\/fstab<\/code> file. So, you need to configure the file for this functionality.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount \/dev\/sdb1<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_mount_a_device_using_its_uuid\">How to mount a device using its UUID<\/h3>\n\n\n\n<p>You can also mount your drives using UUID:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount UUID=bd4da364-6f99-4859-8ca4-326c89e9b11f \/mnt\/Crucial<\/code><\/pre>\n\n\n\n<p>To find a device&#8217;s UUID, look into <code>\/dev\/disk\/by-uuid\/<\/code>. All the drives are symlinked:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls -al '\/dev\/disk\/by-uuid' \ntotal 0\ndrwxr-xr-x 2 root root 160 Mar 16 18:42 .\ndrwxr-xr-x 9 root root 180 Mar 16 18:41 ..\nlrwxrwxrwx 1 root root  15 Mar 16 18:42 00E8EAD5E8EAC7CC -&gt; ..\/..\/nvme0n1p3\nlrwxrwxrwx 1 root root  11 Mar 16 18:42 5627befe-b7a4-48c7-ae19-a71689a67d7e -&gt; ..\/..\/loop0\nlrwxrwxrwx 1 root root  15 Mar 16 18:42 B2E8-9A01 -&gt; ..\/..\/nvme0n1p1\nlrwxrwxrwx 1 root root  15 Mar 16 18:42 E4CA6C29CA6BF5E8 -&gt; ..\/..\/nvme1n1p2\nlrwxrwxrwx 1 root root  15 Mar 16 18:42 EAD2EB39D2EB08A1 -&gt; ..\/..\/nvme0n1p4\nlrwxrwxrwx 1 root root  15 Mar 16 18:42 fc986af0-b252-4c73-a921-a7cb75eb4c5f -&gt; ..\/..\/nvme0n1p5<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_mount_a_device_using_its_partuuid\">How to mount a device using its PARTUUID<\/h3>\n\n\n\n<p>Similarly, you can also use the PARTUUID variable to identify your partition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount PARTUUID=partuuid \/mnt\/crucial<\/code><\/pre>\n\n\n\n<p>Here, to find the PARTUUID of a drive, look into <code>\/dev\/disk\/by-partuuid\/<\/code> directory.<\/p>\n\n\n\n<p>Using PARTUUID is more robust since it is independent of the file system and hence, cannot be changed by <code>mkfs<\/code> and <code>mkswap<\/code> command. On the other hand, UUID gets changed when we format a drive.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_mount_iso_images_and_virtual_hard_disks_in_linux\">How to mount iso images and virtual hard disks in Linux<\/h3>\n\n\n\n<p>You can also use the <code>mount<\/code> command to mount an <code>*.iso<\/code> image to read\/copy its content. The <code>mount<\/code> command can also mount<a href=\"https:\/\/smarttech101.com\/how-to-create-and-use-virtual-hard-disk-in-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\"> virtual Hard disks<\/a>. For this, use <code>-o loop<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount -o loop \/media\/VHD.img \/mnt\/VHD\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount -o loop \/media\/iso_file.iso \/mnt\/iso\/<\/code><\/pre>\n\n\n\n<p>Where, <code>loop<\/code> is used to mount the file to loop device (<code>\/dev\/loopn<\/code> where, <code>n<\/code> is the next remaining loop number). you can use <code>loop=\/dev\/loop0<\/code> instead of <code>loop<\/code> to mount at the <code>loop0<\/code>.<\/p>\n\n\n\n<p>The result can be seen in the output of <code>df<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ df                  \nFilesystem     1K-blocks      Used Available Use% Mounted on\ndev              7060864         0   7060864   0% \/dev\nrun              7081468      1380   7080088   1% \/run\n\/dev\/nvme0n1p5  57135216  33081828  21118604  62% \/\ntmpfs            7081468     67376   7014092   1% \/dev\/shm\ntmpfs            7081468      3368   7078100   1% \/tmp\n\/dev\/nvme1n1p2 976744444 552065892 424678552  57% \/mnt\/crucial\n\/dev\/nvme0n1p1    262144     35772    226372  14% \/boot\/EFI\n<span style=\"text-decoration: underline;\">\/dev\/loop0      57483360  18569620  35961344  35% \/mnt\/VHD<\/span>\ntmpfs            1416292      3160   1413132   1% \/run\/user\/1000<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"what_are_bind_mounts_in_mount_command_in_linux\">What are &#8216;bind mounts&#8217; in the mount command in Linux<\/h3>\n\n\n\n<p>To get changes in one directory reflected in another, you need to use &#8216;bind mounts&#8217;. The flag <code>--bind<\/code> in mount enables you to use this feature.<\/p>\n\n\n\n<p>Command structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mount --bind &lt;source&gt; &lt;destination&gt;<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount --bind dir1 dir2<\/code><\/pre>\n\n\n\n<p>Create these directories and tries to create some files, do many things. You can see that the contents of both are the same.<\/p>\n\n\n\n<p>\ud83d\udcdd <strong>Note<\/strong>: to mount a hard disk or SSD automatically at boot, you will need to set the corresponding <a href=\"https:\/\/smarttech101.com\/how-to-create-fstab-entry-in-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">entries in the fstab<\/a> file <code>\/etc\/fstab<\/code>. After the fstab entry, your computer automatically unmounts your drive before shutting itself down as can be seen in the <code>journalctl | grep &lt;location&gt;<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ journalctl | grep \/mnt\/Maxtor\n\n'unmounted \/mnt\/Maxtor'<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_mount_a_device_in_linux_using_udiskctl\">How to mount a device in linux using udiskctl<\/h2>\n\n\n\n<p>To <strong>install<\/strong> udisks, execute one of the following commands:<\/p>\n\n\n\n<p><strong>Debian<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install udisks2<\/code><\/pre>\n\n\n\n<p><strong>Ubuntu<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install udisks2<\/code><\/pre>\n\n\n\n<p><strong>Alpine<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apk add udisks2<\/code><\/pre>\n\n\n\n<p><strong>Arch Linux<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacman -S udisks2<\/code><\/pre>\n\n\n\n<p><strong>Kali Linux<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install udisks2<\/code><\/pre>\n\n\n\n<p><strong>CentOS<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install udisks2<\/code><\/pre>\n\n\n\n<p><strong>Fedora<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install udisks2<\/code><\/pre>\n\n\n\n<p><strong>Windows (WSL2)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update sudo apt-get install udisks2<\/code><\/pre>\n\n\n\n<p><strong>Raspbian<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install udisks2<\/code><\/pre>\n\n\n\n<p><strong>Source: <a href=\"https:\/\/command-not-found.com\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">command-not-found<\/a><\/strong><\/p>\n\n\n\n<p>Udisksctl is one of the simplest methods to mount a removable drive. Unlike <code>mount<\/code> command, it <strong>does not require<\/strong> a sudo password.<\/p>\n\n\n\n<p>For example, to mount a drive <code>\/dev\/sdc1<\/code> in <code>\/run\/media\/$USER\/<\/code> folder, execute the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ udisksctl mount --block-device=\/dev\/sdc1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_mount_using_a_device_using_gio_mount_in_linux\">How to mount using a device using &#8216;gio mount&#8217; in Linux<\/h2>\n\n\n\n<p>Like <code>udiskctl<\/code>, it also does not require root permissions.<\/p>\n\n\n\n<p>Most of the linux distributions already install it. You can test whether it is installed or not by using <code>which<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ which gio\n\/usr\/bin\/gio<\/code><\/pre>\n\n\n\n<p>Or, if it is not installed, try installing <code>glib<\/code> (glib2 or something like that depending upon your distro). Check <a href=\"https:\/\/command-not-found.com\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">command-not-found<\/a> for your package providing the gio command.<\/p>\n\n\n\n<p>For all available options in <code>gio mount<\/code>, execute the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gio mount\n\ngio: No locations given\n\nUsage:\n  gio mount &#91;OPTION\u2026] &#91;LOCATION\u2026]\n\nMount or unmount the locations.\n\nOptions:\n  -m, --mountable                 Mount as mountable\n  -d, --device=ID                 Mount volume with device file, or other identifier\n  -u, --unmount                   Unmount\n  -e, --eject                     Eject\n  -t, --stop=DEVICE               Stop drive with device file\n  -s, --unmount-scheme=SCHEME     Unmount all mounts with the given scheme\n  -f, --force                     Ignore outstanding file operations when unmounting or ejecting\n  -a, --anonymous                 Use an anonymous user when authenticating\n  -l, --list                      List\n  -o, --monitor                   Monitor events\n  -i, --detail                    Show extra information\n  --tcrypt-pim=PIM                The numeric PIM when unlocking a VeraCrypt volume\n  --tcrypt-hidden                 Mount a TCRYPT hidden volume\n  --tcrypt-system                 Mount a TCRYPT system volume<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gio mount --device=\/dev\/bus\/usb\/001\/015<\/code><\/pre>\n\n\n\n<p>The above will mount <code>\/dev\/bus\/usb\/001\/015<\/code> at <code>\/run\/media\/$USER<\/code>. Similarly, you can mount <code>\/dev\/sda1<\/code><\/p>\n\n\n\n<p>After mounting the device, you can check it using <code>--list<\/code> (focus on underlined outputs):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gio mount --list --detail\n\n...\nDrive(2): Kingston DataTraveler 3.0\n  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)\n  ids:\n   <span style=\"text-decoration: underline;\">unix-device: '\/dev\/sda'<\/span>\n  themed icons:  &#91;media-removable]  &#91;media]  &#91;media-removable-symbolic]  &#91;media-symbolic]\n  symbolic themed icons:  &#91;media-removable-symbolic]  &#91;media-symbolic]  &#91;media-removable]  &#91;media]\n  is_removable=1\n  is_media_removable=0\n  has_media=1\n  is_media_check_automatic=1\n  can_poll_for_media=0\n  can_eject=1\n  can_start=0\n  can_stop=1\n  start_stop_type=shutdown\n  sort_key=01hotplug\/1661971449133300\n  Volume(0): 31 GB Volume\n    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)\n    ids:\n     class: 'device'\n     unix-device: '\/dev\/sda1'\n     uuid: 'DDF8-FB82'\n    uuid=DDF8-FB82\n    themed icons:  &#91;drive-harddisk-usb]  &#91;drive-harddisk]  &#91;drive]  &#91;drive-harddisk-usb-symbolic]  &#91;drive-harddisk-symbolic]  &#91;drive-symbolic]\n    symbolic themed icons:  &#91;drive-harddisk-usb-symbolic]  &#91;drive-harddisk-symbolic]  &#91;drive-symbolic]  &#91;drive-harddisk-usb]  &#91;drive-harddisk]  &#91;drive]\n    can_mount=0\n    can_eject=1\n    should_automount=0\n    sort_key=gvfs.time_detected_usec.1661971449235103\n    Mount(0): 31 GB Volume -&gt; file:\/\/<span style=\"text-decoration: underline;\">\/run\/media\/ajay\/DDF8-FB82<\/span>\n      Type: GProxyMount (GProxyVolumeMonitorUDisks2)\n      default_location=file:\/\/\/run\/media\/ajay\/DDF8-FB82\n      themed icons:  &#91;drive-harddisk-usb]  &#91;drive-harddisk]  &#91;drive]  &#91;drive-harddisk-usb-symbolic]  &#91;drive-harddisk-symbolic]  &#91;drive-symbolic]\n      symbolic themed icons:  &#91;drive-harddisk-usb-symbolic]  &#91;drive-harddisk-symbolic]  &#91;drive-symbolic]  &#91;drive-harddisk-usb]  &#91;drive-harddisk]  &#91;drive]\n      can_unmount=1\n      can_eject=1\n      is_shadowed=0\n      sort_key=gvfs.time_detected_usec.1661972834014018\nVolume(0): Mi A3\n  Type: GProxyVolume (GProxyVolumeMonitorMTP)\n  ids:\n   <span style=\"text-decoration: underline;\">unix-device: '\/dev\/bus\/usb\/001\/005'<\/span>\n  activation_root=mtp:\/\/Xiaomi_Mi_A3_be7541f9d27f\/\n  themed icons:  &#91;phone]\n  symbolic themed icons:  &#91;phone-symbolic]  &#91;phone]\n  can_mount=1\n  can_eject=0\n  should_automount=1\n  Mount(0): Mi A3 -&gt; mtp:\/\/Xiaomi_Mi_A3_be7541f9d27f\/\n    Type: GProxyShadowMount (GProxyVolumeMonitorMTP)\n    default_location=mtp:\/\/Xiaomi_Mi_A3_be7541f9d27f\/\n    themed icons:  &#91;phone]\n    symbolic themed icons:  &#91;phone-symbolic]  &#91;phone]\n    can_unmount=1\n    can_eject=0\n    is_shadowed=0\nMount(1): mtp -&gt; mtp:\/\/Xiaomi_Mi_A3_be7541f9d27f\/\n  Type: GDaemonMount\n  default_location=mtp:\/\/Xiaomi_Mi_A3_be7541f9d27f\/\n  themed icons:  &#91;multimedia-player]  &#91;multimedia]  &#91;multimedia-player-symbolic]  &#91;multimedia-symbolic]\n  symbolic themed icons:  &#91;drive-removable-media-symbolic]\n  can_unmount=1\n  can_eject=0\n  is_shadowed=1<\/code><\/pre>\n\n\n\n<p><strong>Note<\/strong>: The <code>gio<\/code> can also mount <strong>Android devices<\/strong>. For that, install <code>gvfs-mtp<\/code> in Arch Linux (in Ubuntu and other distros it might already be there). Just connect your phone using a USB cable, unlock it, set <code>USB USE FOR File Transfer<\/code> in your phone, and mount using the above command. It will be mounted in <code>\/run\/user\/1000\/gvfs<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_unmount_a_drive_in_linux\">How to unmount a drive in Linux<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"unmount_using_umount_command\">Unmount using umount command<\/h3>\n\n\n\n<p>Please note that it is <code>umount<\/code> not unmount.<\/p>\n\n\n\n<p>Here, only <code>&lt;source&gt;<\/code> of drive or <code>&lt;destination&gt;<\/code> i.e. file path location where the drive is mounted needs to be given.<\/p>\n\n\n\n<p>The general syntax to unmount is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo umount &lt;destination&gt;<\/code><\/pre>\n\n\n\n<p>Or,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo umount &lt;source&gt;<\/code><\/pre>\n\n\n\n<p>Example 1:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo umount \/mnt\/crucial<\/code><\/pre>\n\n\n\n<p>Example 2:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo umount \/dev\/sdb1<\/code><\/pre>\n\n\n\n<p><code>--recursive<\/code> flag unmounts all the drives mounted in the given location. For example the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ umount --recursive \/mnt<\/code><\/pre>\n\n\n\n<p>will unmount all drives mount in the <code>\/mnt<\/code> location.<\/p>\n\n\n\n<p>If <code>umount<\/code> is unable to unmount a drive due to some reason (say, still in use), you can unmount it &#8216;lazily&#8217; using <code>-l<\/code> flag. It will completely halt the job and prevent the system from hanging during reboot.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>umount -l \/mnt<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"unmount_using_udisksctl\">Unmount using udisksctl<\/h3>\n\n\n\n<p>To safely remove and power off a drive, use the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>udisksctl power-off --block-device=\/dev\/sdc<\/code><\/pre>\n\n\n\n<p>It will close all the processes associated with the drive. All files, if any, will be written to the device. It is similar to the &#8216;eject&#8217; in Windows. Now, you can safely eject the hard disk from your pc.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"unmount_using_gio\">Unmount using gio<\/h3>\n\n\n\n<p>To unmount using gio, you just need to supply the location where the device is mounted:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gio mount --unmount \/run\/media\/ajay\/DDF8-FB82<\/code><\/pre>\n\n\n\n<p>On the other hand, <code>gio mount --stop<\/code> ejects the device. For example,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ gio mount --stop=\/dev\/sda<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>That&#8217;s all folks. To know more about them read their man pages. And if you have any queries or suggestions, use the comment section below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl commands in Linux.<\/p>\n","protected":false},"author":2,"featured_media":2534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17,48],"tags":[18,35],"class_list":["post-2523","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line-tools","category-linux-desktop-tools","tag-command-line-tools","tag-core-linux-utilities"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Mount a Drive in Linux | SmartTech101<\/title>\n<meta name=\"description\" content=\"In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl command in Linux.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Mount a Drive in Linux | SmartTech101\" \/>\n<meta property=\"og:description\" content=\"In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl command in Linux.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"SmartTech101\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-18T15:02:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-22T11:45:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ajay_yadav\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\"},\"author\":{\"name\":\"Ajay\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\"},\"headline\":\"How to Mount a Drive in Linux\",\"datePublished\":\"2023-03-18T15:02:19+00:00\",\"dateModified\":\"2023-03-22T11:45:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\"},\"wordCount\":960,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1\",\"keywords\":[\"Command Line Tools\",\"core linux utilities\"],\"articleSection\":[\"Command Line Tools\",\"Linux Desktop Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\",\"url\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\",\"name\":\"How to Mount a Drive in Linux | SmartTech101\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1\",\"datePublished\":\"2023-03-18T15:02:19+00:00\",\"dateModified\":\"2023-03-22T11:45:09+00:00\",\"description\":\"In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl command in Linux.\",\"breadcrumb\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1\",\"width\":1280,\"height\":720,\"caption\":\"mount\/unmount using mount, gio and udisksctl\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/smarttech101.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Mount a Drive in Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/smarttech101.com\/#website\",\"url\":\"https:\/\/smarttech101.com\/\",\"name\":\"SmartTech101\",\"description\":\"Do Everything in Linux\",\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/smarttech101.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\",\"name\":\"Ajay Yadav\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"width\":180,\"height\":60,\"caption\":\"Ajay Yadav\"},\"logo\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\",\"name\":\"Ajay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"caption\":\"Ajay\"},\"sameAs\":[\"https:\/\/x.com\/ajay_yadav\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Mount a Drive in Linux | SmartTech101","description":"In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl command in Linux.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to Mount a Drive in Linux | SmartTech101","og_description":"In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl command in Linux.","og_url":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/","og_site_name":"SmartTech101","article_published_time":"2023-03-18T15:02:19+00:00","article_modified_time":"2023-03-22T11:45:09+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png","type":"image\/png"}],"author":"Ajay","twitter_card":"summary_large_image","twitter_creator":"@ajay_yadav","twitter_misc":{"Written by":"Ajay","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#article","isPartOf":{"@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/"},"author":{"name":"Ajay","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334"},"headline":"How to Mount a Drive in Linux","datePublished":"2023-03-18T15:02:19+00:00","dateModified":"2023-03-22T11:45:09+00:00","mainEntityOfPage":{"@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/"},"wordCount":960,"commentCount":2,"publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"image":{"@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1","keywords":["Command Line Tools","core linux utilities"],"articleSection":["Command Line Tools","Linux Desktop Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/","url":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/","name":"How to Mount a Drive in Linux | SmartTech101","isPartOf":{"@id":"https:\/\/smarttech101.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1","datePublished":"2023-03-18T15:02:19+00:00","dateModified":"2023-03-22T11:45:09+00:00","description":"In this article, I will tell you how to mount and unmount a drive in Linux using mount\/umount, gio, and udisksctl command in Linux.","breadcrumb":{"@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#primaryimage","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1","width":1280,"height":720,"caption":"mount\/unmount using mount, gio and udisksctl"},{"@type":"BreadcrumbList","@id":"https:\/\/smarttech101.com\/how-to-mount-a-drive-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smarttech101.com\/"},{"@type":"ListItem","position":2,"name":"How to Mount a Drive in Linux"}]},{"@type":"WebSite","@id":"https:\/\/smarttech101.com\/#website","url":"https:\/\/smarttech101.com\/","name":"SmartTech101","description":"Do Everything in Linux","publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smarttech101.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633","name":"Ajay Yadav","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","width":180,"height":60,"caption":"Ajay Yadav"},"logo":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334","name":"Ajay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","caption":"Ajay"},"sameAs":["https:\/\/x.com\/ajay_yadav"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Mount-a-Drive-in-Linux.png?fit=1280%2C720&ssl=1","_links":{"self":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2523"}],"collection":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/comments?post=2523"}],"version-history":[{"count":5,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2523\/revisions"}],"predecessor-version":[{"id":2582,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2523\/revisions\/2582"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media\/2534"}],"wp:attachment":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media?parent=2523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/categories?post=2523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/tags?post=2523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}