hreinecke / sg3_utils

Deprecated git-svn mirror for sg3_utils

Home Page:http://sg.danny.cz/sg/sg3_utils.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writes to LBAs at or beyond 2TB issue

ismaws opened this issue · comments

In the attached log, I'm able to write to LBAs below the 2TB range but not after. I have tried every possible combination of sg_write* and sg_read* without success. The disks I'm trying this are operating in JBOD mode behind a RAID that is also configured as JBOD.

Haven't looked in that log but sg_read and sg_write are pretty old and don't look like they use 64 bit integers for skip, seek and count. Perhaps I should update them or make that limitation clearer in the man pages. In the meantime you can use sg_dd for both read and write. Examples
sg_dd if=/dev/sg2 skip=3g bs=512 of=output.bin count=32
sg_dd if=output.bin bs=512 seek=3g of=/dev/sg2 count=32

Assuming the disk at /dev/sg2 is over 3TB in size, those two operations are symmetrical and should leave the disk unaltered. I have another utility called ddpt which is more general (in the sense that it runs on FreeBSD, Windows, etc) that could replace sg_dd in the above lines. To use the 'dd' command you would need to change /dev/sg2 to its /dev/sd equivalent.

A follow-up: sg_read is definitely a problem. I put a warning in its man page about accesses beyond 2 TB. On the write side: sg_write_x, sg_write_same and sg_write_verify all should handle 64 bit LBAs. And if you put in a large LBA in an option, they should be smart enough to select the 16 byte cdb WRITE variant. Putting '--16' on the command line won't hurt, to force the issue. It you are still having problems with writes, add a '--verbose' option and send me the output.