1SG_READ_LONG(8) SG3_UTILS SG_READ_LONG(8)
2
3
4
6 sg_read_long - send a SCSI READ LONG command
7
9 sg_read_long [--16] [--correct] [--help] [--lba=LBA] [--out=OF]
10 [--pblock] [--readonly] [--verbose] [--version] [--xfer_len=BTL] DEVICE
11
13 Send SCSI READ LONG command to DEVICE. The read buffer is output in hex
14 and ASCII to stdout or placed in a file. Note that the data returned
15 includes the logical block data (typically 512 bytes for a disk) plus
16 ECC information (whose format is proprietary) plus optionally other
17 proprietary data.
18
20 Arguments to long options are mandatory for short options as well.
21
22 -S, --16
23 uses a SCSI READ LONG(16) command. The default action is to use
24 a SCSI READ LONG(10) command. The READ LONG(10) command has a 32
25 bit field for the lba while READ LONG(16) has a 64 bit field.
26
27 -c, --correct
28 sets the 'CORRCT' bit in the SCSI READ LONG command. When set
29 the data is corrected by the ECC before being transferred back
30 to this utility. The default is to leave the 'CORRCT' bit clear
31 in which case the data is not corrected.
32
33 -h, --help
34 output the usage message then exit.
35
36 -l, --lba=LBA
37 where LBA is the logical block address of the sector to read.
38 Assumed to be in decimal unless prefixed with '0x' (or has a
39 trailing 'h'). Defaults to lba 0. If the lba is larger than can
40 fit in 32 bits then the --16 option should be used.
41
42 -o, --out=OF
43 instead of outputting ASCII hex to stdout, send it in binary to
44 the file called OF. If '-' is given for OF then the (binary)
45 output is sent to stdout. Note that all informative and error
46 output is sent to stderr.
47
48 -p, --pblock
49 sets the 'PBLOCK' bit in the SCSI READ LONG command. When set
50 the physical block (plus ECC data) containing the requested log‐
51 ical block address is read. The default is to leave the 'PBLOCK'
52 bit clear in which case the logical block (plus any ECC data) is
53 read.
54
55 -r, --readonly
56 opens the DEVICE read-only rather than read-write which is the
57 default. The Linux sg driver needs read-write access for the
58 SCSI READ LONG command but other access methods may require
59 read-only access.
60
61 -v, --verbose
62 increase the level of verbosity, (i.e. debug output).
63
64 -V, --version
65 print the version string and then exit.
66
67 -x, --xfer_len=BTL
68 where BTL is the byte transfer length (default to 520). If the
69 given value (or the default) does not match the "long" block
70 size of the device, the appropriate BTL is deduced from the
71 error response and printed (to stderr). The idea is that the
72 user will retry this utility with the correct transfer length.
73
75 If a defective block is found and its contents, if any, has been
76 retrieved then "sg_reassign" could be used to map out the defective
77 block. Associated with such an action the number of elements in the
78 "grown" defect list could be monitored (with "sg_reassign --grown") as
79 the disk could be nearing the end of its useful lifetime.
80
81 Various numeric arguments (e.g. LBA) may include multiplicative suf‐
82 fixes or be given in hexadecimal. See the "NUMERIC ARGUMENTS" section
83 in the sg3_utils(8) man page.
84
85 As a data point, Fujitsu uses a 54 byte ECC (per block) which is capa‐
86 ble of correcting up to a single burst error or 216 bits "on the fly".
87 [Information obtained from MAV20xxrc product manual.]
88
90 The exit status of sg_read_long is 0 when it is successful. Otherwise
91 see the sg3_utils(8) man page.
92
94 Written by Douglas Gilbert.
95
97 Report bugs to <dgilbert at interlog dot com>.
98
100 Copyright © 2004-2010 Douglas Gilbert
101 This software is distributed under the GPL version 2. There is NO war‐
102 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
103 POSE.
104
106 sg_reassign, sg_write_long, sg_dd
107
108
109
110sg3_utils-1.30 April 2010 SG_READ_LONG(8)