On Thu, Jan 21, 2010 at 4:53 PM, Martin K. Petersen <martin.petersen@xxxxxxxxxx> wrote: >>>>>> "Aleksander" == Aleksander Adamowski <linux@xxxxxxxxxx> writes: > > Aleksander> Is using sg_readcap like below sufficient? > > Aleksander> AFAIU, sg_readcap would not report logical blocks per > Aleksander> physical block on older kernels? > > sg_readcap sends a SCSI command directly to the disk so that won't work. > > You can look for alignment_offset in /sys/block/sdX, call the > BLKALIGNOFF ioctl, or use blockdev from a recent util-linux. I finally got the drive, a 1.5 TB Western Digital Caviar and the system doesn't seem to discover the 4 kB hardware sectors. The drive has the "Advanced Format Drive" sticker with instructions about running the WD Align utility "for optimal performance" if drive is to be user under Windows XP, so it must be the 4 kB sector one. For "All other OS configurations" - the sticker says - "drive is ready to use as is". For the record, here is model identifying data (it's /dev/sdb on my system): from /var/log/dmesg: [ 2.100108] scsi 2:0:0:0: Direct-Access ATA WDC WD15EARS-00Z 80.0 PQ: 0 ANSI: 5 [ 2.100216] sd 2:0:0:0: [sdb] 2930277168 512-byte logical blocks: (1.50 TB/1.36 TiB) [ 2.100246] sd 2:0:0:0: Attached scsi generic sg1 type 0 [ 2.100249] sd 2:0:0:0: [sdb] Write Protect is off [ 2.100252] sd 2:0:0:0: [sdb] Mode Sense: 00 3a 00 00 [ 2.100277] sd 2:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA # cat /sys/block/sdb/device/model WDC WD15EARS-00Z I'm running kernel 2.3.32: # uname -a Linux hostname 2.6.32-11-generic #15 SMP Fri Jan 22 00:59:34 CET 2010 x86_64 GNU/Linux The problem is that I cannot see the information about 4 kB sectors with any tool - sg_readcap, nor util-linux 2.17's blockdev nor fdisk: # sg_readcap -l /dev/sdb Read Capacity results: Protection: prot_en=0, p_type=0, p_i_exponent=0 Thin provisioning: tpe=0, tprz=0 Last logical block address=2930277167 (0xaea87b2f), Number of logical blocks=2930277168 Logical block length=512 bytes Logical blocks per physical block exponent=0 Lowest aligned logical block address=0 Hence: Device size: 1500301910016 bytes, 1430799.4 MiB, 1500.30 GB # /opt/util-linux-ng/util-linux-ng-2.17/disk-utils/blockdev --getiomin /dev/sdb 512 # /opt/util-linux-ng/util-linux-ng-2.17/disk-utils/blockdev --getioopt /dev/sdb 0 # fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xb39a6e37. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 182401. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): p Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes 255 heads, 63 sectors/track, 182401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xb39a6e37 Device Boot Start End Blocks Id System Command (m for help): # cat /sys/block/sdb/alignment_offset 0 # ls -l /dev/sdb brw-rw---- 1 root disk 8, 16 2010-01-23 00:31 /dev/sdb # cat /sys/dev/block/8\:16/queue/minimum_io_size 512 # cat /sys/dev/block/8\:16/queue/hw_sector_size 512 I seems that all devices report 512 hardware sector size: # find /sys/devices/ -name hw_sector_size | xargs cat 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 Any ideas? -- Best Regards, Aleksander Adamowski http://olo.org.pl -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html