Thursday, April 21, 2011

Start and End sectors of partitions?

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

From stackoverflow
  • That's a start:

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

    Replace sda and sda1 with your device and partition.

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

0 comments:

Post a Comment