Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Just out of curiosity, is it possible to list partitions in Linux without being root or using sudo?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

cat /proc/partitions shows all active block devices. This includes physical disks (sda, ...), software RAID volumes (md0, ...), logical volumnes (dm-0, ...) (as in LVM), loopback-mounted volumes (loop0, ...), and their partitions (sda1, md0p1, ...). For each block device, the size and the device number is indicated.

A lot of information is available in the /sys/block hierarchy. In /sys/block, there is a subdirectory per disk or disk-like device that a driver has claimed responsibility for. Partitioned devices have a subdirectory for each partition, e.g., /sys/block/sda/sda1. Various information is available in files, such as size (size in sectors), dev (major:minor device number), start (for partitions, their offset on the disk, in sectors)...

share|improve this answer
add comment

You can view the partition table on any device you have read access to. The normal hard drive devices do not give read access to all users for security purposes, but if you are in the group that own the devices then you should be able to read them.

$ ls -l /dev/sda
brw-rw----. 1 root disk 8, 0 2010-08-18 02:48 /dev/sda

A user in the disk group has read access to this device.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.