Mount Disks and USB Drives in Ubuntu
Ubuntu mounts drives for you: plug in a USB stick and it appears in the Files app and under /media. This page covers the Ubuntu way: the Files app, udisksctl without sudo, the NTFS partitions of a Windows dual boot, the Disks app for mounting a partition at every boot, and a real case: a USB stick that kept disconnecting while files were moved to it, and how its data was saved.
The commands that work on any Linux, with their outputs, are in Mount disks and flash drives in Linux; this page links to them at each step. Tested on Ubuntu 24.04.5 LTS with GNOME and kernel 6.8. The outputs are shortened and month names are shown in English.
How Ubuntu mounts drives
Behind the desktop runs udisks2, a system service that mounts and unmounts on behalf of normal users, and the Files app asks it to. A removable drive is mounted as soon as it is plugged in; an internal partition when you click it in Files. The folder is
/media/<user>/<label>
for example /media/andrei/IMG for a stick labelled IMG; a partition without a label gets its UUID as the folder name. udisks also picks the options: for FAT and NTFS it gives every file to the user who mounted it (uid=1000,gid=1000), so you can write without sudo. Run findmnt to see them, as shown in Where and how it is mounted.
/media/<user> is private:
getfacl -p /media/andrei
# file: /media/andrei # owner: root # group: root user::rwx user:andrei:r-x group::--- mask::r-x other::---
Only root and andrei may enter. A second account on the same laptop does not see what the first one has mounted, even while both are logged in. A partition that both should use belongs elsewhere, in /mnt: see Two accounts.
The Files app: eject, move, trash
Where drives appear. A plugged-in drive shows up in the left sidebar with an eject icon ⏏. Internal partitions that are not mounted are under Other Locations at the bottom of the sidebar; a click mounts them, and for an internal disk Ubuntu may ask for your password.
Eject. Click ⏏ next to the drive and wait until it disappears from the sidebar; only then pull it out. Eject unmounts the drive, which writes out everything still waiting in memory, and then switches it off. If Files reports that the drive is busy, close the windows and programs that use files from it, including a terminal open in its folder, and click ⏏ again. Who holds it: target is busy.
Copy or move. Dragging files from the laptop to a drive copies them. Cut and paste, or Move to, moves them: Files copies each file and then deletes the original. With a drive that drops out, a file can be deleted on the laptop while its copy never fully reached the drive; that is what happened in the case below. For anything you cannot lose, copy, compare and delete yourself: Move files safely.
Trash. A file deleted in Files on a USB drive goes to a hidden folder on that drive, .Trash-1000, where 1000 is your user id. It still takes space on the drive until you empty the trash. Files deleted on the laptop go to ~/.local/share/Trash and still take space on the laptop. Shift+Delete deletes at once, without the trash.
udisksctl: mount without sudo
udisksctl talks to the same udisks2 service as the Files app, so it mounts and unmounts as a normal user, in a terminal or over SSH. polkit decides what needs a password: removable drives usually do not, internal partitions may.
udisksctl mount -b /dev/sda6
Mounted /dev/sda6 at /media/andrei/Free
Read-only, to look at a partition without any risk to it:
udisksctl mount -b /dev/sda3 -o ro
Mounted /dev/sda3 at /media/andrei/Windows
Unmount:
udisksctl unmount -b /dev/sda3
Unmounted /dev/sda3.
Unmount and switch off a USB stick, as the eject icon does. Note the partition for the first command and the whole drive for the second:
udisksctl unmount -b /dev/sdb1 && udisksctl power-off -b /dev/sdb
After that the drive is gone from the system and can be pulled out:
lsblk /dev/sdb
lsblk: /dev/sdb: not a block device
More subcommands:
| Command | What it does |
|---|---|
| udisksctl status | every drive with model, serial number and device name |
| udisksctl info -b /dev/sdb1 | everything udisks knows about the partition: label, UUID, size, mount points |
| udisksctl loop-setup -r -f ubuntu-24.04.5-desktop-amd64.iso | an ISO file as a read-only loop device, without sudo; then mount it with udisksctl mount -b and the device name it prints |
udisksctl cannot switch a mounted partition to read-only. Use sudo mount -o remount,ro (Protect a drive), or unmount and mount again with -o ro.
An unmount and a new mount also make sure that the next read comes from the drive and not from a copy in memory. That matters when you check data you have just written: Files over 4 GB on FAT32 shows such a check.
Windows partitions on a dual-boot laptop
The laptop from the case came with Windows, and Ubuntu was installed next to it. Besides Ubuntu, the disk holds the partitions Windows (466 GB), Free (240 GB, an empty data partition) and LENOVO, the factory recovery partition: see the lsblk output. Files lists them under Other Locations.
Two drivers. Ubuntu 24.04 has both NTFS drivers. udisks mounts NTFS with the kernel driver ntfs3:
findmnt -no FSTYPE,OPTIONS /media/andrei/Free
ntfs3 rw,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8
while mount -t ntfs, and an /etc/fstab line with the type ntfs or auto, go through the older ntfs-3g:
ls -l /sbin/mount.ntfs*
lrwxrwxrwx 1 root root 13 Jul 11 18:55 /sbin/mount.ntfs -> mount.ntfs-3g lrwxrwxrwx 1 root root 12 Jul 11 18:55 /sbin/mount.ntfs-3g -> /bin/ntfs-3g
Both read and write; ntfs3 is faster.
Look before you write. To see how much space a Windows partition has, mount it read-only:
udisksctl mount -b /dev/sda3 -o ro
df -h /dev/sda3
Filesystem Size Used Avail Use% Mounted on /dev/sda3 467G 46G 421G 10% /media/andrei/Windows
To write, unmount it and mount it again without -o ro. A folder of your own on the Windows partition is fine for a backup; leave the folders of Windows itself alone.
Fast Startup. Windows 10 and 11 by default do not shut down fully: they hibernate and leave their NTFS partitions marked as in use. Linux then mounts them read-only or refuses, and writing to them could lose data. Turn Fast Startup off in Windows: Control Panel, Power Options, Choose what the power buttons do, Change settings that are currently unavailable, untick Turn on fast startup. For a single full shutdown, hold Shift while you click Shut down.
Mount a partition at every boot with Disks
A partition clicked in Files stays mounted only until the next restart, and only for the user who clicked it. To have it mounted at every boot, in a folder all users can reach, it needs a line in /etc/fstab. The Disks app writes that line for you. The example is the partition Free, mounted at /mnt/Free.
Step 1. Open Disks from the app list. Select the disk on the left, here 1,0 TB Hard Disk, and then the partition Free in the map of partitions.
Step 2. Click the gear icon under the map, Additional partition options, and choose Edit Mount Options…
Step 3: the trap. The dialog opens with the switch User Session Defaults on. Everything below it is greyed out, and Mount at system startup already shows a tick. That tick is not a setting, only a preview of what would be written: while the switch is on, nothing is in /etc/fstab, and the partition will not be mounted at boot. Check the file:
grep -v "^#" /etc/fstab
UUID=b7814b04-33f5-442a-9587-a0fbc6ba12d4 / ext4 errors=remount-ro 0 1 UUID=C860-DFDC /boot/efi vfat umask=0077 0 1 UUID=59ca2341-c177-4785-b213-03098da967eb none swap sw 0 0
Only the system partition, the boot partition and swap: no line for Free.
Step 4. Turn User Session Defaults off. The fields become editable.
Step 5. Keep Mount at system startup and Show in user interface ticked. Leave Require additional authorization to mount unticked.
Step 6. Display Name: Free. That is the name in the Files sidebar.
Step 7. The options field shows nosuid,nodev,nofail,x-gvfs-show. Add ,uid=1000,gid=1000 at the end:
nosuid,nodev,nofail,x-gvfs-show,uid=1000,gid=1000
At boot the partition is mounted by the system, not by you, and NTFS stores no Linux owners. Without uid and gid the files belong to root, and depending on the driver your user cannot save there. 1000 is the first user; yours is printed by id -u. For two accounts see below.
Step 8. Mount Point: replace /mnt/847CC7A37CC78E7C with /mnt/Free. The folder does not have to exist: systemd creates a missing mount point at boot.
Step 9. Leave Identify As at /dev/disk/by-uuid/847CC7A37CC78E7C: a UUID does not change, unlike /dev/sda6. Filesystem Type auto uses ntfs-3g; type ntfs3 to get the kernel driver that udisks uses.
Step 10. Click OK and enter your password. Disks writes a line like this to /etc/fstab:
/dev/disk/by-uuid/847CC7A37CC78E7C /mnt/Free auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Free,uid=1000,gid=1000 0 0
Step 11: use it now. If the partition is still mounted at its old place in /media, click the stop button ■ under the map in Disks to unmount it, then the play button ▶ to mount it with the new settings. Or restart. Check:
findmnt /mnt/Free
From now on the partition is at /mnt/Free after every boot, and Files shows it in the sidebar as Free.
Undo. Open the same dialog, turn User Session Defaults back on and click OK: Disks removes the line.
The same by hand in /etc/fstab
The steps, the checks and every field are explained in Mount at boot: /etc/fstab. For Ubuntu the line gets the two GVfs options of the Disks app, so the partition shows up in Files under its name:
UUID=847CC7A37CC78E7C /mnt/Free ntfs3 nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Free,uid=1000,gid=1000 0 0
In short:
sudo mkdir -p /mnt/Free
sudo cp /etc/fstab /etc/fstab.bak
sudo vi /etc/fstab
Add the line, save, then check the file and apply it:
sudo findmnt --verify --verbose
sudo systemctl daemon-reload
udisksctl unmount -b /dev/sda6
sudo mount -a
findmnt /mnt/Free
The unmount is needed only when the partition is still mounted in /media.
Two accounts on one laptop
Switch User. In the menu in the top right corner, the power button leads to Switch User…. The first session keeps running with all its windows, and nothing in it is lost. Log Out closes its programs; unsaved work in them is lost.
Drives. What one account has mounted in /media/<user> is closed to the other (How Ubuntu mounts drives). A partition that both use goes to /mnt through /etc/fstab. For both to write, put them in a common group and give the files to that group: One partition for several users. In the Disks app the options field then reads, with the group id of your group:
nosuid,nodev,nofail,x-gvfs-show,uid=1000,gid=1002,fmask=0113,dmask=0002
Ubuntu does not boot after an fstab edit
A line without nofail for a disk that is missing or broken stops the boot in emergency mode. On Ubuntu the root account has no password, so emergency mode may only say that the root account is locked. Then:
1. Restart and open the GRUB menu: hold Shift on a BIOS machine, or press Esc on a UEFI machine, while the laptop starts.
2. Choose Advanced options for Ubuntu, the line with (recovery mode), and then root. More in Boot in Recovery Mode.
3. Put the old file back, as in When fstab stops the boot:
mount -o remount,rw /
cp /etc/fstab.bak /etc/fstab
reboot
A line added with the Disks app gets nofail by default, so a missing disk does not stop the boot.
Case: a USB stick that kept disconnecting
The situation. The system partition of the laptop was full: 778 MB free of 184 GB. The plan was to move a 15 GB folder of course videos from ~/Videos/Courses to a USB stick with Cut and Paste in Files. The stick: 495 GB, FAT32, 345 GB used, among them a photo archive of twenty years that existed nowhere else.
1. The symptom. The owner of the laptop did not understand what was happening with the stick and was afraid to lose its data. The kernel log showed that from 01:41:58 the stick had dropped out four times in 80 seconds, each time in the middle of writes: Read the kernel log has the lines and what they mean.
2. What Files had been doing. The files changed on the stick in the last hours showed which copy had been running:
find /media/andrei/IMG -xdev -newermt "2026-10-23 22:30" | grep -v "/.Trash-1000/"
/media/andrei/IMG/Courses /media/andrei/IMG/.Trash-1000 /media/andrei/IMG/Courses/Data Scientist /media/andrei/IMG/Courses/Data Scientist/1. Базовые инструменты анализа данных в Python /media/andrei/IMG/Courses/Data Scientist/1. Базовые инструменты анализа данных в Python/DataScientist-2018-08 - 23.08.2018.mp4
On the laptop that video was already gone: Files had moved it, so it had copied and then deleted it. On the stick, two thirds of it were zeros (Check a file for lost writes). That video was lost and had to be downloaded again. The photo archive had not been touched by the move.
3. Stop all writes. First the move was cancelled, and the stick was switched to read-only. sudo asks for a password, so the command was run in a normal terminal (Ctrl+Alt+T):
sudo mount -o remount,ro /media/andrei/IMG
and checked with findmnt: the options started with ro (Protect a drive).
4. Find room for a backup. The system partition was full, but the Windows partition and the empty Free partition were not mounted at all. Mounted read-only, they showed 421 GB and 241 GB free (Windows partitions).
5. Back up the photo archive. The Windows partition was mounted again, now writable, and the two photo folders, 337 GB, were copied there with rsync from the read-only stick. It took three hours without a single disconnect. The number of files, the bytes and the times matched for every file: Back up a drive with rsync.
6. Free the laptop without the stick. The course folder went to the Free partition instead: copied with rsync, compared with diff -rq, identical, and only then deleted on the laptop with rm -rf, not into the trash: Move files safely.
7. Eject. The stick was ejected with ⏏ in Files. The laptop no longer saw it, so it could be pulled out (udisksctl shows the check).
8. A zip for both places. Later a project folder was archived to the Free partition and to the stick, without the Python environments and caches, which can be rebuilt:
cd /home/andrei/github
zip -r -y -q /media/andrei/Free/aredel_2026-10-24.zip aredel -x '*/.venv/*' '*/node_modules/*' '*/__pycache__/*' '*/.mypy_cache/*' '*/.ruff_cache/*' '*/.pytest_cache/*'
-y stores symbolic links as links instead of the files they point to. The zip, 4.77 GB with 67,111 files, passed unzip -tq. It was too big for FAT32, so it went to the stick in two pieces, and after a new mount of the stick the pieces gave the same SHA-256 as the original: Files over 4 GB on FAT32. The stick wrote for 19 minutes without a disconnect.
9. Mount at every boot. The Free partition now holds the courses and the zip, so it should be there after every restart and for both accounts: Mount a partition at every boot with Disks, with the mount point /mnt/Free.
What caused the disconnects stayed open: a loose contact, the port, or the stick itself. Until that is known, the stick holds nothing that exists only there.
Packages
The tools of this page and the general one, and whether they were installed on the laptop from the case:
| Tool | Package | Installed |
|---|---|---|
| udisksctl | udisks2 | yes |
| Disks | gnome-disk-utility | yes |
| fsck.vfat | dosfstools | yes |
| ntfs-3g, ntfsfix | ntfs-3g | yes |
| fsck.exfat | exfatprogs | no |
| ddrescue | gddrescue | no |
| f3write, f3read | f3 | no |
sudo apt install exfatprogs gddrescue f3
Checklist
- A drive you do not trust: watch the kernel log with journalctl -k -f while you use it.
- Do not move files to such a drive. Copy, compare, and only then delete.
- At the first error, stop writing: cancel copies and remount read-only.
- Back up first; fsck, formatting and new attempts come after.
- Check a backup by file count, bytes and an rsync dry run; check fresh writes after a new mount.
- Eject with ⏏ or udisksctl and wait until the drive is gone before you pull it.
- In Disks, User Session Defaults on means nothing is in /etc/fstab.
- For NTFS at boot add uid and gid, keep nofail, and use /mnt for partitions that several accounts share.
Article author: Klavdiya Kondakova