2
Just out of curiosity, is it possible to list partitions in Linux without being root or using sudo?
2
Just out of curiosity, is it possible to list partitions in Linux without being root or using sudo?
3
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)...
0
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.