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