Page 1 of 1

USB disconnections

Posted: Sat Mar 12, 2022 8:38 am
by Clarity

This can be termed a BUG, but maybe a designed misunderstanding.

When a USB stick is disconnected from ANY modern PC since 2000, the system detects and know of it.

So, if it 'was' mounted, it is no longer mounted and its mount-point is now a phantom in the system.

Shouldn't the PUP distro release the phantom left by the USB disconnecton when the USB is removed as should be expected?

IS this a bug?


Re: USB disconnections

Posted: Sat Mar 12, 2022 2:14 pm
by bigpup

Just to make sure.
You have unmounted the USB before removing it?

Is this in a specific Puppy version or everyone you have used?

You are talking about the mount-point still being in /mnt/ ?


USB disconnections is a BUG

Posted: Sat Mar 12, 2022 7:24 pm
by Clarity

Hi @bigpup Answers: This is a phenom in PUPs when a USB is removed. Even if you re-insert the same USB back into the same port, the old mount-point will NOT be used leaving the phantom in the system.

If the device is removed, no matter if it was un-mounted or not, it is gone. So why should the PUP maintain a 'phantom'; namely the old mount-point? It serves NO meaningful purpose to the running future of the system nor the use/reuse of USB?

This is a bug in logic and implementation.

There must be a good reason why these phantoms remain after the mounted USB device is, physically, removed. Maybe it is something hardware or maybe its a coding artifact that lingers in the system.

Hopefully development will address this concern.

Even as this may be a bug, it is minor and does NOT crash the system.


Re: USB disconnections

Posted: Sat Mar 12, 2022 9:15 pm
by Phoenix

The reason to not automatically unmount a forcibly removed device even when its no longer connected is because, what happens if your computer kicks out your own puppy USB? Particularly this applies if nocopy is used meaning the link is maintained to the USB. And the implementation will not permit you to unmount because aufs still has a leash on it. (Any sane layering filesystem should) It will set to read-only though to acknowledge that the device is no longer connected. Also why delete the mount-point folder when it could be reused? Its rather pointless to waste writes to create directories for mount-points that can be reused as the kernel automatically reuses device nodes (device nodes are temporary, they do not exist anywhere else) that are not used.


Re: USB disconnections

Posted: Sat Mar 12, 2022 9:46 pm
by Feek

Shouldn't the PUP distro release the phantom left by the USB disconnecton when the USB is removed as should be expected?
IS this a bug?

Hi Clarity,

I am also aware that after disconnecting the USB stick, its empty folder remains in /mnt.
I didn't consider it as a bug, even if I thought about the purpose a few times.

I'm now in Fatdog.
I inserted a USB stick, mounted it (sdb1), then unmounted and ejected.
Pfind shows that only one empty folder (/mnt/sdb1) remained in the system. Nothing more.

Then I inserted another USB stick.
The system named it again sdb1 and also assigned to the previously created sdb1 folder (in /mnt).

I already got used to it. No problem at all.


Re: USB disconnections

Posted: Sun Mar 13, 2022 12:36 am
by Clarity

Thanks @Feek. Yes, that is true regarding a device that is "unmounted" before ejection or removal.

BUT, if you remove/eject without, first, doing a unmount, then the mount-point become a phantom.

Phantoms have no purpose when the real device is gone from the PC's hardware.


Re: USB disconnections

Posted: Sun Mar 13, 2022 3:43 am
by bigpup

So you are doing it wrong and wondering why the file system still has it as a mount point?

If you do not give the command to unmount it.
Why do you think when you remove it wrong, without first unmounting it.
It is going to auto unmount it and no longer have it a active mount point.

Puppy has never had auto unmount for unplugging a USB.

Puppy has never been much about doing anything automatically.


Re: USB disconnections

Posted: Sun Mar 13, 2022 6:41 am
by greengeek
Clarity wrote: Sun Mar 13, 2022 12:36 am

Thanks @Feek. Yes, that is true regarding a device that is "unmounted" before ejection or removal.
BUT, if you remove/eject without, first, doing a unmount, then the mount-point become a phantom.

What happens when you do this in Windows?


Re: USB disconnections

Posted: Sun Mar 13, 2022 2:26 pm
by bigpup

Windows 10 since 218 has had the quick removal ability for USB drives.
Basically you just pull it out of the port.

However, now that USB drives are defaulted for “quick removal,” the system can no longer cache disk write operations, which results in slower performance.

So, this is basically why you need to first unmount before removal.
Puppy does use cache disk write operations.
So, if still writing to the USB, when you just pull it out.

You probably will get corruption and errors with incomplete files.

I have seen this happen.
I was putting large amount of stuff on a USB.
File manager showed it was completed.
But when I tried to unmount USB drive, it would not unmount.
Stuff was still being written to the USB drive from the cache.
A short time latter, after all was written from the cache.
USB drive would unmount.


Re: USB disconnections

Posted: Sun Mar 13, 2022 5:02 pm
by Clarity

More information on this bug is found on this ansxillary thread started after this Bug Report thread.


Re: USB disconnections

Posted: Mon Mar 14, 2022 6:23 pm
by Phoenix

@Clarity Linux will not auto unmount even though you have forcibly removed it. This is not a kernel feature, it is a configuration feature present to the software used. (e.g udev).

Also umount will not permit 'unmount' if it happens that the device is in use. (via aufs or writing/reading) Until the system gives up on writing/reading or aufs releases it, you cannot release the device. (For example you can load in SFS on other partitions even though it suggests you copy to the home partition)

I believe its bad practice to auto unmount. It would encourage people to not damage or lose data unlike Windows which has dropped the caching function. We already have icons for unmounting and mounting, and since people now have to mount it stands to reason that they should have to unmount it themselves.