pixel / hexedit

View and edit files in hexadecimal or in ASCII
http://rigaux.org/hexedit.html
GNU General Public License v2.0
98 stars 41 forks source link

Cant read 520/524 bytes per sector fibre channel drives #39

Closed PartialVolume closed 4 years ago

PartialVolume commented 4 years ago

It would seem you can only read drives that are 512 bytes per sector. If you read a fibre channel drive with 520 bytes per sector you get the error "the long seek failed (-1 instead of 0).

What are the chances of implementing this ?

I'm currently looking at adding fibre channel support to nwipe but would also like an hex editor that also supports sector sizes other than 512 for checking purposes.

prigaux commented 4 years ago

Can you give more info on what is failing?

The code does not rely much on 512 bytes per sector. It uses 512 for:

PartialVolume commented 4 years ago

Thanks for the quick response. I'll be able to test it fully on some new hardware that's arriving next week so can't give you much info at the moment.

From what I know so far, if you type hexedit /dev/sg0 (sg0 being a fibre channel drive with 520 byte/sector disks)

you will immediately get the error.. "the long seek failed (-1 instead of 0).

The hexedit display doesn't get displayed at all.

I'm assuming hexedit as part of initialisation tried to seek to the end of the drive, if so maybe it gets this seek calculation wrong maybe calculating as a multiple of 512 instead of 520 ?

I'll know more next week.

prigaux commented 4 years ago

hexedit tries to seek to the beginning of the file/device.

sg0 is a character device, not a block device! That's where the pb is :p

PartialVolume commented 4 years ago

ok, thanks. Sorry for the confusion. I'm commenting on behalf of a third party and just relaying what they found. Once I'm in front of the hardware next week I'll be able to see whats going on. So /dev/sg0 will allow us to send SCSI command to the device, presumably sd0. Maybe that's where the problem is.. Nwipe uses libparted and libparted scan function doesn't recognise the 520byte/sector fibre channel drives. Like I say once I've got the Fibre channel gear in front of me I'll be able to test it with hexedit myself. If I identify an issue I'll get back to you. Closing this for now.