LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-15-2020, 08:51 PM   #1
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,963

Rep: Reputation: 271Reputation: 271Reputation: 271
What drives does df query?


When I run df, I get
Quote:
df: /usb: Input/output error
Why does df query /usb? It was mounted on /dev/sdb1, but that device is now absent, had been properly unmounted. There was an entry for /usb in /etc/mtab, but I deleted it. When I attach a usb device, it gets /dev/sdc, so the system thinks /dev/sdb isn't available.
 
Old 03-15-2020, 09:41 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,805

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
What does this command output?
Code:
sudo blkid
 
Old 03-15-2020, 10:43 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
There might be interesting information in the message buffer, for example
Code:
dmesg | grep -C 4 sdb
A reboot should fix that anyway.

Edit: partprobe and partx could be useful tools here as well. Perhaps the kernel thinks that one of the sdb partitions is still in use and needs to be told that this is not so. partx allows editing the kernel's copy of the partition table.

Last edited by berndbausch; 03-15-2020 at 10:45 PM.
 
Old 03-16-2020, 12:47 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
for me that means: the system thinks /usb is still available, was not properly detached. As it was mentioned a reboot should help. Also you need to give more details if it [will] happen again.
You may find additional info in /var/log (about all the events related to it, like mount/umount/eject...)

If I remember well manual editing of /etc/mtab is pointless, but it may depend on your OS.
 
Old 03-16-2020, 08:09 AM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,963

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by ferrari View Post
What does this command output?
Code:
sudo blkid
Quote:
/dev/sda1: UUID="c4c9a606-76ac-49cc-a7c6-2a32c20978b2" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="136bebb0-01"
/dev/sda2: UUID="20fa2d53-bbf4-4f5c-b6a1-04235aa24480" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="136bebb0-02"
/dev/sr1: BLOCK_SIZE="2048" UUID="2014-03-28-11-03-18-00" LABEL="Mobile Hotspot" TYPE="iso9660" PTTYPE="mac"
Quote:
Originally Posted by berndbausch View Post
There might be interesting information in the message buffer, for example
Code:
dmesg | grep -C 4 sdb
returns a slew of errors. It seems that although umount /usb returned no errors to stderr it failed and recorded errors in logs.


Quote:
Originally Posted by berndbausch View Post
A reboot should fix that anyway.
Yes. I didn't ask for a fix. I asked what df was consulting that made it query /usb. Perhaps a cached version of /etc/mtab? What can I make it do so that it doesn't?

Quote:
Originally Posted by berndbausch View Post
Perhaps the kernel thinks that one of the sdb partitions is still in use and needs to be told that this is not so.
I asked how to tell the kernel that no sdb partition is in use.


Quote:
Originally Posted by berndbausch View Post
partx allows editing the kernel's copy of the partition table.
partx tells me /dev/sdb isn't.

Quote:
Originally Posted by pan64 View Post
for me that means: the system thinks /usb is still available, was not properly detached.
So I think. I asked what df consulted.

Quote:
Originally Posted by pan64 View Post
As it was mentioned a reboot should help.
I didn't ask for help.

Quote:
Originally Posted by pan64 View Post
Also you need to give more details if it [will] happen again.
You may find additional info in /var/log (about all the events related to it, like mount/umount/eject...)
It's happening now.
Quote:
Originally Posted by pan64 View Post
If I remember well manual editing of /etc/mtab is pointless, but it may depend on your OS.
It makes mount not query.
 
Old 03-16-2020, 08:35 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
Quote:
Originally Posted by RandomTroll View Post

It makes mount not query.
Are you sure about that? mtab is a "virtual" file, actually generated when you want to read it, editing it is just pointless. But its "implementation"/behavior depends on the OS.
 
Old 03-16-2020, 04:48 PM   #7
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,793

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Traditionally /etc/mtab is a file created in parallel to the kernel memory, and df looked at it.
In Linux /proc/mounts is an ASCII representation of the kernel memory.
Recent distos make /etc/mtab a symlink to /proc/mounts. (Check with ls -l)
Then is is quite clear: the mount and df commands must use /proc/mounts.
 
1 members found this post helpful.
Old 03-16-2020, 05:33 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Hmmm - maybe you should run strace over df before making definitive statements.

As the OP wants no help, I'll offer none.
 
Old 03-16-2020, 09:08 PM   #9
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,963

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by pan64 View Post
Are you sure about that? mtab is a "virtual" file, actually generated when you want to read it, editing it is just pointless. But its "implementation"/behavior depends on the OS.
Quote:
Originally Posted by MadeInGermany View Post
Traditionally /etc/mtab is a file created in parallel to the kernel memory, and df looked at it.
I have occasional problems with flash drives umounting without complaint but the kernel thinking they're still mounted, reserving the device, e.g., /dev/sdb I have cleared them sometimes by editing /etc/mtab.

Quote:
Originally Posted by MadeInGermany View Post
In Linux /proc/mounts is an ASCII representation of the kernel memory.
/proc/mounts is what I was looking for, thanks.

Quote:
Originally Posted by MadeInGermany View Post
Recent distos make /etc/mtab a symlink to /proc/mounts. (Check with ls -l)
Not the latest Slackware. I can cat them both simultaneously, see the differences, though mtab seems to be a subset of mounts.

Quote:
Originally Posted by MadeInGermany View Post
Then is is quite clear: the mount and df commands must use /proc/mounts.
mount doesn't report /usb being mounted when df complains that it can't query it.

Quote:
Originally Posted by syg00 View Post
As the OP wants no help, I'll offer none.
Thanks.
 
Old 03-17-2020, 11:04 AM   #10
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by RandomTroll View Post
When I run df, I get Why does df query /usb? It was mounted on /dev/sdb1, but that device is now absent, had been properly unmounted. There was an entry for /usb in /etc/mtab, but I deleted it. When I attach a usb device, it gets /dev/sdc, so the system thinks /dev/sdb isn't available.
I'm not sure if it'll make your USB problem go away but you should at least be able to find out what "df" is looking at to find the USB device by running:
Code:
strace df
Sorry... I don't have any phantom USB devices lingering on my system or I'd post some strace output as an example.

HTH...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Query (and maybe a dependent query) on alsamixer. ajaygarg Linux - Newbie 4 12-20-2011 12:31 AM
interesting MySQL query/view query :s mjh Programming 3 03-25-2008 07:30 AM
mysql use output of one query in another query secretlydead Programming 2 11-19-2007 01:25 AM
non Recursive query and Recursive query prashsharma Linux - Server 1 06-27-2007 09:33 AM
help with mysql query: return nth rows in query hawarden Programming 2 07-31-2006 06:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration