Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am wondering what will show all the partitions of ur hdd along with their sizes,preferably in a tree view with primary,extended and logical partitions.(supposing that i am not root,and i dont have fdisk).
Distribution: Lots of distros in the past, now Linux Mint
Posts: 748
Rep:
You might be able to find some program that allows you to look at partitions without being root, but more than likely, that would be a bug. Simply put, being able to know what partitions are available can be enough to compromise the security of a system, so it's unlikely you'll find something to do so without being root.
The reason may not be obvious at first, but if you know which partition is which, you can build a boot disk that ignores normal startup security, loading other preferences instead. Something as simple as messing with user's /home partitions could happen. While it may be easy enough to do that anyway, just by guessing the partitions (assuming the sysadmin didn't set up any security to block this kind of attempt), it also doesn't make sense not to have this restrictions. After all, there really isn't any reason for a non-root user to need to see partitions. Most people (even "pro" windows users) don't even know what they are.
Of course, if you really have a need to do this, you can probably write a small script or program to do so. It's not that hard, but I'd rethink your reasons for needing it before you put it into place. Perhaps just a list of partitions (fdisk output piped to a user accessible file?) would be sufficient.
Originally posted by scott_R The reason may not be obvious at first, but if you know which partition is which, you can build a boot disk that ignores normal startup security, loading other preferences instead. Something as simple as messing with user's /home partitions could happen. While it may be easy enough to do that anyway, just by guessing the partitions (assuming the sysadmin didn't set up any security to block this kind of attempt), it also doesn't make sense not to have this restrictions. After all, there really isn't any reason for a non-root user to need to see partitions. Most people (even "pro" windows users) don't even know what they are.
According to this logic, both mount and df should probably be removed. A non-root user can use both of these commands to see devices and mount points.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,605
Rep:
Quote:
Originally posted by arunshivanandan at least,how can we know that this is logical partition and this is primary partition?
hdx1 to hdx4 are the primaries, hdx5 to hdx... are extended in the logicals, where x=letter of the drive. There is a tool which prints the extendeds in <brackets> after the logical "parent", I forgot which, just try a few and you'll find it.
Thats for you to figure out. Generally, bootable partitions are primary partitions and others are extended. your /dev/sda1 certainly looks like primary. You can figure it out easily by looking at sizes and mount points carefully.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.