LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How does one determine a USB hard drive capacity in sectors? (https://www.linuxquestions.org/questions/linux-software-2/how-does-one-determine-a-usb-hard-drive-capacity-in-sectors-870829/)

Equinn 03-24-2011 06:43 PM

How does one determine a USB hard drive capacity in sectors?
 
Hi All,

How would one determine the capacity in sectors or LBAs of a USB Hard Drive? If I know the USB device number, like from 'lsusb', is there someplace on the system to get other information about the drive? What I want to do is have a program go out and get this information just for the number of LBAs on the drive itself. Partition info doesn't matter for what I am doing.

Thanks,
Elena Quinn

kbp 03-24-2011 07:21 PM

I believe /sys/block/sdX/size may be in sectors .. multiplying by sector size seems to give the correct disk space

cheers

NM04 03-25-2011 05:40 AM

hi equinn,

if you have linux, plug in the USB, and then from the terminal run the command "fdisk -l". I think this should give you the sectors in the USB.

Regards.


All times are GMT -5. The time now is 06:42 PM.