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] [--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 -v, --verbose
56 increase the level of verbosity, (i.e. debug output).
57
58 -V, --version
59 print the version string and then exit.
60
61 -x, --xfer_len=BTL
62 where BTL is the byte transfer length (default to 520). If the
63 given value (or the default) does not match the "long" block
64 size of the device, the appropriate BTL is deduced from the
65 error response and printed (to stderr). The idea is that the
66 user will retry this utility with the correct transfer length.
67
69 If a defective block is found and its contents, if any, has been
70 retrieved then "sg_reassign" could be used to map out the defective
71 block. Associated with such an action the number of elements in the
72 "grown" defect list could be monitored (with "sg_reassign --grown") as
73 the disk could be nearing the end of its useful lifetime.
74
75 The LBA and BTL (transfer length) arguments may be followed by the fol‐
76 lowing multiplicative suffixes: c C *1; w W *2; b B *512; k K KiB
77 *1,024; KB *1,000; m M MiB *1,048,576; MB *1,000,000; g G GiB
78 *1,073,741,824; and GB *1,000,000,000 . Also a suffix of the form
79 "x<n>" multiplies the leading number by <n>.
80
81 Alternatively numerical values can be given in hexadecimal preceded by
82 either "0x" or "0X" (or with a trailing "h" or "H"). When hex numbers
83 are given, multipliers cannot be used.
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-2007 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.23 January 2007 SG_READ_LONG(8)