LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-15-2018, 11:52 AM   #1
mstrimel
Member
 
Registered: Apr 2004
Location: USA
Distribution: Mint 19 Cinnamon
Posts: 35

Rep: Reputation: 0
df giving weird output for /dev/sdb


hi,
I used to run "df -h" to check how full my disks are. Several partitions of /dev/sdb are mounted as /mount/music and /mount/photos and are working normally. However:
Code:
mary@mythbox:~$ df -H /dev/sdb*
Filesystem      Size  Used Avail Use% Mounted on
udev            4.2G     0  4.2G   0% /dev
udev            4.2G     0  4.2G   0% /dev
udev            4.2G     0  4.2G   0% /dev
udev            4.2G     0  4.2G   0% /dev
udev            4.2G     0  4.2G   0% /dev
udev            4.2G     0  4.2G   0% /dev
and:
Code:
mary@mythbox:~$ sudo fdisk -l
[sudo] password for mary: 
Disk /dev/sda: 74.5 GiB, 80026361856 bytes, 156301488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000ee1e5

Device     Boot    Start       End  Sectors  Size Id Type
/dev/sda1  *        2048  58636287 58634240   28G 83 Linux
/dev/sda2       58637311 156296384 97659074 46.6G  5 Extended
/dev/sda5       58637313  70396829 11759517  5.6G 82 Linux swap / Solaris
/dev/sda6       70396893 156296384 85899492   41G 83 Linux


Disk /dev/sdb: 596.2 GiB, 640135028736 bytes, 1250263728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000199e8

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1              63 204796619 204796557  97.7G 83 Linux
/dev/sdb2       204796620 409593239 204796620  97.7G 83 Linux
/dev/sdb3       409593240 493564994  83971755    40G 83 Linux
/dev/sdb4       493564995 739327364 245762370 117.2G  5 Extended
/dev/sdb5       493568000 739325951 245757952 117.2G 83 Linux


Disk /dev/sdc: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4242d502

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sdc4        115310592 1953523711 1838213120 876.5G  5 Extended
/dev/sdc5       1487773696 1953523711  465750016 222.1G 83 Linux
/dev/sdc6        115312640 1487771647 1372459008 654.5G  7 HPFS/NTFS/exFAT

Partition table entries are not in disk order.
How can I see the view of /dev/sdb that I used to see by running df -h, which showed the mount points and the usage?
 
Old 09-15-2018, 12:00 PM   #2
hazel
Senior Member
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: Debian, Crux, LFS, AntiX
Posts: 2,162
Blog Entries: 5

Rep: Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939Reputation: 939
df only works on mounted partitions. What you are seeing is the typical output for an unmounted partition. The files are not accessible so df can't tot them up and tell you how much space is being used. There's nothing weird about this; it's supposed to behave this way.

fdisk -l shows all the partitions, whether mounted or not, because it uses the partition table to find them. But it can't tell you how much of the allocated space is being used.

Either mount the partitions and use df or use parted/gparted. These programs do much the same job as fdisk but show usage too.
 
Old 09-15-2018, 12:34 PM   #3
mstrimel
Member
 
Registered: Apr 2004
Location: USA
Distribution: Mint 19 Cinnamon
Posts: 35

Original Poster
Rep: Reputation: 0
That’s the thing. I can browse my photos and play my music, soothing they are mounted already. Will check again when back at the computer.
 
Old 09-15-2018, 12:59 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,481

Rep: Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284Reputation: 2284
The output of the lsblk command shows the device and its mount point.

Does the output of the df command without the device ID show all the proper mount points?

df -h

I think I understand... df reads /proc/self/mountinfo for its data. Your command used to work because /proc/self/mountinfo contained the device IDs i.e. /dev/sdb1 but now it uses UUIDs due to newer kernels.

Last edited by michaelk; 09-15-2018 at 01:35 PM. Reason: update
 
Old 09-15-2018, 08:50 PM   #5
mstrimel
Member
 
Registered: Apr 2004
Location: USA
Distribution: Mint 19 Cinnamon
Posts: 35

Original Poster
Rep: Reputation: 0
lsblk shows the correct mount points:
Code:
sdb      8:16   0 596.2G  0 disk 
├─sdb1   8:17   0  97.7G  0 part /media/mary/music
├─sdb2   8:18   0  97.7G  0 part /media/mary/home_video1
├─sdb3   8:19   0    40G  0 part /media/mary/photos1
├─sdb4   8:20   0     1K  0 part 
└─sdb5   8:21   0 117.2G  0 part
Weirdly, I then had to wait a few minutes, and df -h shows the mount points again.
Thanks for your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
/dev/sdb: read failed after 0 of 4096 at 0: Input/output error deep27ak Linux - Hardware 3 07-24-2015 06:02 AM
[SOLVED] intel mfsys25 centos /dev/sdb [Input/output error] sangreal Linux - Server 1 10-04-2014 05:19 AM
Can i dd if=/dev/sdb of=/dev/sdc if hdsize(sdb)>hdsize(sdc) & size(sdb)<hdsize(sdc) ? ununun Linux - Software 6 06-28-2011 11:48 AM
The modulus operator in UNIX throws random values giving weird output gaynut Programming 5 07-08-2008 12:15 AM
df -h is giving weird output chens_83 Linux - General 2 12-09-2002 11:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration