On 14/05/10 11:22, Karel Zak wrote: > On Thu, May 13, 2010 at 02:14:32PM -0400, Phillip Susi wrote: >> On 5/13/2010 6:42 AM, Karel Zak wrote: >>> I'm not sure if link blockdev(8) against libblkid is a good idea. >>> From my point of view is blockdev(8) simple wrapper for ioctls. >>> >>> (I'm not happy with another new command, so suggestions are welcomed.) >> >> If blockdev is a wrapper for block device ioctls, and blkid is a simple >> interface to libblkid, then it seems a new feature in libblkid should be >> exported by blkid. > > Yes, it's probably the best compromise. > > Implemented & committed: > > -i Display I/O Limits (aka I/O topology) information. The ’export’ > output format is automatically enabled. > > for example: > > # blkid -i /dev/sdb > MINIMUM_IO_SIZE=512 > OPTIMAL_IO_SIZE=32768 > PHYSICAL_SECTOR_SIZE=512 > LOGICAL_SECTOR_SIZE=512 > > > The same thing without libblkid (already released in 2.17): > > # blockdev --getiomin --getioopt --getpbsz --getss /dev/sdb > 512 > 32768 > 512 > 512 > > > So we have two ways (first is portable and second is fast). Mainly for my reference, with the above, the way to get these values from a shell script, covering most kernel/util-linux-ng versions is: OPTIMAL_IO_SIZE=$(blockdev --getioopt $disk 2>/dev/null) [ "$OPTIMAL_IO_SIZE" ] || eval $(blkid -i $disk 2>/dev/null) [ "$OPTIMAL_IO_SIZE" ] || OPTIMAL_IO_SIZE=32768 while keeping these attributes just in `blockdev` would have required: OPTIMAL_IO_SIZE=$(blockdev --getioopt $disk 2>/dev/null || echo 32768) cheers, Pádraig. -- 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