I have a SATA block device that reports a capacity that is smaller than its accessible space, and I would like to read and write to it past the reported capacity using the file created by Linux for block devices. So I hope to operate using the descriptor returned from open({"/dev/sda", O_RDWR
). However, when I try to use lseek
to seek past the capacity of the device, I get an error and errno gets set to EINVAL (22)
.
Is there a way to access the data past the capacity of the device without modifying the device drivers and while still using the file descriptor returned by open()
?
My Linux release is CentOS 7 with kernel 3.10.0-514.21.1.el7.x86_64, although I'd be interested in solutions even if they involve other Linux distributions.
Edit: The drive I am working with is a FLEX protocol drive that reports the conventional capacity of the drive, but also has shingled magnetic recording available at an offset above the reported capacity of the drive. If you are interested, the details of this protocol can be found on the T13 website.