is there a command to know at which partition label is mounted /
for example my / is mounted at partition with label “suse1”, how can I get “suse1”??
manythanks, ciao, pier
Do you mean that he file system that is mounted at / has the (volume) label suse1?
You could use
ls -l /dev/disk/by-label
because the system (udev) creates there links to the device files with names of the labels it found.
yes, I can see the label associated with /sdaX, but in the output I cannot find any association between “/” and where it is mounted, and this I need
pla@pla-3-TW:~> ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 10 Aug 28 17:10 dati -> ../../sda8
lrwxrwxrwx 1 root root 10 Aug 28 17:10 home1 -> ../../sda5
lrwxrwxrwx 1 root root 10 Aug 28 17:10 home2 -> ../../sda7
lrwxrwxrwx 1 root root 15 Aug 28 17:09 SDCARD116G -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Aug 28 17:10 suse1 -> ../../sda3
lrwxrwxrwx 1 root root 10 Aug 28 17:10 suse2 -> ../../sda6
lrwxrwxrwx 1 root root 10 Aug 28 17:10 swap -> ../../sda2
pla@pla-3-TW:~>
lsblk -f
/10char
/ is not mounted. A file system is mounted on /. Exactly the other way around as you seem to think.
And because a file system is stored on some volume of mass storage and because very often this mass storage volume is in the form of a partition, to keep things short, many people talk about “a partition is mounted on a directory” (and that directory then becomes a mount point by definition).
When you want to know what is mounted where:
mount
But I admit that nowadays the output is rather bewildering because all sorts of mounting is done for special purposes (like Btrfs snapshotting).
But the following must single out / :
mount | grep ' / '
manythanks
/ is not mounted. A file system is mounted on /. Exactly the other way around as you seem to think.
yes, you are right, mine is a wrong “way-to-say” (I don’t know if it is correct, it is a literal traduction of italian “modo di dire” )
…I think that a combination of yours suggestions will lead me to a solution
this
pla@pla-3-TW:~> lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1
├─sda2 [SWAP]
├─sda3 /suse-other
├─sda4
├─sda5 /home-other
├─sda6 /
├─sda7 /home
└─sda8 /dati
and this better
pla@pla-3-TW:~> mount | grep ' / '
/dev/sda6 on / type ext3 (rw,relatime,data=ordered)
pla@pla-3-TW:~>
gives me an association between / and /dev/sdaX
and this
pla@pla-3-TW:~> ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 10 Aug 28 17:10 dati -> ../../sda8
lrwxrwxrwx 1 root root 10 Aug 28 17:10 home1 -> ../../sda5
lrwxrwxrwx 1 root root 10 Aug 28 17:10 home2 -> ../../sda7
lrwxrwxrwx 1 root root 15 Aug 28 17:09 SDCARD116G -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Aug 28 17:10 suse1 -> ../../sda3
lrwxrwxrwx 1 root root 10 Aug 28 17:10 suse2 -> ../../sda6
lrwxrwxrwx 1 root root 10 Aug 28 17:10 swap -> ../../sda2
pla@pla-3-TW:~>
an association between /sdaX and label
…I will try with cat and sed to get something, …in case of fail I’ll ask
Hi
You need to be root user for lsblk -f, there is also blkid. Both will show labels for mounted and unmounted partitions.
thank you, the lsblk as root gives me all the associations.
but I don’t know how to use root automatically without password, so for now, in my very newbby way I used this:
strZ=`mount | grep " / "` && strX=`echo ${strZ:4:5}` && strW=`ls -l /dev/disk/by-label | grep $strX` && numB=`expr index "$strW" ":"` && numA=`expr index "$strW" ">"` && echo ${strW:$((numB+3)):$((numA-numB-3-3))}
and seems to works
Normally, in a sane, well managed, dependable, Linux and UNIX® world, the user “root” is ** NEVER ** “automatically used”.
If, there are some “privileged” scenarios which need the privileges of the user “root” which some users frequently need to execute then, it’ll pay to setup “sudo” to allow those users which need to (usually system administrators and/or personnel who are charged with the responsibility to backup systems), to execute the scripts which call the commands which need the privileges of the user “root”.
And to that not only belongs a meticulous configuring of sudo, but also a correct place for such a script with the correct ownership and permissions and likewise for the directories in the path leading to it. It might be even a good questions if such an executable may be in the form of a script or that it better should be a binary program. Of course such a program may not have any features that allow e.g. to escape to a shell.
:)manythanks guys:)
…I suspect that you are telling me that is better to use user instead rootlol!
Not really . . .
The user “root” is, for cases applicable to private machines being used personally by a human being with an acceptable (for private usage) level of system security, the “user name” to be used for system administration tasks.
For an awful amount of all the other machine classes, the same applies . . .Only in commercial and community scenarios where System Security is a somewhat larger issue, should consideration be given to performing system administration tasks with specific users with system privileges carefully trimmed to the administration task to be performed (e.g. user backups, department backups, etc., etc.).
Curious readers may delve into the world of SELinux and access control policies (expected time needed to understand the ramifications of these security levels == at least a half a year study plus, at least 2 years practical experience) . . .
In other words, the default Linux security policy of having a user named “root” to perform system administration tasks is, “more than good enough” for private usage and, “usually good enough” for many other usage cases.
Well, I think part of what you get answered is due to the fact that you violated the good advice in Describe the goal, not the step.
We have no idea why you asked this, if it something you just want to know because you have lost the tracl of what labels were once given to which file systems and thus will execute it only once (carefully as root) so you know again, or that you want to embed this in a large script that should run every five minutes (by an end-user) to achieve a, to us unknown, action.
Thus you can expect a bewildering amount of answers and advice, most of which will not be applicable to your situation. But you asked for it and people here are very helpful. To the amount of covering you with an enormous heap of information. rotfl!
I see that a company named “Kepner-Tregoe” is still offering a training course named “Analytical Troubleshooting”.
There’s also the method mentioned by a Toyota manager at about the same time: “If you wish to determine the real cause of a failure, you have to ask ‘why’ at least seven times.”
Bottom line: “In a perfect world, human beings ask perfect questions. The world isn’t perfect and, they don’t.”
rotfl! …time ago I asked here how to made a very basic plasmoid that execute commands and give the result on desktop, so, I have my pc with three boot, suse the most stable, suse the most advanced but not tumbleweed, windows, so, when I’m using windows I recognize easily, but when using suse I don’t know what I’m using, so I have some plasmoids that show me the suse version, plasma version, kde framework version, kernel version, libreoffice version, host name, …and now, after some problems with hard disk, I would like to know which partition is mounted at / mountpoint;)
http://paste.opensuse.org/view/download/97881004
…so manythanks to helpfulness of suse people
Programming rule #1:“Take a look at the source code of something that does something similar to what is wished for and, re-use that code in a modified form.”
[INDENT=2]Is there really no source code available for KDE Plasmoids which do similar things to what is wanted here?
[/INDENT]
Programming rule #2:“Maintain a personal library of all the code you have written – assuming that, your contract allows you to do that.”
[HR][/HR]Digging out system information:
- It’s always a moot point: CLI program or System Library calls – quite often, the CLI programs (which use System Library calls anyway – at the end of the day, in a *NIX world, they’re only a “user friendly” front-end) do not display all the details available from the System Library calls.
done
[INDENT=2]*
I will do maybe :-)*
[/INDENT]
…I have no contract, so done :-)[/QUOTE]
manythanks
[HR][/HR]