tags:

views:

14

answers:

2

How can i get the start and end sectors of the partitions of my harddisk via a bash script?

A: 

That's a start:

sudo /sbin/fdisk  -l /dev/sdb | grep sdb[0-9]
Omry
:) That gives block sizes.
baltusaj
What's the interrelation between blocks and sectors?
baltusaj
man fdisk : -u When listing partition tables, give sizes in sectors instead of cylinders.
Omry
+2  A: 

Look at /sys/block/sda/sda1/start and /sys/block/sda/sda1/size.

Replace sda and sda1 with your device and partition.

Eric Seppanen
Thanks. That's exactly what i was looking for.
baltusaj