LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is there a way to show only ACTUAL normal mounted devices? Lot of distros seem to put lot of stuff in there (https://www.linuxquestions.org/questions/linux-software-2/is-there-a-way-to-show-only-actual-normal-mounted-devices-lot-of-distros-seem-to-put-lot-of-stuff-in-there-4175675783/)

Red Squirrel 05-23-2020 08:43 PM

Is there a way to show only ACTUAL normal mounted devices? Lot of distros seem to put lot of stuff in there
 
On some distros there's so much junk to sift through when you do mount -l to see what is mounted. I just want to see actual disk devices, not 50+ system devices. Is there a way to streamline that? Maybe another argument than -l that I should be using or another command altogether?

berndbausch 05-23-2020 10:28 PM

You can provide the filesystem type, e.g.
Code:

mount -t ext4 -t xfs -t vfat
This works on Ubuntu 16.04.
EDIT: It doesn't quite work; it seems that the mount command only takes into account the last -t option.
EDIT2: While looking into this, I found this very interesting paragraph in the mount manual page:
Quote:

The listing mode is maintained for backward compatibility only.
For more robust and customizable output use findmnt(8), especially in your
scripts. Note that control characters in the mountpoint name are replaced
with '?'.
That's one reason why I like answering questions. It forces me to think and research, and I occasionally learn something.

Or use good old grep to trim the list:
Code:

mount -l | grep -v -e /sys -e /run
Or filter for dev:
Code:

mount -l |grep /dev/

syg00 05-23-2020 10:33 PM

df ?.

berndbausch 05-24-2020 12:31 AM

Quote:

Originally Posted by syg00 (Post 6126508)
df ?.

While your answer is more efficient than mine, I don't know if df delivers the same clarity of insight as mount.

rnturn 05-24-2020 12:34 AM

Quote:

Originally Posted by berndbausch (Post 6126507)
You can provide the filesystem type, e.g.
Code:

mount -t ext4 -t xfs -t vfat
This works on Ubuntu 16.04.
EDIT: It doesn't quite work; it seems that the mount command only takes into account the last -t option.

<snip>

You can also add:
Code:

$ mount | grep -E 'ext|xfs|vfat|btrfs'
to the various ways to skin this cat.

scasey 05-24-2020 12:39 AM

Quote:

Originally Posted by berndbausch (Post 6126507)
You can provide the filesystem type, e.g.
Code:

mount -t ext4 -t xfs -t vfat
This works on Ubuntu 16.04.
EDIT: It doesn't quite work; it seems that the mount command only takes into account the last -t option.

This:
Code:

More than one type may be specified in a comma separated list.
So:
Code:

mount -t ext4,xfs,vfat
Perhaps?

berndbausch 05-24-2020 02:37 AM

Quote:

Originally Posted by scasey (Post 6126531)
This:
Code:

More than one type may be specified in a comma separated list.
So:
Code:

mount -t ext4,xfs,vfat
Perhaps?

One never ceases to learn.

syg00 05-24-2020 02:57 AM

One hopes so - should that day ever come, we're in real strife.

scasey 05-24-2020 03:48 AM

I think that’s what we’re here for...to learn...the teaching is but a plus.

Red Squirrel 05-24-2020 12:42 PM

Damn so there's no easier way? I don't really want to have to type up all that each time. I can make a script, but that won't always be available on a new or foreign system.

I guess that's probably the best bet though, if I make the script universal enough I can just make it part of my "deploy kit" which is basically a set of helper scripts I load on any machine I setup.

I don't like having to specify each file system though, if a new file system comes out or there is one I don't know about then I won't see that mount point. I could maybe use df, and then get the mount names, then check those individually. Essentially could just make my own mount script to check the mount points. Though grep is a good idea too, if I get rid of anything in /sys, /proc etc it will clean up the list. Can just make a new command called showmounts or something and throw in in /usr/bin.

michaelk 05-24-2020 01:03 PM

Alternative? The output of the lsblk will show all physical block devices which could be large and their mount points if mounted.

berndbausch 05-24-2020 01:50 PM

Quote:

Originally Posted by Red Squirrel (Post 6126780)
Damn so there's no easier way? I don't really want to have to type up all that each time.

I don't think "df" is too much typing. Even "findmnt --real" isn't very long.

pan64 05-24-2020 02:24 PM

I would say if you have a special requirement you need to implement it. Either you use what was suggested or make a script/function/alias to filter whatever you need from the output of any command and also to print it in your preferred format.
It looks like there is no ready made solution for you (or at least we don't know about it). Actually the expression "normal mount" is not really well defined.

Red Squirrel 05-24-2020 04:54 PM

Quote:

Originally Posted by berndbausch (Post 6126798)
I don't think "df" is too much typing. Even "findmnt --real" isn't very long.

Ohhh I missed that, did not know about findmnt. That may be exactly what I need thanks.

ondoho 05-25-2020 02:16 AM

df also spits out some tmpfs and /run partitions.
Code:

mount -t ext4 -l
does pretty much exactly what you desire - but that's only because all my partitions are ext4.


All times are GMT -5. The time now is 04:02 AM.