aboutsummaryrefslogtreecommitdiff
path: root/doc/sg3_utils.html
blob: 5016a9f8d715ff1680c9104a38dbb5b2873e6ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Linux sg3_utils package</title>
  <meta http-equiv="Content-Type"
 content="text/html; charset=iso-8859-1">
  <meta name="keywords" content="sg3_utils, SCSI utilities, linux">
  <meta name="GENERATOR"
 content="Mozilla/4.79 [en] (X11; U; Linux 2.5.31 i686) [Netscape]">
</head>
<body alink="#ff0000" background="paper.jpg" bgcolor="#ffffff"
 link="#0000ff" text="#000000" vlink="#000080">
<center>
<h1><a class="mozTocH1" name="mozTocId697451"></a> The&nbsp; Linux
sg3_utils package</h1>
</center>
<a href="#intro"></a>
<ol id="mozToc">
<!--mozToc h1 1 h2 2 h3 3 h4 4 h5 5 h6 6-->
  <li><a href="#mozTocId697451"> The&nbsp; Linux
sg3_utils package</a>
    <ol>
      <li><a href="#mozTocId746876"> Introduction</a></li>
      <li><a href="#mozTocId832900"> Contents of sg3_utils</a></li>
      <li><a href="#mozTocId736867">Exit status</a></li>
      <li><a href="#mozTocId143590">Changing mode page
settings</a></li>
      <li><a href="#mozTocId301018">Examples</a></li>
      <li><a href="#mozTocId585558"> Notes</a></li>
      <li><a href="#mozTocId479511"> Download</a></li>
    </ol>
  </li>
</ol>
<h2><a class="mozTocH2" name="mozTocId746876"></a> Introduction</h2>
The <span style="font-weight: bold;">sg3_utils</span> package contains
utilities
that send SCSI commands to devices. As well as devices on
transports traditionally associated with SCSI (e.g. Fibre Channel
(FCP), Serial
Attached SCSI (SAS) and the SCSI
Parallel Interface(SPI)) many
other devices use SCSI command sets. ATAPI cd/dvd drives
and SATA disks that connect via a translation layer or a bridge device
are
examples of devices that use SCSI command sets.<br>
<br>
SCSI command sets are divided into a common set and several device
class specific sets. The common set of commands is referred to as the
SCSI Primary Commands (SPC) with SPC-3 being the most recent standard.
The mandatory SCSI INQUIRY command is defined in SPC-3. The SCSI Block
Commands (SBC)
cover direct access devices such as disks. The MultiMedia Commands
(MMC) cover CD and DVD drives and the media within them. SCSI
command sets and transport
definitions can be found at the <a href="http://www.t10.org">www.t10.org</a>
site with this page giving a good diagrammatic overview: <a
 href="http://www.t10.org/scsi-3.htm">www.t10.org/scsi-3.htm</a> .<br>
<br>
The
<span style="font-weight: bold;">sg3_utils</span> package targets the
linux kernel 2.4 and 2.6 series and is
still being enhanced. An earlier package called sg_utils
targeted the linux kernel 2.2 series with some support for the
2.0 series. See an earlier version of this web <a href="uu_index.html">page</a>
for further information about sg_utils.&nbsp; This
document describes
<span style="font-weight: bold;">version 1.23</span> of <span
 style="font-weight: bold;">sg3_utils</span> .&nbsp; A subset of these
utilities have been ported to the FreeBSD, Tru64 and the Windows
operating
systems.<br>
<br>
In the linux kernel 2.4 series most of these utilities must be
used with a SCSI generic (sg) driver device name (e.g. <span
 style="font-family: monospace;">/dev/sg0</span>). In
the lk 2.6 series almost all of these utilities can be used with the
primary device names as well (e.g. <span
 style="font-family: monospace;">/dev/sda, /dev/scd0, /dev/st0</span>
and
<span style="font-family: monospace;">/dev/hdd</span> (if it is an
ATAPI device)). The SCSI generic (sg) interface
still represents a cleaner interface than the primary device names
since the drivers behind primary device names have their
own policies, may interfere with error processing and, in some cases,
run their own
state machines.<br>
<p>A list of SCSI and storage utility programs that was at the bottom
of this page has been moved to the <a href="tools.html">tools</a> page.<span
 style="font-weight: bold;"><br>
</span></p>
<h2><a class="mozTocH2" name="mozTocId832900"></a> Contents of sg3_utils</h2>
This package contains over 30 utilities, their "man" pages, build files
and general documentation (e.g. several README files). The utilities
have a command line interface which in general has this form:<br>
<br>
<span style="font-family: monospace;">UTILITY_NAME [OPTIONS] DEVICE</span><br>
<br>
No more than one DEVICE name can be given (and in a few cases, no
DEVICE name is required). Here is a listing in alphabetical order of
the utilities in the
sg3_utils package:<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
 cellspacing="2">
  <caption><span style="font-weight: bold;">Table 1
Utilities in sg3_utils</span><br>
  </caption> <tbody>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Utility</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Main
SCSI commands</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">directory<br>
      </span> </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">CLI</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Ported</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Notes</span><br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">hxascdmp<br>
      </td>
      <td style="vertical-align: top;">-<br>
      </td>
      <td style="vertical-align: top;">utils<br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;">fb<br>
      </td>
      <td style="vertical-align: top;">converts stdin (assumed binary)
to ASCII hex and ASCII, sending its output to stdout (like the Unix <span
 style="font-weight: bold;">od</span> command)<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">rescan-scsi-bus.sh<br>
      </td>
      <td style="vertical-align: top;">-<br>
      </td>
      <td style="vertical-align: top;">archive<br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">copy of Kurt Garloff's useful
script<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">scsi_inquiry<br>
      </td>
      <td style="vertical-align: top;">INQUIRY<br>
      </td>
      <td style="vertical-align: top;">examples<br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">uses deprecated
SCSI_IOCTL_SEND_COMMAND ioctl<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sdparm<br>
      </td>
      <td style="vertical-align: top;">MODE SENSE/SELECT, INQUIRY<br>
      </td>
      <td style="vertical-align: top;">--&gt;<br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">was in sg3_utils for a short
time; now in own package, see <a href="sdparm.html">sdparm</a> .
sdparm manipulates mode pages, reads VPD pages and sends simple
commands.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_chk_asc<br>
      </td>
      <td style="vertical-align: top;">-<br>
      </td>
      <td style="vertical-align: top;">utils<br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb<br>
      </td>
      <td style="vertical-align: top;">check asc/ascq codes from <a
 href="http://www.t10.org">www.t10.org</a> page against
sg3_utils table<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sginfo<br>
      </td>
      <td style="vertical-align: top;">MODE SENSE/SELECT, READ DEFECT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">symbolic decoding (optional
changing) of mode pages. Can also output (disk) defect lists. In lk 2.4
can be given primary device nodes (e.g. <span
 style="font-family: monospace;">/dev/sda</span>) as well as sg device
nodes. Port of older <span style="font-weight: bold;">scsiinfo</span>
utility.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sgm_dd<br>
      </td>
      <td style="vertical-align: top;">READ, WRITE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">dd<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">sg_dd variant that uses memory
mapped IO (only on linux sg devices)<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sgp_dd<br>
      </td>
      <td style="vertical-align: top;">READ, WRITE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">dd<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">sg_dd variant that uses POSIX
threads<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_dd<br>
      </td>
      <td style="vertical-align: top;">READ, WRITE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">dd<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Unix <span
 style="font-weight: bold;">dd</span> command variant, uses
SG_IO ioctl to send SCSI commands to copy data. See the <a
 href="sg_dd.html">sg_dd</a> page. </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_emc_trespass<br>
      </td>
      <td style="vertical-align: top;">MODE SELECT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">utility specialized for EMC
Clariion series<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_format<br>
      </td>
      <td style="vertical-align: top;">FORMAT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">format or resize a SCSI disk<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_get_config<br>
      </td>
      <td style="vertical-align: top;">GET CONFIGURATION<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch features and profiles of a
cd/dvd drive and/or its current media<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_ident<br>
      </td>
      <td style="vertical-align: top;">REPORT/SET IDENTIFYING
INFORMATION<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">default is to report (fetch) the
device identifier. With the '<span style="font-family: monospace;">--set</span>'
option a new identifier is sent
to the device.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_inq<br>
      </td>
      <td style="vertical-align: top;">INQUIRY<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch standard response, VPD
pages or version descriptors. Also
can perform IDENTIFY (PACKET) DEVICE ATA command. VPD page decoding
also performed by sg_vpd and sdparm.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_logs<br>
      </td>
      <td style="vertical-align: top;">LOG SENSE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch log sense pages, decode
standard and some vendor pages<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_luns<br>
      </td>
      <td style="vertical-align: top;">REPORT LUNS<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch luns reported by a device
(lun 0 or "well known lu")<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_map<br>
      </td>
      <td style="vertical-align: top;">INQUIRY<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">shows mapping between sg devices
and primary device node (if any). In lk 2.6 see <a
 href="../scsi/lsscsi.html">lsscsi</a> .<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_map26<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">maps between single linux sg
device
and primary device node (and vice versa). Also does mapping in to, and
out of, sysfs. For the linux 2.6 series.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_modes<br>
      </td>
      <td style="vertical-align: top;">MODE SENSE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch mode pages (mainly in hex)<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_opcodes<br>
      </td>
      <td style="vertical-align: top;">REPORT SUPPORTED OPERATION CODES<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">fetch supported SCSI commands or
supported task management functions<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_persist<br>
      </td>
      <td style="vertical-align: top;">PERSISTENT RESERVE IN/OUT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">control persistent reservations
and report
reservation status<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_prevent<br>
      </td>
      <td style="vertical-align: top;">PREVENT ALLOW MEDIUM REMOVAL<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">control media removal, mainly
for those SCSI devices which have removable media (e.g. CD/DVD and tape
drives)<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_rbuf<br>
      </td>
      <td style="vertical-align: top;">READ BUFFER<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">read from SCSI device cache.
Typically for testing the SCSI transport (for throughput or errors)<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_rdac<br>
      </td>
      <td style="vertical-align: top;">MODE SENSE/SELECT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w</td>
      <td style="vertical-align: top;">display or modify RDAC redundant
controller mode page<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_read<br>
      </td>
      <td style="vertical-align: top;">READ<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">dd<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">read continually from same
offset. Syntax similar to sg_dd (without write side). Can test SCSI
device cache and transport performance.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_readcap<br>
      </td>
      <td style="vertical-align: top;">READ CAPACITY<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch the number of blocks and
the individual block size for disks and CD/DVD media<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_read_buffer<br>
      </td>
      <td style="vertical-align: top;">READ BUFFER<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">read descriptors or data<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_read_long<br>
      </td>
      <td style="vertical-align: top;">READ LONG<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">read data from given lba which
includes the block and ECC data.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_reassign<br>
      </td>
      <td style="vertical-align: top;">REASSIGN BLOCKS<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">reassign a lba from one sector
on a disk (typically damaged) to a new (spare) sector. User data copied
if it is recoverable.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_requests<br>
      </td>
      <td style="vertical-align: top;">REQUEST SENSE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">fetch sense data from the given
device. Modern uses include getting a progress indication (e.g.
during a format) or finding the power condition state.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_reset<br>
      </td>
      <td style="vertical-align: top;">-<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Issue a driver, (SCSI) bus or
device (target or lun?) reset.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_rmsn<br>
      </td>
      <td style="vertical-align: top;">READ MEDIA SERIAL NUMBER<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Relatively new command
added to SPC-3. Format of response is vendor specific so this utility
outputs it in hex (default) or binary.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_rtpg<br>
      </td>
      <td style="vertical-align: top;">REPORT TARGET PORT GROUPS<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Specialized for multi-ported
SCSI devices where one port (or a group of them) is preferred for IO
over another (or others).<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_sat_identify<br>
      </td>
      <td style="vertical-align: top;">ATA PASS-THROUGH</td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">Sends IDENTIFY DEVICE or
IDENTIFY PACKET DEVICE ATA commands via the SAT ATA PASS-THROUGH (16 or
12) SCSI command.</td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg__sat_identify<br>
      </td>
      <td style="vertical-align: top;">ATA PASS-THROUGH<br>
      </td>
      <td style="vertical-align: top;">examples<br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Simpler version of
sg_sat_identify that uses the linux SG_IO ioctl directly. See also
sg_sat_chk_power, sg_sat_set_features and sg_sat_smart_rd_data in the
examples subdirectory.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_scan<br>
      </td>
      <td style="vertical-align: top;">[INQUIRY]<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
[win:<br>
getopt]<br>
      </td>
      <td style="vertical-align: top;">w<br>
      </td>
      <td style="vertical-align: top;">maps each sg device name to
the corresponding numeric &lt;host, channel, target, lun&gt; tuple. In
lk 2.6 series the "<a href="scsi/lsscsi.html">lsscsi</a> -g" command is
similar. In Windows shows one device per line, with the device's
various names and INQUIRY response string on that line.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_senddiag<br>
      </td>
      <td style="vertical-align: top;">SEND DIAGNOSTIC<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Issues either a default self
test or a short/extended foreground/background self test. With no
arguments it uses RECEIVE DIAGNOSTIC RESULTS to list all supported
diagnostic
pages.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_ses<br>
      </td>
      <td style="vertical-align: top;">SEND/RECEIVE DIAGNOSTIC<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Fetches status diagnostic
pages from, and sends some control pages to, a SCSI Enclosure Services
(SES) device.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_simple1,2,3,4,5<br>
      </td>
      <td style="vertical-align: top;">INQUIRY, TEST UNIT READY<br>
      </td>
      <td style="vertical-align: top;">examples<br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Simple code examples of using
the scsi generic (sg) driver interface<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_simple16<br>
      </td>
      <td style="vertical-align: top;">READ<br>
      </td>
      <td style="vertical-align: top;">examples<br>
      </td>
      <td style="vertical-align: top;">adhoc<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Simple code example of sending a
16 byte cdb SCSI READ command<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_start<br>
      </td>
      <td style="vertical-align: top;">START STOP UNIT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Controls the power condition
state of a SCSI device. Primary use is to spin up and down SCSI disks.
Can also load and eject removable media.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_sync<br>
      </td>
      <td style="vertical-align: top;">SYNCHRONIZE CACHE<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Causes disk caches to be flushed
to media<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_test_rwbuf<br>
      </td>
      <td style="vertical-align: top;">READ/WRITE BUFFER<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Random pattern written to SCSI
device buffer then read back and checked. Used in testing for data
corruption.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_turs<br>
      </td>
      <td style="vertical-align: top;">TEST UNIT READY<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt+<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">Issue one or more Test Unit
Ready commands. Can be used to time SCSI command overhead.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_verify</td>
      <td style="vertical-align: top;">VERIFY</td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">reads indicated blocks on a SCSI
disks, stops on the first error found. Does not yield any data. Useful
for media scans.</td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_vpd<br>
      </td>
      <td style="vertical-align: top;">INQUIRY<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">Decodes standard and some vendor
Vital Product Data (VPD) pages.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_write_buffer<br>
      </td>
      <td style="vertical-align: top;">WRITE BUFFER<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w<br>
      </td>
      <td style="vertical-align: top;">write data; can be used to
download firmware<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_write_long<br>
      </td>
      <td style="vertical-align: top;">WRITE LONG<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">writes to a lba, data which
includes the block and ECC data. Suitable data typically fetched by
prior
sg_read_long utility.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;">sg_wr_mode<br>
      </td>
      <td style="vertical-align: top;">MODE SELECT<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">getopt<br>
      </td>
      <td style="vertical-align: top;">fb,t64,w </td>
      <td style="vertical-align: top;">writes mode pages supplied in
ASCII hex (e.g. from "<span style="font-family: monospace;">sg_modes -r</span>")
to the&nbsp; SCSI device. See <a href="sdparm.html">sdparm</a> for
another method of setting mode page
parameters.<br>
      </td>
    </tr>
  </tbody>
</table>
<br>
More SCSI commands may be issued than shown in the <span
 style="font-weight: bold;">Main SCSI
commands</span> column. For example many utilities issue a SCSI INQUIRY
command to find out the peripheral device type of the given
device. Some SCSI commands listed above are only relevant to a specific
device type (e.g. FORMAT UNIT) and should not be sent to a device
belonging to other peripheral device types (and in some cases these
utilities will
block inappropriate attempts). See the COVERAGE file in the main
directory of the tarball for a more exhaustive list of SCSI (and ATA)
commands
issued by the sg3_utils utilities.<br>
<br>
If the <span style="font-weight: bold;">directory</span>
column is empty in the above table then that utility is in the main
directory and more
documentation can be found in its "man" page. Some utilities in the
subdirectories have "man"
pages.<br>
<br>
The <span style="font-weight: bold;">CLI</span> column indicates what
kind of command line interface the utility has. Recent utilities have a
cli based on the getopt_long() function which offers both long option
names (e.g. "<span style="font-family: monospace;">--verbose</span>")
and a short form (e.g. '<span style="font-family: monospace;">-v</span>'),
both forms can
take an argument. Experience has led to consistent use of various
options such as "<span style="font-family: monospace;">--help</span>", "<span
 style="font-family: monospace;">--verbose</span>" and "<span
 style="font-family: monospace;">--version</span>" across these
utilities. Utilities with this type of cli are marked with "getopt".
The original utilities had an "ad hoc" type cli that unfortunately
lacked consistency and had a mix of long and short forms (with the long
form sometime prefixed with "-" and on other occasions with "--".
Utilities with this type of cli are marked with "adhoc". There is also
a group of utilities that are related to the Unix dd command and share
its quirky cli. Finally a group of well used utilities with ad hoc
command line interfaces had a getop_long() based interface added in
sg3_utils version 1.23 . These utilities include sg_inq, sg_logs and
sg_modes. The default cli for this group is "getopt" but by using
"<span style="font-family: monospace;">--old</span>" or "-O" as the
first option the older ad hoc options can be
used. This group will default to the older ad hoc interface if the
environment variable SG3_UTILS_OLD_OPTS is defined. Utilities with this
type of cli are marked with "getopt+".<br>
<br>
If the <span style="font-weight: bold;">Ported</span> column is empty
then the utility is only found in
Linux. Support for other ports is indicated by "fb" for FreeBSD, "t64"
for Tru64 (OSF) and "w" for Windows. See the README.freebsd,
README.tru64 and README.win32 files
for more information.<br>
<br>
This paragraph contains Linux specific information. All utilities that
issue SCSI commands and that appear in the main directory of table 1,
with the exception of sgp_dd,
issue SG_IO ioctls. The sgp_dd utility issues SCSI commands using the
sg
driver's asynchronous ( write()/read() ) interface to device nodes that
have the sg driver's major device number (i.e. "char" major 21). This
means that all utilities in the main directory are "safe" with any
given device node. If the device node does not support the SG_IO ioctl
then that is reported and the utility exits. [In version 1.14 sgm_dd
also use the sg
driver's asynchronous ( write()/read() ) interface but that has been
changed to the SG_IO ioctl in version 1.15 since the asynchronous
action is not needed. sgm_dd will only use mmapped IO on sg device
nodes.]<br>
<br>
Irrespective of the device node used to access a device, care
should be taken not to interfere with a device while it is "active".
For example invoking a "<span style="font-family: monospace;">sg_format
-F</span>" utility on a disk with mounted
file
systems on it is obviously going to cause damage.<br>
<h2><a class="mozTocH2" name="mozTocId736867"></a>Exit status</h2>
Each process containing one of sg3_utils' command line utilities
completes
with an exit status of 0 when
successful. Prior to version 1.21 all errors yielded an exit status of
1. Having finer grain error reporting via the exit status from
relatively low level sg3_utils utilities allows higher level scripts
and other program wrappers to do more useful error processing.<br>
<br>
From version 1.22 the exit status value is one of:<br>
<ul>
  <li><span style="font-weight: bold;">1</span>&nbsp;&nbsp; syntax
error in command line options or their arguments, or an illegal
combination of options.</li>
  <li><span style="font-weight: bold;">2</span>&nbsp;&nbsp; the device
reports that it is not ready for the operation requested. The device
may be in the process of becoming ready (e.g. spinning up but not at
speed) so the utility may work a little while later.</li>
  <li><span style="font-weight: bold;">3</span>&nbsp;&nbsp; the device
reports a medium or hardware error (or a blank check). For example an
attempt to read a corrupted block on a disk will yield this value. <br>
  </li>
  <li><span style="font-weight: bold;">5</span>&nbsp;&nbsp; the device
reports an "illegal request" with an additional sense code other than
"invalid operation code". This is often a supported command with a
field set requesting an unsupported capability. For commands that
require a "service action" field (e.g. READ CAPACITY(16) ) this value
can indicate that the
command is not supported.</li>
  <li><span style="font-weight: bold;">6</span>&nbsp;&nbsp; the device
reports a "unit attention" condition. This usually indicates that
something unrelated to the requested command has occurred (e.g. a
device reset) potentially before the current SCSI command was sent. The
requested command has not been executed by the device. Note that unit
attention conditions are usually only reported once by a device.</li>
  <li><span style="font-weight: bold;">9</span>&nbsp;&nbsp; the device
reports an illegal request with an additional sense code of "invalid
operation code" which means that it doesn't support the requested
command.</li>
  <li><span style="font-weight: bold;">11</span>&nbsp; the device (or
transport) reports an aborted command. In some cases this can be caused
by congestion on the transport and retrying the command may be
successful.<br>
  </li>
  <li><span style="font-weight: bold;">15</span> &nbsp; the utility is
unable to open, close or use the given device. The given file name
could be incorrect or there may be permission problems. Adding the '<span
 style="font-family: monospace;">-v</span>'
option may give more information.</li>
  <li><span style="font-weight: bold;">20</span>&nbsp;&nbsp; the DEVICE
reports it has a check condition but "no sense".
Some polling commands (e.g. REQUEST SENSE) can react this way. It is
unlikely that this value will occur as an exit status.</li>
  <li><span style="font-weight: bold;">21</span>&nbsp;&nbsp; the device
reports a "recovered error". The requested command was successful. Most
likely a utility will report a recovered error to stderr and continue,
probably leaving the utility with an exit status of 0 .</li>
  <li><span style="font-weight: bold;">33</span>&nbsp;&nbsp; the
command sent to the device has timed out. This appears on in Linux, in
other ports a command timeout will appear as a transport (or OS) error.<br>
  </li>
  <li><span style="font-weight: bold;">97</span>&nbsp;&nbsp; the
response to a SCSI command failed sanity checks.</li>
  <li><span style="font-weight: bold;">98</span>&nbsp;&nbsp; the device
reports it has a check condition but the error doesn't fit into any of
the above categories.</li>
  <li><span style="font-weight: bold;">99</span>&nbsp;&nbsp; any errors
that can't be categorized into values 1 to 98 may yield this value.
This includes transport and operating system errors.<br>
  </li>
</ul>
Many of the above exit statuses will be repeatable so executing the
utility again with one or more '<span style="font-family: monospace;">-v</span>'
options may yield more information.
Unit attentions (exit status 6) are only reported once per condition.
Notice that some of the lower exit status values correspond to the SCSI
sense key values. Some examples of bash scripts that use these exit
values see the <span style="font-style: italic;">scripts</span>
subdirectory.<br>
<h2><a class="mozTocH2" name="mozTocId143590"></a>Changing mode page
settings</h2>
SCSI devices store settings (metadata) that could possibly be changed
by the user (called the "application client" in SCSI jargon) in mode
pages. It is a common requirement to find mode page settings and in
some cases change them. An example is the Writeback Cache Enable (WCE)
bit
in the Caching mode page of SCSI disks. Usually the manufacturer's
default setting for WCE is set (on) however in some RAID configurations
it may be cleared (off). <br>
<br>
Generic command line tools to change mode page settings tend to be
difficult to use (which in some small part is due to the SCSI rules for
manipulating mode pages). Here is a list of some linux utilities for
changing
mode pages followed by some notes:<br>
<ul>
  <li><span style="font-weight: bold;">scsiinfo</span> (old utility):
awkward command line interface with double invocation (first to get,
second to set). Only mode page fields that the utility knows about can
be changed.<br>
  </li>
  <li><span style="font-weight: bold;">sginfo</span> (sg3_utils version
of scsiinfo): same awkward interface as scsiinfo but the mode pages are
more up to date. Supports other modern features such as mode subpages.<br>
  </li>
  <li><span style="font-weight: bold;">sg_wr_mode</span> (sg3_utils):
low level mode page settings based on ASCII hex representation. Used
with sg_modes to get a mode page in raw form and assumes ACSII hex will
be edited. Low level but general.</li>
  <li><span style="font-weight: bold;">sdparm</span> (sdparm): uses
acronyms (e.g. WCE) or numeric addressing to fetch and/or change mode
page settings.
Allows device to be reset to default settings for a specific mode page.
The user can choose whether changes are also made to the "saved" mode
page values. The
numeric addressing allows arbitrary fields to be changed (i.e. sdparm
doesn't need to know about a mode page or its field structure in
advance).<br>
  </li>
  <li><span style="font-weight: bold;">sgmode</span> (scsirastools):
interactive utility for setting mode pages with data held in preset
".mdf" files. Useful to setting a large number of disks to preset mode
page values but awkward for manipulating a specific mode page field.</li>
  <li><span style="font-weight: bold;">hdparm</span> (hdparm):
abstracts over ATA (mainly) and SCSI (where convenient) disks. Write
caching can be turned on and off but that is one of the few mode fields
that can be changed on a SCSI device.<br>
  </li>
  <li><span style="font-weight: bold;">blktool</span> (blktool): much
newer and cleaner version of hdparm which targets the linux kernel 2.6
series.
For SCSI devices only a relatively small (but important) number of mode
page fields can be changed.</li>
  <li>vendor specific (e.g. seatools from Seagate): several vendors
have utilities like this. Worth investigating and often useful with
disks from other manufacturers. Vendor extensions can be controlled
(e.g. Seagate's desktop/server mode (also see sdparm's man page about
this particular feature)).<br>
  </li>
</ul>
The author's recommendation is to use <a href="sdparm.html">sdparm</a>
unless the features of
another utility better suit your needs.<br>
<h2><a class="mozTocH2" name="mozTocId301018"></a>Examples</h2>
The fundamental SCSI command whose support is mandatory for all SCSI
devices is INQUIRY. All devices should respond to a "standard" (i.e.
when no Vital Product Pages are requested) INQUIRY.<br>
<br>
<span style="font-family: monospace;">$ sg_inq /dev/sda</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">standard INQUIRY:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; PQual=0&nbsp;
Device_type=0&nbsp; RMB=0&nbsp; version=0x03&nbsp; [SPC]</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; [AERC=0]&nbsp;
[TrmTsk=0]&nbsp; NormACA=0&nbsp; HiSUP=1&nbsp; Resp_data_format=2</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; SCCS=0&nbsp; ACC=0&nbsp;
TGPS=0&nbsp; 3PC=0&nbsp; Protect=0</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; BQue=0&nbsp;
EncServ=0&nbsp; MultiP=0&nbsp; MChngr=0&nbsp; [ACKREQQ=0]&nbsp; Addr16=1</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; [RelAdr=0]&nbsp;
WBus16=1&nbsp; Sync=1&nbsp; Linked=1&nbsp; [TranDis=1]&nbsp; CmdQue=1</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Clocking=0x3&nbsp;
QAS=0&nbsp; IUS=0</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; length=144
(0x90)&nbsp;&nbsp; Peripheral device type: disk</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Vendor identification:
SEAGATE</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Product identification:
ST318451LW</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Product revision level: 0003</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Unit serial number:
xxxxxxxxx</span><br>
<br>
Some SCSI devices have version descriptor information showing which
standards (and drafts) they support:<br>
<br>
<span style="font-family: monospace;">$ sg_inq -d /dev/sdb</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">standard INQUIRY:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; PQual=0&nbsp;
Device_type=0&nbsp; RMB=0&nbsp; version=0x03&nbsp; [SPC]</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; [AERC=0]&nbsp;
[TrmTsk=0]&nbsp; NormACA=0&nbsp; HiSUP=0&nbsp; Resp_data_format=2</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; SCCS=0&nbsp; ACC=0&nbsp;
TGPS=0&nbsp; 3PC=0&nbsp; Protect=0</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; BQue=0&nbsp;
EncServ=0&nbsp; MultiP=0&nbsp; MChngr=0&nbsp; [ACKREQQ=0]&nbsp; Addr16=1</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; [RelAdr=0]&nbsp;
WBus16=1&nbsp; Sync=1&nbsp; Linked=1&nbsp; [TranDis=1]&nbsp; CmdQue=1</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Clocking=0x0&nbsp;
QAS=0&nbsp; IUS=0</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; length=96
(0x60)&nbsp;&nbsp; Peripheral device type: disk</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Vendor identification:
FUJITSU</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Product identification:
MAM3184MP</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Product revision level: 0106</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;Unit serial number:
xxxxxxxxx</span><br style="font-family: monospace;">
<br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Version descriptors:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; SAM-2 (no
version claimed)</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; SPI-3
T10/1302-D revision 10</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; SPC ANSI
X3.301:1997</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; SBC T10/0996-D
revision 08c</span><br>
<br>
Many modern SCSI devices also support "Vital Product Data" (VPD) pages.
Here is a request to list available VPD pages:<br>
<br>
<span style="font-family: monospace;">$ sg_inq -e /dev/sg1</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">VPD INQUIRY, page code=0x00:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp; [PQual=0&nbsp;
Peripheral device type: disk]</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp; Supported VPD pages:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;
0x0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Supported VPD pages</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;
0x80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Unit serial number</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;
0x83&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Device identification</span><br>
<br>
For displaying VPD pages, sg_vpd (or sdparm) may be a better choice
than sg_inq as sg_vpd has a simpler, less cluttered command line
interface and additional support for vendor specific VPD pages.<br>
<br>
<span style="font-family: monospace;"># sg_vpd /dev/sdh</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">Supported VPD pages VPD page:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Supported VPD pages [sv]</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Unit serial number [sn]</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Implemented operating
definition (obs) [iod]</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Device identification [di]</span><br>
<br>
The following displays a subset of the device identification VPD page,
namely the designators for the target port:<br>
<br>
<span style="font-family: monospace;"># sg_vpd --page=di_port /dev/sdh</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">Device Identification VPD page:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp; Target port:</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; desig_type:
NAA,&nbsp; code_set: Binary</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;
transport: Serial Attached SCSI (SAS)</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x5000c500005208ee</span><br style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; desig_type:
Relative target port,&nbsp; code_set: Binary</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;
transport: Serial Attached SCSI (SAS)</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Relative target port: 0x2</span><br>
<br>
The sg_scan and sg_map utilities show the relationships between linux
sg
devices and their &lt;bus, channel, target, lun&gt; tuples and their
primary device node names:<br>
<p>Example: given these 3 SCSI devices: <br>
<tt style="font-family: monospace;">$ cat /proc/scsi/scsi</tt><span
 style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">Attached devices:</tt><span
 style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">Host: scsi1 Channel: 00 Id: 00 Lun:
00</tt><span style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">&nbsp; Vendor: SEAGATE&nbsp; Model:
ST318451LW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rev: 0003</tt><span
 style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">&nbsp; Type:&nbsp;&nbsp;
Direct-Access&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ANSI SCSI revision: 03</tt><span style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">Host: scsi2 Channel: 00 Id: 04 Lun:
00</tt><span style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">&nbsp; Vendor: PIONEER&nbsp; Model:
DVD-ROM DVD-303&nbsp; Rev: 1.10</tt><span
 style="font-family: monospace;">
</span><br style="font-family: monospace;">
<tt style="font-family: monospace;">&nbsp; Type:&nbsp;&nbsp;
CD-ROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ANSI SCSI revision: 02</tt><span style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">Host: scsi2 Channel: 00 Id: 06 Lun:
00</tt><span style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">&nbsp; Vendor: YAMAHA&nbsp;&nbsp;
Model:
CRW4416S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rev: 1.0g</tt><span
 style="font-family: monospace;">
</span><br style="font-family: monospace;">
<tt style="font-family: monospace;">&nbsp; Type:&nbsp;&nbsp;
CD-ROM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ANSI SCSI revision: 02</tt> </p>
<p>then the output from sg_scan is: <br>
<tt style="font-family: monospace;">$ sg_scan</tt><span
 style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">/dev/sg0: scsi1 channel=0 id=0
lun=0&nbsp; type=0</tt><span style="font-family: monospace;"> </span><tt
 style="font-family: monospace;"><br>
/dev/sg1: scsi2 channel=0 id=4 lun=0&nbsp; type=5</tt><span
 style="font-family: monospace;"> </span><br
 style="font-family: monospace;">
<tt style="font-family: monospace;">/dev/sg2: scsi2 channel=0 id=6
lun=0&nbsp; type=5</tt> </p>
<p>INQUIRY data can be added to that output with the '<span
 style="font-family: monospace;">-i</span>' option. The
sg_map utility shows the mapping between scsi generic (sg) devices and
the corresponding primary device node. For some peripheral device
types, SCSI enclosures for example, there is no mapping and the
enclosure device must be accessed via a sg device node.<br>
</p>
<p></p>
<p style="font-family: monospace;"><code>$ sg_map <br>
/dev/sg0&nbsp; /dev/sda <br>
/dev/sg1&nbsp; /dev/scd0 <br>
/dev/sg2&nbsp; /dev/scd1</code></p>
In the lk 2.6 series of kernels sg_scan and sg_map are less important
as most
utilities in the sg3_utils package can be issued directly against the
primary device node (e.g. <span style="font-family: monospace;">/dev/sda</span>).&nbsp;
However the sg driver is
still needed to "talk" to devices such as enclosures which have no
specialized driver in linux.<br>
<br>
The Windows port has its own sg_scan utility which attempts to place
all the device names for one device on a line. Here is an example:<br>
<span style="font-family: monospace;">$ sg_scan</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">SCSI0:0,0,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
C:&nbsp;&nbsp;&nbsp; PD0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
IC25N040ATCS05-0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CS4O&nbsp; *</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">SCSI1:0,0,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
D:&nbsp;&nbsp;&nbsp; CDROM0&nbsp;&nbsp; HITACHI DVD-ROM GD-S200 0034</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">SCSI2:0,0,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
I: +&nbsp; PD5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QUANTUM
LPS525S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3110</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">SCSI2:0,6,0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
TAPE0&nbsp;&nbsp;&nbsp; SONY&nbsp;&nbsp;&nbsp;
SDT-7000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0192</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
E:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Generic USB SD Reader&nbsp;&nbsp; 1.00&nbsp; pdt=0</span><br
 style="font-family: monospace;">
<span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PD1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Generic USB SD Reader&nbsp;&nbsp; 1.00</span><br>
<br>
The first half of each line contains the various device names for a
device. The second half are INQUIRY reponse strings. So device names
like "PD1" (or the longer "physicalDrive1" form), "D:" and "TAPE0" can
be used in the Windows port. <br>
<h2><a class="mozTocH2" name="mozTocId585558"></a> Notes</h2>
Starting with sg3_utils-1.09 a library called libsgutils is built in
some environments and
is required by most utilities. The library is made up of three source
files: <span style="font-family: monospace;">sg_lib.c</span>, <span
 style="font-family: monospace;">sg_cmds_basic.c</span> and <span
 style="font-family: monospace;">sg_cmds_extra.c</span>; and their
associated header files . The
<span style="font-family: monospace;">sg_lib.c</span> file contains
tables of SCSI
command names,
sense key and additional sense code strings and various related helper
functions. The <span style="font-family: monospace;">sg_cmds_basic.c</span>
file contains low level wrapper
functions for
commonly used SCSI commands. The <span style="font-family: monospace;">sg_cmds_extra.c</span>
file contains low
level wrapper functions for
less commonly used SCSI commands. The library can be built both as a
shared
object and a static library. The binary rpm package only contains the
shared library while the sg3_utils-devel rpm package contains the
static library, <span style="font-family: monospace;">sg_lib.h</span>,
<span style="font-family: monospace;">sg_cmds.h</span>, <span
 style="font-family: monospace;">sg_cmds_basic.h</span>, <span
 style="font-family: monospace;">sg_cmds_extra.h</span>
and some header files associated with the generic SCSI pass through
interface. If users do not want libraries
(shared or static) then they can refer to the "no_lib" subdirectory
in the tarball which contains "no_lib" versions of the Makefile and the
rpm "spec" file.<br>
<br>
In Linux many of the utilities in the sg3_utils package ultimately use
the SG_IO ioctl
(rather than the older write()/read() interface) in the sg driver. In
the lk 2.6&nbsp; series the SG_IO ioctl (or at least a stripped
down version of it) has been implemented in the block subsystem (see <a
 href="sg_io.html">sg_io.html</a> for more information). This
means that commands which previously only worked on sg device names
will
now work on block device names as well (e.g. "<span
 style="font-family: monospace;">sg_inq /dev/sda</span>"). To use
this facility safely version sg3_utils-1.02 or later should be used.
Note that SCSI tape devices (both st and osst device drivers) are char
devices and support the SG_IO ioctl from lk 2.6.6 onwards.<br>
<p>See the notes about header file problems in the README file inside
each package. </p>
<h2><a class="mozTocH2" name="mozTocId479511"></a> Download</h2>
Several recent versions of the sg3_utils package are listed below. The
tarballs contain README, CHANGELOG, INSTALL
files and man pages as well as source and build files. The build files
include Makefiles for various architectures, a linux rpm "spec" file
and a debian directory for building "deb" packages.&nbsp; Here is the
most recently released sg3_utils <a href="p/sg3_utils.CHANGELOG">CHANGELOG</a>
.<br>
<br>
<table border="1" width="100%">
  <caption><b>Table 2. sg3_utils tarballs and packages</b></caption> <tbody>
    <tr>
      <td><span style="font-weight: bold;">sg3_utils version</span><br>
release date<br>
      </td>
      <td valign="top">&nbsp; <b>tarballs</b>&nbsp;<br>
      </td>
      <td><b>rpm source rpms **<br>
      </b></td>
      <td><b>i386 rpm binaries **<br>
      </b></td>
      <td valign="top">&nbsp;&nbsp; <span style="font-weight: bold;">debian
packages</span><br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">1.20</span><br>
20060418<br>
      </td>
      <td style="vertical-align: top;"><a href="p/sg3_utils-1.20.tgz">sg3_utils-1.20.tgz</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3_utils-1.20-1.src.rpm">sg3_utils-1.20-1.src.rpm</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3_utils-1.20-1.i386.rpm">sg3_utils-1.20-1.i386.rpm</a><br>
      <a href="p/libsgutils-1_0-1.20-1.i386.rpm">libsgutils-1_0-1.20-1.i386.rpm</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3-utils_1.20-0.1_i386.deb">sg3-utils_1.20-0.1_i386.deb</a><br>
      <a href="p/libsgutils1-0_1.20-0.1_i386.deb">libsgutils1-0_1.20-0.1_i386.deb</a></td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">1.21<br>
      </span>20060706<span style="font-weight: bold;"><br>
      </span></td>
      <td style="vertical-align: top;"><a href="p/sg3_utils-1.21.tgz">sg3_utils-1.21.tgz</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3_utils-1.21-1.src.rpm">sg3_utils-1.21-1.src.rpm</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3_utils-1.21-1.i386.rpm">sg3_utils-1.21-1.i386.rpm</a><br>
      <a href="p/libsgutils-1_0-1.21-1.i386.rpm">libsgutils-1_0-1.21-1.i386.rpm</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3-utils_1.21-0.1_i386.deb">sg3-utils_1.21-0.1_i386.deb</a><br>
      <a href="p/libsgutils1-0_1.21-0.1_i386.deb">libsgutils1-0_1.21-0.1_i386.deb</a></td>
    </tr>
    <tr>
      <td><b>1.22<br>
      </b>20061016<b><br>
      </b></td>
      <td valign="top"><a href="p/sg3_utils-1.22.tgz">sg3_utils-1.22.tgz</a><br>
      </td>
      <td><a href="p/sg3_utils-1.22-1.src.rpm">sg3_utils-1.22-1.src.rpm</a></td>
      <td><a href="p/sg3_utils-1.22-1.i386.rpm">sg3_utils-1.22-1.i386.rpm</a><br>
      <a href="p/libsgutils-1_0-1.22-1.i386.rpm">libsgutils-1_0-1.22-1.i386.rpm</a><br>
      </td>
      <td valign="top"><a href="p/sg3-utils_1.22-0.1_i386.deb">sg3-utils_1.22-0.1_i386.deb</a><br>
      <a href="p/libsgutils1-0_1.22-0.1_i386.deb">libsgutils1-0_1.22-0.1_i386.deb</a><br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">1.23</span><br>
20070127<br>
      <b> </b></td>
      <td style="vertical-align: top;"><a href="p/sg3_utils-1.23.tgz">sg3_utils-1.23.tgz</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3_utils-1.23-1.src.rpm">sg3_utils-1.23-1.src.rpm</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg3_utils-1.23-1.i386.rpm">sg3_utils-1.23-1.i386.rpm</a><br>
      <a href="p/sg3_utils-libs-1.23-1.i386.rpm">sg3_utils-libs-1.23-1.i386.rpm</a><br>
      </td>
      <td style="vertical-align: top;"><a
 href="p/sg3-utils_1.23-0.1_i386.deb">sg3-utils_1.23-0.1_i386.deb</a><br>
      <a href="p/libsgutils1-0_1.23-0.1_i386.deb">libsgutils1-0_1.23-0.1_i386.deb</a></td>
    </tr>
  </tbody>
</table>
<br>
This <a href="p/sg3_utils_exe.zip">sg3_utils_exe.zip</a> file is a zip
archive of the most recent version Windows executables made in a MinGW
environment. This <a href="p/sg3_utils_man_html.tgz">sg3_utils_man_html.tgz</a>
file is a tarball of man pages converted to html by man2html.<br>
<br>
Version 1.14 of sg3_utils introduced a shared object (library) called
libsgutils. When binary packages are built then libsgutils is in its
own package (and there is another "libsgutils*-devel" package which
contains C header files and a static libsgutils.o library). The
sg3_utils binaries for version 1.14 to 1.23 normally require the
libsgutils library but can be built without it. In the future
other utilities such as <a href="sdparm.html">sdparm</a> may also
depend on the libsgutils
package.<br>
<br>
** Some browsers (e.g. firefox) may interpret a file with an extension
of "rpm" as an audio file. In which case press the right button over
the link and select "Save link as ..." to download the file.<br>
<br>
Below is the most recent version of the sg_utils package which targets
the linux kernel 2.2 series with some support for the lk 2.0 series. No
further work is being done on this package.<br>
<table border="1" width="100%">
  <caption><b>Table 3.&nbsp; sg_utils tarballs and packages</b></caption>
  <tbody>
    <tr>
      <td><span style="font-weight: bold;">sg_utils</span><br
 style="font-weight: bold;">
      <span style="font-weight: bold;">version</span><br>
      </td>
      <td valign="top">&nbsp; <b>tarballs</b>&nbsp;<br>
      </td>
      <td><b>rpm source rpms **<br>
      </b></td>
      <td><b>i386 rpm binaries **<br>
      </b></td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><b>1.02</b></td>
      <td style="vertical-align: top;"><a href="p/sg_utils-1.02.tgz">sg_utils-1.02.tgz</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg_utils-1.02-1.src.rpm">sg_utils-1.02-1.src.rpm</a></td>
      <td style="vertical-align: top;"><a
 href="p/sg_utils-1.02-1.i386.rpm">sg_utils-1.02-1.i386.rpm</a></td>
    </tr>
  </tbody>
</table>
<br>
There is no '<span style="font-family: monospace;">./configure</span>'
logic in sg3_utils so the correct Makefile must be chosen taking into
account the
operating system and several other attributes.<br>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
 cellspacing="2">
  <caption><span style="font-weight: bold;">Table 4.&nbsp;
Building from a source tarball</span><br>
  </caption><tbody>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">OS</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">build
to use shared library</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">build
without library</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">build
static executables</span><br>
      </td>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Notes</span><br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Linux</span><br>
      </td>
      <td style="vertical-align: top;">make<br>
      </td>
      <td style="vertical-align: top;">./make_no_lib.sh<br>
      </td>
      <td style="vertical-align: top;">./make_no_lib_static.sh<br>
      </td>
      <td style="vertical-align: top;">rpm spec file and debian
subdirectory included<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">FreeBSD</span><br>
      </td>
      <td style="vertical-align: top;">make -f Makefile.freebsd<br>
      </td>
      <td style="vertical-align: top;">./make_no_lib_freebsd.sh<br>
      </td>
      <td style="vertical-align: top;">&nbsp;<br>
      </td>
      <td style="vertical-align: top;">&nbsp;<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Tru64
(OSF1)</span><br>
      </td>
      <td style="vertical-align: top;">make -f Makefile.osf1<br>
      </td>
      <td style="vertical-align: top;">./make_no_lib_osf1.sh<br>
      </td>
      <td style="vertical-align: top;">&nbsp;<br>
      </td>
      <td style="vertical-align: top;">&nbsp;<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Windows</span><br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">make -f Makefile.win32<br>
      </td>
      <td style="vertical-align: top;">&nbsp;<br>
      </td>
      <td style="vertical-align: top;">Windows NT and later supported
(uses SPT interface). Builds in a cygwin environment and requires
cygwin1.dll to run.<br>
      </td>
    </tr>
    <tr>
      <td style="vertical-align: top;"><span style="font-weight: bold;">Windows</span><br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">make -f Makefile.mingw<br>
      </td>
      <td style="vertical-align: top;"><br>
      </td>
      <td style="vertical-align: top;">Builds in a MinGW/MSYS
environment and requires no third party dll<br>
      </td>
    </tr>
  </tbody>
</table>
<br>
<br>
Both sg3_utils and the
older sg_utils packages can
be found on <a href="http://freshmeat.net">http://freshmeat.net</a> .
Most of the above invocations can
take the name of a specific utility (e.g. "<span
 style="font-family: monospace;">make sg_inq</span>") to build only
that utility. There are also
"install", "uninstall" and "clean" targets in most Makefiles.<br>
<br>
<p>Return to <a href="index.html">main</a> page. </p>
<center>
<p>Last updated: 31st January 2007<br>
<br>
</p>
</center>
</body>
</html>