Grzegorz
Grzegorz

Reputation: 3335

shell command returning an sg device size (Linux)

I need a shell command that would return an sg device size for me. I am searching for it over the Internet for almost two hours without any success.

I can do it by writing a program but there has to be a way to get it through a command! I simply cannot find it!

Unfortunatelly, on the dell server I work, sg_inq, and sginfo return Dell's PERC information, and not the device I try to get the information of.

I tried to use the smartctl but it returns a static (and not true) infomation about the device (SSD,) for the number of bytes it returns divided by 512 shows bigger number of sectors that I can access (sic!)

Any [shell command] hint would be greatly appreciated!

Upvotes: 0

Views: 1267

Answers (2)

Grzegorz
Grzegorz

Reputation: 3335

I am putting an answer here for anyone looking for it.

The ultimate way to either write own program or use smartctl (http://sourceforge.net/projects/smartmontools/files/smartmontools/6.0/) and call the following command:

#>./smartctl -a /dev/sdc
smartctl 6.0 2012-10-10 r3643 [x86_64-linux-2.6.18-274.18.1.el5] (local build)
Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org

Vendor:               DELL
Product:              PERC H710P
Revision:             3.13
User Capacity:        179,443,728,384 bytes [179 GB]
Logical block size:   512 bytes
Logical Unit id:      --------------------------------
Serial number:        --------------------------------
Device type:          disk
Local Time is:        Tue Sep 24 17:54:13 2013 EDT
Device does not support SMART

Error Counter logging not supported
Device does not support Self Test logging

Upvotes: 1

Ranjith Ruban
Ranjith Ruban

Reputation: 537

use #fdisk -l /dev/sg2

or # parted -l /dev/sg2

Upvotes: 0

Related Questions