Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
2
votes
1
answers
2046
views
Run systemd service before unmount
I'm trying to run a systemd service at shutdown: it kinda works (it gets called) but it runs after filesystems are unmounted, which is not what I need. So I tried with `Before=umount.target` and `WantedBy=umount.target` without any luck (filesystems are unmounted before running the service). When I...
I'm trying to run a systemd service at shutdown: it kinda works (it gets called) but it runs after filesystems are unmounted, which is not what I need. So I tried with
Before=umount.target
and WantedBy=umount.target
without any luck (filesystems are unmounted before running the service). When I say "filesystems" I mean all but the root.
Is there any other target to pay attention to?
user3534974
(177 rep)
Jan 23, 2021, 10:51 PM
• Last activity: Jun 16, 2025, 09:08 AM
1
votes
1
answers
2702
views
Linux does not shutdown completely (Failed to unmount /oldroot)
I've been having this problem for a few months where Linux just fails to shutdown. It freezes on the screen where all logs are displayed and stuff, the last line is always: "kvm: exiting hardware virtualization" Somewhere in the middle there is either: "Failed to unmount /oldroot: Device or resource...
I've been having this problem for a few months where Linux just fails to shutdown.
It freezes on the screen where all logs are displayed and stuff, the last line is always:
"kvm: exiting hardware virtualization"
Somewhere in the middle there is either:
"Failed to unmount /oldroot: Device or resource busy"
or something along the lines of:
"Remounting "/" ext4 with ....." (I am unable to remember the rest)
This does not seem to be distribution specific, but its happening on arch based distributions (I have not tried ubuntu or any other distributions)
It also appears to affect only this laptop, as all other systems running Linux in my house work perfectly.
I also see fit to mention that I am a beginner, but I decided that arch was the best way to learn due to its steep learning curve.
Would be happy to provide any logs needed,
Image provided of the shutdown screen.
Thanks

Gaurav Satish
(53 rep)
Mar 11, 2023, 09:41 AM
• Last activity: May 28, 2025, 11:04 AM
9
votes
1
answers
4434
views
How can I make my ExFAT partition unmount cleanly?
I've got Raspbian running on a Raspberry Pi 4 B. I have a USB hard disk that I'm using with it. The hard disk is a 1TB drive formatted with a single partition using ExFAT. I've got `exfat-fuse` and `exfat-utils` installed. The problem is that every time I unmount the partition, when I run `fsck` on...
I've got Raspbian running on a Raspberry Pi 4 B. I have a USB hard disk that I'm using with it. The hard disk is a 1TB drive formatted with a single partition using ExFAT. I've got
exfat-fuse
and exfat-utils
installed. The problem is that every time I unmount the partition, when I run fsck
on that partition, it gives me this warning:
WARN: volume was not unmounted cleanly.
That makes me nervous. This happens no matter how the partition is unmounted. It happens on shutdown and subsequent bootup, it happens on reboots, it happens if I just manually sudo umount /dev/sda1
and sudo mount /dev/sda1
Here's some system information:
Linux rpi4b 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux
exfat-fuse/stable,now 1.3.0-1 armhf [installed]
exfat-utils/stable,now 1.3.0-1 armhf [installed]
This is the line concerning the partition in my /etc/fstab
.
UUID=BE1B-4EFA /media/BE1B-4EFA exfat defaults,auto,users,rw,nofail 0 0
Why isn't my partition unmounting cleanly? How can I make sure it does?
user403386
Apr 1, 2020, 03:34 PM
• Last activity: May 18, 2025, 11:07 PM
5
votes
1
answers
6263
views
Two *different* mount points having the *same* absolute path (bind-mount problem)
Scenario -------- - a NFS share is mounted on `/mnt/temp/dir` (and other shares are mounted in subdirectories), - I `umount` everything there but supposedly, it doesn't work well (maybe I start with `umount /mnt/temp/dir` instead of umounting "nested" shares like `/mnt/temp/dir/subdir*` first), - I...
Scenario
--------
- a NFS share is mounted on
/mnt/temp/dir
(and other shares are mounted in subdirectories),
- I umount
everything there but supposedly, it doesn't work well (maybe I start with umount /mnt/temp/dir
instead of umounting "nested" shares like /mnt/temp/dir/subdir*
first),
- I do mount -o bind /data/temp /mnt/temp
,
- I do mount /mnt/temp/dir
,
- I do mount /mnt/temp/dir/subdir1
... and it works well.
Note: /mnt/temp
is initially hosted on the root (/
) filesystem /dev/sda6
, and /data
is another filesystem from /dev/sda8
.
Problem
-------
I cannot delete the /mnt/temp/dir
directory on the root filesystem:
# mount -o bind / /test/root
# rmdir /test/root/mnt/temp/dir
rmdir: failed to remove `dir': Device or resource busy
Some explanation
-----------------
/mnt/temp/dir
is mounted ***twice***, probably once on the root fs, and once on the /data
fs.
Here is cat /proc/mounts
:
nfsserver:/some/share/ /mnt/temp/dir nfs rw,relatime(...) 0 0
nfsserver:/some/share/ /mnt/temp/dir nfs rw,relatime,(...) 0 0
More interesting, here is cat /proc/1/mountinfo
:
29 20 0:18 / /mnt/temp/dir rw,relatime - nfs nfsserver:/some/share/ rw,(...)
33 31 0:18 / /mnt/temp/dir rw,relatime - nfs nfsserver:/some/share/ rw,(...)
See, the two numbers at the beginning are *different*.
Kernel doc says for these two fields:
(1) mount ID: unique identifier of the mount (may be reused after umount)
(2) parent ID: ID of parent (or of self for the top of the mount tree)
They also have different parents 20 and 31 (root fs and /data
fs), see:
20 1 8:6 / / rw,relatime - ext4 /dev/sda6 rw,(...)
31 20 8:8 /temp /mnt/temp rw,relatime - ext4 /dev/sda8 rw,(...)
If I try to umount /mnt/temp/dir
, I get 2 error messages:
umount.nfs: /mnt/temp/dir: device is busy
umount.nfs: /mnt/temp/dir: device is busy
Question
========
**How can I umount
the "bad" one (mount ID 29)?**
Even the umount(2)
system call takes a path for argument, and not a "mount ID".
Totor
(21020 rep)
Feb 27, 2015, 06:24 PM
• Last activity: Apr 13, 2025, 10:04 PM
0
votes
0
answers
76
views
How to unmount a drive while a container is running?
I have a Linux (6.6.x) machine with hotswap chassis that allows drives to be inserted and removed without downtime. The system has the following drives: - /dev/sda (operating system) - /dev/sdb (removable storage) Within the directory where /dev/sda is mounted, I launch any container application, wi...
I have a Linux (6.6.x) machine with hotswap chassis that allows drives to be inserted and removed without downtime.
The system has the following drives:
- /dev/sda (operating system)
- /dev/sdb (removable storage)
Within the directory where /dev/sda is mounted, I launch any container application, with docker, podman, etc. It only touches files that are stored on /dev/sda.
I then
umount /dev/sdb
which succeeds if nothing is using it. But when I grep sdb /proc/*/mounts
all the processes launched within the container are continuing to hold /dev/sdb mount open, even though it has been unmounted in the root level. I've also verified this under /sys/fs
seeing that the filesystem is still active.
1. I've tried setting different propagation shared, slave, private in fstab, without success. The unmount doesn't seem to propagate from the top namespace into the container namespace.
2. I tried running unmount within the container by nsenter
ing the container. But it throws a EINVAL target is locked; see mount_namespaces(7)
error.
-----
Per mount_namespaces(7), when a container application is launched **"the mount list of the child's namespace is a copy of the mount list in the parent process's mount namespace"**
Also per mount_namespaces(7) **"Mounts that come as a single unit from a more privileged mount namespace are locked together and may not be separated"**
-----
a. Do these constraints mean that every container on the system must be shutdown before *any* drive on a computer can be unmounted?
b. Or is there a way to exclude irrelevant drives from being copied into container mount namespaces?
c. Or is there a solution to allow unmount to propagate from the top-level context to all containers?
anthonyryan1
(53 rep)
Mar 23, 2025, 11:33 PM
• Last activity: Apr 9, 2025, 12:17 AM
4
votes
1
answers
4056
views
Offlining a ZFS pool speedily and safely as a monolithic whole?
Much as the question says. Suppose I want to have the equivalent of a scripted "emergency button" for my FreeNAS pool - something that I can click to run from a GUI or execute in console/SSH, which very quickly closes everything that might be reading or writing to it, unmounts the file system, and -...
Much as the question says.
Suppose I want to have the equivalent of a scripted "emergency button" for my FreeNAS pool - something that I can click to run from a GUI or execute in console/SSH, which very quickly closes everything that might be reading or writing to it, unmounts the file system, and - ideally - quiesces the disks or partitions it's using.
I don't care about errors arising to other software or remote connections by doing this, or aborting any long file transfers prematurely, I just want it to offline the pool in the fastest way that's consistent with retaining its consistency and possibly giving it a few seconds for any pending writes to complete and the pool to be in a consistent state for data purposes.
The options suggested by ZFS commands don't look promising:
zpool offline
only works on individual devices so one might have a race condition if writing happens while disks are removed one at a time; zpool export
requires the -f option if in use and carries a warning that -f
can lose data as well. One could check all open file descriptors
using the pool or its devices (thousands or hundreds of thousands of them?) and manually force-close each but that could hit race conditions as it doesn't stop new fd's being created at the same time. I also should not assume all ZFS activity is mediated by a list of remote file serving daemons to be sent exit signals, because some file activity is likely to be local (cron/CLI/detached sessions).
So looking at how best to offline an entire pool safely and quickly, it looks like umount
might be my best bet - it works at a file system level and can offline an entire file system speedily and as a monolithic unit, after which zpool export
looks like it would then be able to actually finish and quiesce any internal activity in a safe manner without the -f
option, keeping the data itself in a guaranteed consistent state. If there's raw disk activity going on (resilver or scrub) then I guess that would resume or restart when the pool was later brought back online.
But even umount
doesn't seem to do it completely, because there could be iSCSI zvol
targets in use as well. The data within those inherently can't be kept consistent as the server doesn't know its structure, so the remote initiators will have to do data repair as best they can when they reconnect. I'm fine with that, but I'm not sure if some kind of command to force-terminate or offline the targets is needed or best practice. (Note: force-terminating _connections_ has the same issues as closing individual fd's would.)
I'm aware that there is bound to be some kind of data loss or issue if the pool is abruptly kicked out of RW state when writes are happening. But as long as it doesn't lose consistency (at a ZFS pool and file system level) then that's fine - any in-use files/iSCSI targets being updated will have to take their chances on files/blocks being in a ZFS-consistent but data-invalid state due to going offline partway through data being written. That's unavoidable and not an issue for the question.
So what steps do I actually need to do, to offline an in-use pool as fast as possible consistent with guaranteed pool safety and consistency - and would manually umount
ing an in-use ZFS file system (as part of a solution) be safe or carry any risk of data damage?
**Update:** Mentioning here in case someone else finds this useful. The accepted answer states that export -f
may have issues with zvols (iSCSI etc). Based on this hint, I found that the iSCSI handler used by FreeNAS can forcibly logout/terminate sessions, and has other useful subcommands which could be issued beforehand - see man ctladm
. Whatever your zvols are used for there's likely to be some command to end sessions on them.)
Stilez
(1311 rep)
Jan 25, 2018, 10:56 AM
• Last activity: Jan 3, 2025, 12:32 PM
2
votes
1
answers
170
views
Weird result mounting a tmpfs as root in the directory tree
Using `unshare -Umr` I created a new user, mount namespaces where the calling process is moved into. Then via `mount -t tmpfs tmpfs /` I mounted a new tmpfs instance on the root `/` of the directory tree within the new mount namespace. Since the `tmpfs` is empty I would expect to see an empty list f...
Using
unshare -Umr
I created a new user, mount namespaces where the calling process is moved into. Then via mount -t tmpfs tmpfs /
I mounted a new tmpfs instance on the root /
of the directory tree within the new mount namespace.
Since the tmpfs
is empty I would expect to see an empty list from the command ls -la /
, however here is the output:
ubuntu@ubuntu:~$ unshare -Umr /bin/bash
root@ubuntu:~# mount -t tmpfs tmpfs /
root@ubuntu:~# ls -la /
total 5309704
drwxr-xr-x 24 nobody nogroup 4096 Nov 22 2023 .
drwxrwxrwt 2 root root 40 Nov 11 15:47 ..
drwxr-xr-x 2 nobody nogroup 4096 Jan 25 2023 bin
drwxr-xr-x 3 nobody nogroup 4096 Jan 25 2023 boot
drwxr-xr-x 2 nobody nogroup 4096 Nov 11 2019 cdrom
drwxr-xr-x 17 nobody nogroup 3820 Aug 22 14:22 dev
drwxr-xr-x 105 nobody nogroup 4096 Mar 14 2024 etc
-rw-r--r-- 1 root root 1688371200 Jan 19 2021 GISO
drwxr-xr-x 3 nobody nogroup 4096 Nov 11 2019 home
lrwxrwxrwx 1 nobody nogroup 34 Jan 25 2023 initrd.img -> boot/initrd.img-4.15.0-202-generic
lrwxrwxrwx 1 nobody nogroup 34 Jan 25 2023 initrd.img.old -> boot/initrd.img-4.15.0-132-generic
drwxr-xr-x 21 nobody nogroup 4096 Jan 25 2023 lib
drwxr-xr-x 2 nobody nogroup 4096 Jan 25 2023 lib64
drwx------ 2 nobody nogroup 16384 Nov 11 2019 lost+found
drwxr-xr-x 2 nobody nogroup 4096 Feb 10 2021 media
drwxr-xr-x 2 nobody nogroup 4096 Aug 5 2019 mnt
drwxr-xr-x 3 nobody nogroup 4096 Nov 26 2020 opt
dr-xr-xr-x 123 nobody nogroup 0 Aug 22 12:22 proc
drwx------ 4 nobody nogroup 4096 Dec 6 2023 root
drwxr-xr-x 24 nobody nogroup 820 Nov 11 15:20 run
drwxr-xr-x 2 nobody nogroup 12288 Jan 25 2023 sbin
drwxr-xr-x 4 nobody nogroup 4096 Nov 11 2019 snap
drwxr-xr-x 3 nobody nogroup 4096 Jan 24 2020 srv
-rw------- 1 nobody nogroup 3748659200 Nov 11 2019 swap.img
dr-xr-xr-x 13 nobody nogroup 0 Nov 11 15:40 sys
drwxrwxrwt 10 nobody nogroup 4096 Nov 11 15:42 tmp
drwxr-xr-x 10 nobody nogroup 4096 Aug 5 2019 usr
drwxr-xr-x 13 nobody nogroup 4096 Aug 5 2019 var
lrwxrwxrwx 1 nobody nogroup 31 Jan 25 2023 vmlinuz -> boot/vmlinuz-4.15.0-202-generic
lrwxrwxrwx 1 nobody nogroup 31 Jan 25 2023 vmlinuz.old -> boot/vmlinuz-4.15.0-132-generic
root@ubuntu:~#
as in the filesystem mounted as /
before the tmpfs was mounted over.
Why I am getting this result ?
CarloC
(385 rep)
Nov 11, 2024, 01:03 PM
• Last activity: Dec 2, 2024, 03:54 PM
14
votes
2
answers
23675
views
Mount error: mount failed: File exists
I am unable to mount my USB: $ mount /dev/sdb1 /mnt mount: mount /dev/sdb1 on /mnt failed: File exists What is the origin of this error and how do I mount my USB? The partition `/dev/sdb1` is not in `/etc/fstab`
I am unable to mount my USB:
$ mount /dev/sdb1 /mnt
mount: mount /dev/sdb1 on /mnt failed: File exists
What is the origin of this error and how do I mount my USB?
The partition
/dev/sdb1
is not in /etc/fstab
user123456
(5258 rep)
Dec 31, 2016, 11:12 AM
• Last activity: Nov 14, 2024, 11:47 PM
1
votes
2
answers
1122
views
nfs unmount on shutdown
I have a laptop with debian that I am mainly using on my home wifi. To access some network disks, I have a few lines like these in /etc/fstab: disk:/media/vol0 /home/disk0 nfs4 noauto,x-systemd.automount,x-systemd.device-timeout=10 disk:/media/vol1 /home/disk1 nfs4 noauto,x-systemd.automount,x-syste...
I have a laptop with debian that I am mainly using on my home wifi. To access some network disks, I have a few lines like these in /etc/fstab:
disk:/media/vol0 /home/disk0 nfs4 noauto,x-systemd.automount,x-systemd.device-timeout=10
disk:/media/vol1 /home/disk1 nfs4 noauto,x-systemd.automount,x-systemd.device-timeout=10
This works great when accessing, when I access the /home/disk1 directory on the laptop, the disk is being mounted. The problem is when shutting down, then my wifi is a user connection so it goes down when my user is logged out. Then the nfs unmount will hang. It used to be a 90 second delay which was a bit annoying, but acceptable, but after the last debian upgrade, it seems to be a infinite delay to retry to umount a nfs-disk when the server is unavailable. (I have so far not been waiting for a long time, this is according to the messages during shutdown) This means that I have to force shutdown the machine and I never get a clean umount of / among other problems.
The root cause for this problem is of course that I have a user defined network and a system defined nfs mount. I (think I) know how to define the wifi connection as a system service, but that would make other things difficult, so I wonder:
- Is there a setting to make the nfs a user defined mount so it would be taken down before the wifi connection goes down? or,
- How can I set the timeout for the umount?
(When typing this question, I realized that a possible workaround would be to set a idle time out on the nfs mount so it automatically unmounts when it is idle for a while, but for this to work, the timeout would have to be so short that it manages to unmount in the timespan from the last process accessing the mount is killed to the wifi is taken down, so maybe not)
MortenSickel
(1433 rep)
Jul 7, 2023, 01:43 PM
• Last activity: Nov 7, 2024, 09:37 PM
2
votes
3
answers
1731
views
List processes accessing device after `umount --lazy`
I want to remove my external HDD as safely as possible. I want to use `umount --lazy`: > Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.) Then after a short delay I pl...
I want to remove my external HDD as safely as possible.
I want to use
umount --lazy
:
> Lazy unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore. (Requires kernel
2.4.11 or later.)
Then after a short delay I plan to kill any processes with open files on the device where the filesystem is still quasi-mounted.
* I can't use lsof
for an accurate list of the open files as the filesystem has become invisible to new processes.
* If I use lsof
before umount -l
, there is a race contition of a new file being opened in between the two invocations.
Is there any way of finding out which processes are accessing a DEVICE rather than a filesystem?
Tom Hale
(32892 rep)
Aug 12, 2017, 08:01 AM
• Last activity: Aug 31, 2024, 08:50 PM
0
votes
1
answers
86
views
Can not change ISCSI disk mount point to other directory
**Problem:** I can not change ISCSI disk mount point to other directory. Currently I have ISCSI disk mounted to /iscsi2 I would like to change it to /iscsi I changed /iscsi2 to /iscsi in /etc/fstab, but mounting to /iscsi is unsuccessful. **Reproducing steps:** 1. Mount /iscsi2 based on /etc/fstab....
**Problem:** I can not change ISCSI disk mount point to other directory.
Currently I have ISCSI disk mounted to /iscsi2
I would like to change it to /iscsi
I changed /iscsi2 to /iscsi in /etc/fstab, but mounting to /iscsi is unsuccessful.
**Reproducing steps:**
1. Mount /iscsi2 based on /etc/fstab. Failed, because mountpoint is already renamed to /iscsi
mount /iscsi2
mount: can't find /iscsi2 in /etc/fstab
2. Mount /iscsi2 based on device path, successful.
mount /dev/sdd1 /iscsi2
3. Shows that it is mounted:
lsblk -af | grep -i iscsi
L¦sdd1 ext4 ISCSI_Backup2 3829ed05-f445-425d-8213-3b1c2d41fba /iscsi2
4. Unmount /iscsi2:
umount /iscsi2
5. Shows that it is unmounted:
lsblk -af | grep -i iscsi
L¦sdd1 ext4 ISCSI_Backup2 3829ed05-f445-425d-8213-3b1c2d41fba
6. Mount /iscsi based on device path. Failed.
mount /dev/sdd1 /iscsi
7. Shows that it is still unmounted:
lsblk -af | grep -i iscsi
L¦sdd1 ext4 ISCSI_Backup2 3829ed05-f445-425d-8213-3b1c2d41fba
Any idea why mount is successful to /iscsi2 and fails to /iscsi ?
klor
(426 rep)
Aug 5, 2024, 07:20 AM
• Last activity: Aug 6, 2024, 12:16 AM
0
votes
1
answers
312
views
mount: can't read superblock
Problem - Mount directory. sudo mkdir /mnt - sudo chmod -R 777 /mnt - sudo mount /dev/sdm1 /mnt, **will work** - Do some work.. - sudo umount /dev/sdm1, **will work** - sudo mount /dev/sdm1 /mnt, **will not work** Partial/Temp solution. Order probably doesn't matter but unplug and again mounting is...
Problem
- Mount directory. sudo mkdir /mnt
- sudo chmod -R 777 /mnt
- sudo mount /dev/sdm1 /mnt, **will work**
- Do some work..
- sudo umount /dev/sdm1, **will work**
- sudo mount /dev/sdm1 /mnt, **will not work**
Partial/Temp solution. Order probably doesn't matter but unplug and again mounting is solving the problem
- sudo rm -rf /mnt
- unplug the SSD from USB port
- plug the SSD in to the same USB port
- sudo mkdir /mnt
- sudo mount /dev/sdm1 /mnt, **will work**
Mounted SSD filesystem type is ext4. Able to repro this on 2 different servers easily.
dmesg
[1050337.453395] usb 2-3: reset SuperSpeed USB device number 15 using xhci_hcd
[1050337.474970] scsi host12: uas_eh_device_reset_handler success
[1050345.504717] sd 12:0:0:0: [sdm] tag#24 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=39s
[1050345.504740] sd 12:0:0:0: [sdm] tag#24 Sense Key : Hardware Error [current]
[1050345.504750] sd 12:0:0:0: [sdm] tag#24 ASC=0x44 >ASCQ=0x81
[1050345.504756] sd 12:0:0:0: [sdm] tag#24 CDB: Read(16) 88 00 00 00 00 01 d1 c0 be 00 00 00 00 08 00 00
[1050345.504760] blk_update_request: critical target error, dev sdm, sector 7814036992 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[1050345.507908] sd 12:0:0:0: [sdm] tag#25 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
[1050345.507914] sd 12:0:0:0: [sdm] tag#25 Sense Key : Hardware Error [current]
[1050345.507921] sd 12:0:0:0: [sdm] tag#25 ASC=0x44 >ASCQ=0x81
[1050345.507925] sd 12:0:0:0: [sdm] tag#25 CDB: Read(16) 88 00 00 00 00 01 d1 c0 be 00 00 00 00 08 00 00
[1050345.507927] blk_update_request: critical target error, dev sdm, sector 7814036992 op 0x0:(READ) flags 0x0 phys_seg 8 prio class 0
[1050345.510771] Buffer I/O error on dev sdm1, logical block 7814034944, async page read
[1050345.513125] Buffer I/O error on dev sdm1, logical block 7814034945, async page read
[1050345.514523] Buffer I/O error on dev sdm1, logical block 7814034946, async page read
[1050345.515875] Buffer I/O error on dev sdm1, logical block 7814034947, async page read
[1050345.517220] Buffer I/O error on dev sdm1, logical block 7814034948, async page read
[1050345.518671] Buffer I/O error on dev sdm1, logical block 7814034949, async page read
[1050345.519953] Buffer I/O error on dev sdm1, logical block 7814034950, async page read
[1050345.521229] Buffer I/O error on dev sdm1, logical block 7814034951, async page read
[1050345.530707] sd 12:0:0:0: [sdm] tag#26 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
[1050345.530715] sd 12:0:0:0: [sdm] tag#26 Sense Key : Hardware Error [current]
[1050345.530721] sd 12:0:0:0: [sdm] tag#26 ASC=0x44 >ASCQ=0x81
[1050345.530726] sd 12:0:0:0: [sdm] tag#26 CDB: Read(16) 88 00 00 00 00 00 00 00 08 02 00 00 00 02 00 00
[1050345.530728] blk_update_request: critical target error, dev sdm, sector 2050 op 0x0:(READ) flags 0x1000 phys_seg 1 prio class 0
[1050345.533268] EXT4-fs (sdm1): unable to read superblock
If the Filesystem is corrupted? Why I am able to solve this with unplug, mkdir and plug. I am not doing fsck or anything else.
Can someone help me understand what could be the issue? I am looking for solution where I don't need to unplug and plug the USB and probably without running fsck and bunch of other commands. Because I need to this on multiple devices with multiple mount programmatically
user1150896
(3 rep)
Jul 29, 2024, 11:21 PM
• Last activity: Jul 30, 2024, 03:24 PM
19
votes
9
answers
99621
views
umount /home does not work
I trying to merge my separate /home partition with my / partition in linux mint 13. I was told to umount /home, mount it on a different location and copy the contents to the /home directory on the / partition. I have tried, but I cannot umount /home. When I try to do so, I get a message: umount: /ho...
I trying to merge my separate /home partition with my / partition in linux mint 13.
I was told to umount /home, mount it on a different location and copy the contents to the /home directory on the / partition.
I have tried, but I cannot umount /home. When I try to do so, I get a message:
umount: /home device is busy (which processes use this device can be possibly be found with lsof or fuser)
How can I unmount my /home and mount it on a separate location (/dev/sda2/mnt/home) to be able to copy the contents to /home?
DutchArjo
(787 rep)
May 10, 2014, 07:47 PM
• Last activity: Jul 13, 2024, 10:16 AM
0
votes
0
answers
25
views
Device Notifier fails to safely remove USB drive Kubuntu
I have been using the command: rsync -av $localdir $usbdir to back up my local directories to NTSF formatted USB drives for years. I got a new system and now have a serious problem I am hoping someone can help with. I swap between two 2 2TB USB drives (formatted NTSF) with the idea I will always hav...
I have been using the command:
rsync -av $localdir $usbdir
to back up my local directories to NTSF formatted USB drives for years. I got a new system and now have a serious problem I am hoping someone can help with. I swap between two 2 2TB USB drives (formatted NTSF) with the idea I will always have a backup, even if one goes bad. The old computer (Kubunto 18.04.1) had no problems backing up its data and the I safely remove the drive. The new computer (Kubunto 18.04.5) backed up 64GB of data, but four hours after trying to safely remove the drive, the wheel was still spinning on the Device Notifier.
I checked and the drive was not mounted (not showing in df or in /media). I thought I could unplug the drive, as it was not mounted. That was a bad idea. The file system was corrupted and only chkdsk in Windows fixed it. All 64GB seemed to be there. But diff -rq showed differences for some directories. I deleted those, did rsync again and then the disk seemed fine.
For the second disk, I decided to rsync smaller chunks. The first chuck (17GB) no problem. The second chunk (23GB) same problems as before, though I waited five hours and after the chkdsk, folders were missing. I had 3.5GB to restore and that took a couple minutes. I did du -sh and all directories were the right size and diff -rq and all directories were the same. But trying to use the Device Notifier to safely remove the drive failed again. I couldn't even log out.
I have read that the files might not actually have been copied, but were buffered and the system needed to flush the buffer. However, I also thought once the drive was unmounted, it could be removed. When Device Notifier is displaying its wheel, nothing is using any CPU based on top).
Can someone suggest how to investigate this further. Are there some useful commands to help track down what is going on when Device Notifier is unhappy? I can't tell if it is hardware or software. And maybe how to safely remove the drive by some other method?
Thanks.
Jon Swanson
(1 rep)
May 19, 2024, 01:10 AM
9
votes
1
answers
3487
views
How do I cancel a stale "pending" drive mount with error "An operation is already pending"
The `An operation is already pending` error is very generic and many things can cause this. (other answers don't relate to my problem). I have a Luks encrypted volume that I clicked to open, a password prompt appeared, and I waited too long to enter the password. (It normally works just fine.) Now,...
The
An operation is already pending
error is very generic and many things can cause this. (other answers don't relate to my problem).
I have a Luks encrypted volume that I clicked to open, a password prompt appeared, and I waited too long to enter the password. (It normally works just fine.) Now, whenever I try to open it, I just get that error instead of the password prompt.
I'm sure rebooting the computer would fix it, but I don't want to do that... I'm sure it's just some sort of mount lock that needs to be manually released. How do I release the lock manually so I can try again?
The OS is Mate on Mint 17.3.
Nick
(1181 rep)
Dec 10, 2017, 04:08 PM
• Last activity: May 8, 2024, 04:08 AM
12
votes
6
answers
24592
views
Command line equivalent to "Safely remove drive"?
The file managers present in Linux Mint Cinnamon and MATE not only allow you to unmount external drives, but give you the option to "Safely remove" the drives as well, something not present in every Linux distribution. When I unmount my external hard drive (powered via USB), its indicator light rema...
The file managers present in Linux Mint Cinnamon and MATE not only allow you to unmount external drives, but give you the option to "Safely remove" the drives as well, something not present in every Linux distribution.
When I unmount my external hard drive (powered via USB), its indicator light remains lit and I can still hear it spinning. When I "Safely remove" the drive, the light turns off and the disc stops spinning.
**How can I accomplish this same thing via the terminal?** As a side question, is this functionality as simple as
unmount drive > kill power
or is there something more complicated or sophisticated going on behind the scenes? Is this safer than only unmounting the drive and pulling the USB plug out?
ArdentCertes
(345 rep)
Aug 19, 2017, 10:17 AM
• Last activity: Apr 3, 2024, 11:48 PM
2
votes
3
answers
421
views
Unmount all nested directories under path
**Let's consider these conditions:** - There's multiple **nested** mounts with a lot of folders/files in `/mnt`: ``` sdb 8:16 0 300G 0 disk ├─sdb1 8:17 0 256M 0 part /mnt/1/1 ├─sdb2 8:18 0 199.7G 0 part /mnt/2 └─sdb3 8:19 0 100G 0 part /mnt/3/1/2 ``` - Let's pretend I don't know which device(s) (suc...
**Let's consider these conditions:**
- There's multiple **nested** mounts with a lot of folders/files in
/mnt
:
sdb 8:16 0 300G 0 disk
├─sdb1 8:17 0 256M 0 part /mnt/1/1
├─sdb2 8:18 0 199.7G 0 part /mnt/2
└─sdb3 8:19 0 100G 0 part /mnt/3/1/2
- Let's pretend I don't know which device(s) (such as /dev/sdb
) are mounted under /mnt
(as I'd like to use this in a unattended script).
- The path to mounted directories aren't known either.
- not mounted
error shouldn't stop the process
**Here's what I've tried with illustration of the result:**
$ umount --all-targets --recursive /mnt; lsblk /dev/sdb
umount: /mnt: not mounted
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 300G 0 disk
├─sdb1 8:17 0 256M 0 part /mnt/1/1
├─sdb2 8:18 0 199.7G 0 part /mnt/2
└─sdb3 8:19 0 100G 0 part /mnt/3/1/2
$ umount --all-targets --recursive /mnt/*/**; lsblk /dev/sdb
umount: /mnt/2/boot: not mounted
umount: /mnt/2/ostree: not mounted
umount: /mnt/3/1: not mounted
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 300G 0 disk
├─sdb1 8:17 0 256M 0 part
├─sdb2 8:18 0 199.7G 0 part /mnt/2
└─sdb3 8:19 0 100G 0 part /mnt/3/1/2
$ umount --all-targets --recursive /mnt/*?; lsblk /dev/sdb
umount: /mnt/1: not mounted
umount: /mnt/3: not mounted
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 300G 0 disk
├─sdb1 8:17 0 256M 0 part /mnt/1/1
├─sdb2 8:18 0 199.7G 0 part
└─sdb3 8:19 0 100G 0 part /mnt/3/1/2
$ umount --all-targets --recursive /mnt/*/**?; lsblk /dev/sdb
umount: /mnt/2/boot: not mounted
umount: /mnt/2/ostree: not mounted
umount: /mnt/3/1: not mounted
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 300G 0 disk
├─sdb1 8:17 0 256M 0 part
├─sdb2 8:18 0 199.7G 0 part /mnt/2
└─sdb3 8:19 0 100G 0 part /mnt/3/1/2
Is there any good way of doing this without installing any extra packages?
GrabbenD
(170 rep)
Sep 28, 2023, 09:19 AM
• Last activity: Mar 29, 2024, 07:33 PM
1
votes
1
answers
76
views
Mounting directories on demand or until logged
As from object, I want to mount some directories (with binding) at login and possibly unmount them at logout. At the beginning I tought about autofs, but it dynamically creates mount points, that's ok with cli, but not when using filemanagers, it's really annoying to have to write a directory name t...
As from object, I want to mount some directories (with binding) at login and possibly unmount them at logout.
At the beginning I tought about autofs, but it dynamically creates mount points, that's ok with cli, but not when using filemanagers, it's really annoying to have to write a directory name to make it spawn.
Another solution I considered is running a login script, and it works. My problem now is that I don't know how to unmount them. I use LightDM, so
.bash_logout
is not an option, and also if that login manager can trigger a script when logging out, it runs system wide, and I'd prefer a solution user based.
Thanks in advance
Daniele
(478 rep)
Mar 26, 2024, 04:08 PM
• Last activity: Mar 27, 2024, 12:15 PM
1
votes
0
answers
199
views
How to unmount an external hard drive in linux?
I have an external Toshiba 2TB hard drive with two partitions. The relevant partition is of type BTRFS and mounted in my Parrot OS system. I want to use it for backup purposes but I have a hard time to copy files in Linux for years. For test purposes I copied 4MB to the partition with a glorious spe...
I have an external Toshiba 2TB hard drive with two partitions.
The relevant partition is of type BTRFS and mounted in my Parrot OS system.
I want to use it for backup purposes but I have a hard time to copy files in Linux for years.
For test purposes I copied 4MB to the partition with a glorious speed of 100kB/s.
Eventually, Parrot OS told me it is done with.
I could also browse the files on the mounted partition.
But now I have no idea how to unmount the hard drive without loosing data.
Via the GUI nothing happens and also a "sudo umount -l ..." just hangs.
It simply keeps Parrot OS busy for hours without anything happening (the external hard drive is flashing).
If I unplug the hard drive the copied data is gone when I mount it the next time.
Any ideas?
It seems like as soon as the hard drive is used (e.g. copy action) it never comes to a rest again. It just keeps flashing and flashing. If I attempt to shutdown my computer it just hangs in the shutdown window or sometimes throws me in a login screen again.
**Update**
I forgot to mention that I use a notebook (ASUS UX331U). Yesterday, when I experienced the problems the notebook was not connected to an external power supply. When I connected the notebook yesterday evening and again today, the copy process to the external hard drive of type TOSHIBA Canvio Flex 2TB went as expected. The copy speed was higher than ever and when the system confirmed that the process finished I had no issues whatsoever with unmounting the device. I still do not know what the exact issue is and whether I have to fear some hardware failure of my notebook or the external hard drive anytime soon. Yesterday, I formatted the partition from NTFS to BTRFS. My notebook is often connected to power supply and copying files was already an issue for a long time. However, maybe I was in the unlucky situation that not only one reason was causing issue but a mix of several factors.
I forgot to mention that I use a notebook (ASUS UX331U). Yesterday, when I experienced the problems the notebook was not connected to an external power supply. When I connected the notebook yesterday evening and again today, the copy process to the external hard drive of type TOSHIBA Canvio Flex 2TB went as expected. The copy speed was higher than ever and when the system confirmed that the process finished I had no issues whatsoever with unmounting the device. I still do not know what the exact issue is and whether I have to fear some hardware failure of my notebook or the external hard drive anytime soon. Yesterday, I formatted the partition from NTFS to BTRFS. My notebook is often connected to power supply and copying files was already an issue for a long time. However, maybe I was in the unlucky situation that not only one reason was causing issue but a mix of several factors.
Green
(51 rep)
Mar 14, 2024, 10:06 AM
• Last activity: Mar 15, 2024, 12:27 PM
1
votes
1
answers
51
views
zsh completion for umount: limit completion to one argument
when I use zsh completion for the `umount` command: umount /mnt/t it completes the mounted filesystem `/mnt/tmp`. But when I accidentally press tab too many times, it tries to be too helpful, and suggests other mountpoints, which leads to nonsense completions such as: umount /mnt/tmp / how can I lim...
when I use zsh completion for the
umount
command:
umount /mnt/t
it completes the mounted filesystem /mnt/tmp
.
But when I accidentally press tab too many times, it tries to be too helpful, and suggests other mountpoints, which leads to nonsense completions such as:
umount /mnt/tmp /
how can I limit umount completion to one mountpoint only, so that further tabs will not add any further arguments?
I think I have located the relevant section in /usr/share/zsh/functions/Completion/Unix/_mount
:
# Completion for umount.
local excl='-V --version -h --help'
args=(
'(- *)'{-h,--help}'[show help]'
'(- *)'{-V,--version}'[show version]'
"($excl -v --verbose)"{-v,--verbose}'[verbose mode]'
"($excl -n --no-mtab)"{-n,--no-mtab}"[don't write /etc/mtab]"
"($excl)-r[remount read-only on failure]"
"($excl)-d[for loopback mount, free loop device]"
"($excl)-i[don't call /sbin/umount. helper]"
"($excl *)-a[unmount all file systems from /etc/mtab]"
"($excl)-t[specify file system type]:file system type:_file_systems"
"($excl *)-O[with -a, restrict filesystems by options]:file system option:->fsopt"
"($excl)-f[force unmount]"
"($excl)-l[lazy unmount]"
'*:dev or dir:->udevordir'
)
_arguments -C -s "$args[@]" && ret=0
what do I need to modify?
Martin Vegter
(586 rep)
Mar 7, 2024, 03:39 PM
• Last activity: Mar 7, 2024, 05:48 PM
Showing page 1 of 20 total questions