LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   To show all partitions(without using fdisk -l) (https://www.linuxquestions.org/questions/linux-newbie-8/to-show-all-partitions-without-using-fdisk-l-77943/)

arunshivanandan 08-01-2003 02:56 AM

To show all partitions(without using fdisk -l)
 
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).

scott_R 08-01-2003 03:28 AM

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.

arunshivanandan 08-01-2003 03:40 AM

What if I have root permissions??What abt the tree view of partitions??

stickman 08-01-2003 08:43 AM

Quote:

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.

arunshivanandan 08-01-2003 11:11 AM

atleast,how can we know that this is logical partition and this is primary partition?

JZL240I-U 08-04-2003 02:28 AM

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.

arunshivanandan 08-04-2003 02:43 AM

I have wondered why my first partition is named hda1 and the rest hda5,hda6 etc,why not hda2 etc.This has solved it...Thanks

ksgill 08-04-2003 02:51 AM

command:
df

JZL240I-U 08-04-2003 02:56 AM

@Jatt_thugz: Thanks.
@arunshivanandan: You are wellcome.


:)

arunshivanandan 08-04-2003 03:00 AM

'df' on the present system gave this:

Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sda2 6048352 3065532 2675580 54% /
/dev/sda7 6301256 1993552 3987612 34% /backup
/dev/sda1 101089 10772 85098 12% /boot
none 256640 0 256640 0% /dev/shm
/dev/sdb1 17488652 5942440 10657820 36% /reccal
/dev/sda5 2016016 1705236 208368 90% /tmp
/dev/sda3 2016044 1119864 793768 59% /var

here,which are the primary,extended and logical partitions??

ksgill 08-04-2003 10:15 AM

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.

ksgill 08-04-2003 10:25 AM

Heres another one,
sfdisk -l -x |more

arunshivanandan 08-04-2003 10:29 AM

I tried this one,and it says there is no command like that.then i tried /sbin/sfdisk -l -x,and there was no output.Anyway,that is in the college LAN.

ksgill 08-04-2003 10:32 AM

Oh you have to be root in order to use that command.

arunshivanandan 08-04-2003 10:40 AM

Oh,so df is the only command for this stuff taht can be run without root permission.Anyway,thanks again.


All times are GMT -5. The time now is 10:20 AM.