]> git.proxmox.com Git - mirror_smartmontools-debian.git/commitdiff
Merge tag 'upstream/6.3+svn3990'
authorGiuseppe Iuculano <iuculano@debian.org>
Sun, 5 Oct 2014 07:03:55 +0000 (09:03 +0200)
committerGiuseppe Iuculano <iuculano@debian.org>
Sun, 5 Oct 2014 07:03:55 +0000 (09:03 +0200)
Upstream version 6.3+svn3990

34 files changed:
debian/10mail [new file with mode: 0644]
debian/10powersave-notify [new file with mode: 0644]
debian/NEWS [new file with mode: 0644]
debian/README.Debian [new file with mode: 0644]
debian/README.source [new file with mode: 0644]
debian/badblockhowto.html [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/patches/3w-sas [new file with mode: 0644]
debian/patches/52_remove-pragma.diff [new file with mode: 0644]
debian/patches/53_use-smartd-runner-by-default.diff [new file with mode: 0644]
debian/patches/54_remove-Id-from-smartd.conf.diff [new file with mode: 0644]
debian/patches/60_remove-redhatism.diff [new file with mode: 0644]
debian/patches/61_cciss-doc.patch [new file with mode: 0644]
debian/patches/63_removable.patch [new file with mode: 0644]
debian/patches/kfreebsd.patch [new file with mode: 0644]
debian/patches/manpage.diff [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/smartd-runner [new file with mode: 0644]
debian/smartmontools-bug [new file with mode: 0644]
debian/smartmontools.default [new file with mode: 0644]
debian/smartmontools.init [new file with mode: 0644]
debian/smartmontools.install [new file with mode: 0644]
debian/smartmontools.lintian-overrides [new file with mode: 0644]
debian/smartmontools.postinst [new file with mode: 0644]
debian/smartmontools.preinst [new file with mode: 0644]
debian/source/format [new file with mode: 0644]
debian/update-smart-drivedb.8 [new file with mode: 0644]
debian/watch [new file with mode: 0644]

diff --git a/debian/10mail b/debian/10mail
new file mode 100644 (file)
index 0000000..f921a33
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash -e
+
+# Send mail if /usr/bin/mail exists
+if ! [ -x /usr/bin/mail ]; then
+       echo "Your system does not have /usr/bin/mail.  Install the mailx or mailutils package" 
+       exit 1
+fi
+
+input=$1
+shift
+
+/usr/bin/mail "$@" < $input
+
diff --git a/debian/10powersave-notify b/debian/10powersave-notify
new file mode 100644 (file)
index 0000000..4aaebbc
--- /dev/null
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+# Send message if /usr/lib/powersave/powersave-notify exists or exit silently
+[ -x /usr/lib/powersave/powersave-notify ] || exit 0
+
+/usr/lib/powersave/powersave-notify "<b>Your hard disk drive is failing!</b>
+S.M.A.R.T. message:
+$SMARTD_MESSAGE"
diff --git a/debian/NEWS b/debian/NEWS
new file mode 100644 (file)
index 0000000..43d00b2
--- /dev/null
@@ -0,0 +1,6 @@
+smartmontools (5.37-1) unstable; urgency=low
+
+  Prior to 5.37 temperature logging was enabled per default on SCSI disks, as
+  of version 5.37 please use the -W option in smartd.conf.
+
+ -- Guido Guenther <agx@sigxcpu.org>  Thu, 05 Apr 2007 10:18:10 +0200
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644 (file)
index 0000000..db2a1e2
--- /dev/null
@@ -0,0 +1,24 @@
+smartmontools for Debian
+------------------------
+
+To start smartd automatically on system startup set:
+ start_smartd=yes
+in /etc/default/smartmontools. If you only want to enable S.M.A.R.T. for a 
+device without running the daemon use the enable_smart variable.
+
+Don't use enable_smart for any disk monitored by smartd, this is likely to
+cause problems, especially for SATA (see e.g.
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=365027).
+
+Package Maintainers and system administrators can put scripts to be run
+when smartd detects an error into /etc/smartmontools/run.d. These
+scripts will be run by smartd-runner using run-parts(8). The script will
+receive the filename of the file containing the errormessage as first
+parameter. See /etc/smartmontools/run.d/10mail for an example.
+
+Upstream recommends running short self tests every day and long self tests once
+per week.
+
+Please read the file WARNINGS in this directory.
+
+ -- Guido Guenther <agx@sigxcpu.org>, Wen, 03 May 2006 21:47:00 +0000
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..8646078
--- /dev/null
@@ -0,0 +1,57 @@
+This package uses quilt to manage all modifications to the upstream
+source.  Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To configure quilt to use debian/patches instead of patches, you want
+either to export QUILT_PATCHES=debian/patches in your environment
+or use this snippet in your ~/.quiltrc:
+
+    for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
+        if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
+                export QUILT_PATCHES=debian/patches
+        fi
+    done
+
+To get the fully patched source after unpacking the source package, cd to
+the root level of the source package and run:
+
+    quilt push -a
+
+The last patch listed in debian/patches/series will become the current
+patch.
+
+To add a new set of changes, first run quilt push -a, and then run:
+
+    quilt new <patch>
+
+where <patch> is a descriptive name for the patch, used as the filename in
+debian/patches.  Then, for every file that will be modified by this patch,
+run:
+
+    quilt add <file>
+
+before editing those files.  You must tell quilt with quilt add what files
+will be part of the patch before making changes or quilt will not work
+properly.  After editing the files, run:
+
+    quilt refresh
+
+to save the results as a patch.
+
+Alternately, if you already have an external patch and you just want to
+add it to the build system, run quilt push -a and then:
+
+    quilt import -P <patch> /path/to/patch
+    quilt push -a
+
+(add -p 0 to quilt import if needed). <patch> as above is the filename to
+use in debian/patches.  The last quilt push -a will apply the patch to
+make sure it works properly.
+
+To remove an existing patch from the list of patches that will be applied,
+run:
+
+    quilt delete <patch>
+
+You may need to run quilt pop -a to unapply patches first before running
+this command.
diff --git a/debian/badblockhowto.html b/debian/badblockhowto.html
new file mode 100644 (file)
index 0000000..52ea120
--- /dev/null
@@ -0,0 +1,1044 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Bad block HOWTO for smartmontools</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><meta name="description" content="This article describes what actions might be taken when smartmontools detects a bad block on a disk. It demonstrates how to identify the file associated with an unreadable disk sector, and how to force that sector to reallocate."></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" title="Bad block HOWTO for smartmontools"><div class="titlepage"><div><div><h2 class="title"><a name="index"></a>Bad block HOWTO for smartmontools</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Bruce</span> <span class="surname">Allen</span></h3><div class="affiliation"><div class="address"><p><br>
+      <code class="email">&lt;<a class="email" href="mailto:smartmontools-support@lists.sourceforge.net">smartmontools-support@lists.sourceforge.net</a>&gt;</code><br>
+     </p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Douglas</span> <span class="surname">Gilbert</span></h3><div class="affiliation"><div class="address"><p><br>
+      <code class="email">&lt;<a class="email" href="mailto:smartmontools-support@lists.sourceforge.net">smartmontools-support@lists.sourceforge.net</a>&gt;</code><br>
+     </p></div></div></div></div><div><p class="copyright">Copyright © 2004, 2005, 2006, 2007 Bruce Allen</p></div><div><div class="legalnotice" title="Legal Notice"><a name="id2541562"></a><p>
+      Permission is granted to copy, distribute and/or modify this document
+      under the terms of the GNU Free Documentation License, Version 1.1
+      or any later version published by the Free Software Foundation;
+      with no Invariant Sections, with no Front-Cover Texts, and with
+      no Back-Cover Texts.
+   </p><p>
+    For an online copy of the license see
+    <a class="ulink" href="http://www.fsf.org/copyleft/fdl.html" target="_top">
+    <code class="literal">www.fsf.org/copyleft/fdl.html</code></a>.
+   </p></div></div><div><p class="pubdate">2007-01-23</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision 1.1</td><td align="left">2007-01-23</td><td align="left">dpg</td></tr><tr><td align="left" colspan="3">
+             add sections on ReiserFS and partition table damage
+       </td></tr><tr><td align="left">Revision 1.0</td><td align="left">2006-11-14</td><td align="left">dpg</td></tr><tr><td align="left" colspan="3">
+             merge BadBlockHowTo.txt and BadBlockSCSIHowTo.txt
+       </td></tr></table></div></div><div><div class="abstract" title="Abstract"><p class="title"><b>Abstract</b></p><p>
+    This article describes what actions might be taken when smartmontools
+    detects a bad block on a disk. It demonstrates how to identify the file
+    associated with an unreadable disk sector, and how to force that sector
+    to reallocate.
+  </p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#intro">Introduction</a></span></dt><dt><span class="sect1"><a href="#rfile">Repairs in a file system</a></span></dt><dd><dl><dt><span class="sect2"><a href="#e2_example1">ext2/ext3 first example</a></span></dt><dt><span class="sect2"><a href="#e2_example2">ext2/ext3 second example</a></span></dt><dt><span class="sect2"><a href="#unassigned">Unassigned sectors</a></span></dt><dt><span class="sect2"><a href="#reiserfs_ex">ReiserFS example</a></span></dt></dl></dd><dt><span class="sect1"><a href="#sdisk">Repairs at the disk level</a></span></dt><dd><dl><dt><span class="sect2"><a href="#partition">Partition table problems</a></span></dt><dt><span class="sect2"><a href="#lvm">LVM repairs</a></span></dt><dt><span class="sect2"><a href="#bb">Bad block reassignment</a></span></dt></dl></dd></dl></div><div class="sect1" title="Introduction"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="intro"></a>Introduction</h2></div></div></div><p>
+Handling bad blocks is a difficult problem as it often involves
+decisions about losing information. Modern storage devices tend
+to handle the simple cases automatically, for example by writing
+a disk sector that was read with difficulty to another area on
+the media. Even though such a remapping can be done by a disk
+drive transparently, there is still a lingering worry about media
+deterioration and the disk running out of spare sectors to remap.
+</p><p>
+Can smartmontools help? As the <acronym class="acronym">SMART</acronym> acronym
+<sup>[<a name="id2506421" href="#ftn.id2506421" class="footnote">1</a>]</sup>
+suggests, the <span class="command"><strong>smartctl</strong></span> command and the
+<span class="command"><strong>smartd</strong></span> daemon concentrate on monitoring and analysis.
+So apart from changing some reporting settings, smartmontools will not
+modify the raw data in a device. Also smartmontools only works with
+physical devices, it does not know about partitions and file systems.
+So other tools are needed. The job of smartmontools is to alert the user
+that something is wrong and user intervention may be required.
+</p><p>
+When a bad block is reported one approach is to work out the mapping between
+the logical block address used by a storage device and a file or some other
+component of a file system using that device. Note that there may not be such
+a mapping reflecting that a bad block has been found at a location not
+currently used by the file system. A user may want to do this analysis to
+localize and minimize the number of replacement files that are retrieved from
+some backup store. This approach requires knowledge of the file system
+involved and this document uses the Linux ext2/ext3 and ReiserFS file systems
+for examples. Also the type of content may come into play. For example if
+an area storing video has a corrupted sector, it may be easiest to accept
+that a frame or two might be corrupted and instruct the disk not to retry
+as that may have the visual effect of causing a momentary blank into a 1
+second pause (while the disk retries the faulty sector, often accompanied
+by a telltale clicking sound).
+</p><p>
+Another approach is to ignore the upper level consequences (e.g. corrupting
+a file or worse damage to a file system) and use the facilities offered by
+a storage device to repair the damage. The SCSI disk command set is used
+elaborate on this low level approach.
+</p></div><div class="sect1" title="Repairs in a file system"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rfile"></a>Repairs in a file system</h2></div></div></div><p>
+This section contains examples of what to do at the file system level
+when smartmontools reports a bad block. These examples assume the Linux
+operating system and either the ext2/ext3 or ReiserFS file system. The
+various Linux commands shown have man pages and the reader is encouraged
+to examine these. Of note is the <span class="command"><strong>dd</strong></span> command which is
+often used in repair work
+<sup>[<a name="id2506498" href="#ftn.id2506498" class="footnote">2</a>]</sup>
+and has a unique command line syntax.
+</p><p>
+The authors would like to thank Sergey Vlasov, Theodore Ts'o,
+Michael Bendzick, and others for explaining this approach. The authors would
+like to add text showing how to do this for other file systems, in
+particular XFS, and JFS: please email if you can provide this
+information.
+</p><div class="sect2" title="ext2/ext3 first example"><div class="titlepage"><div><div><h3 class="title"><a name="e2_example1"></a>ext2/ext3 first example</h3></div></div></div><p>
+In this example, the disk is failing self-tests at Logical Block
+Address LBA = 0x016561e9 = 23421417.  The LBA counts sectors in units
+of 512 bytes, and starts at zero.
+</p><p>
+</p><pre class="programlisting">
+root]# smartctl -l selftest /dev/hda:
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended offline    Completed: read failure       90%       217         0x016561e9
+</pre><p>
+Note that other signs that there is a bad sector on the disk can be
+found in the non-zero value of the Current Pending Sector count:
+</p><pre class="programlisting">
+root]# smartctl -A /dev/hda
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       1
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       1
+</pre><p>
+</p><p>
+First Step: We need to locate the partition on which this sector of
+the disk lives:
+</p><pre class="programlisting">
+root]# fdisk -lu /dev/hda
+
+Disk /dev/hda: 123.5 GB, 123522416640 bytes
+255 heads, 63 sectors/track, 15017 cylinders, total 241254720 sectors
+Units = sectors of 1 * 512 = 512 bytes
+
+   Device Boot    Start       End    Blocks   Id  System
+/dev/hda1   *        63   4209029   2104483+  83  Linux
+/dev/hda2       4209030   5269319    530145   82  Linux swap
+/dev/hda3       5269320 238227884 116479282+  83  Linux
+/dev/hda4     238227885 241248104   1510110   83  Linux
+</pre><p>
+
+The partition <code class="filename">/dev/hda3</code> starts at LBA 5269320 and
+extends past the 'problem' LBA.  The 'problem' LBA is offset
+23421417 - 5269320 = 18152097 sectors into the partition
+<code class="filename">/dev/hda3</code>.
+</p><p>
+To verify the type of the file system and the mount point, look in
+<code class="filename">/etc/fstab</code>:
+</p><pre class="programlisting">
+root]# grep hda3 /etc/fstab
+/dev/hda3 /data ext2 defaults 1 2
+</pre><p>
+You can see that this is an ext2 file system, mounted at
+<code class="filename">/data</code>.
+</p><p>
+Second Step: we need to find the block size of the file system
+(normally 4096 bytes for ext2):
+</p><pre class="programlisting">
+root]# tune2fs -l /dev/hda3 | grep Block
+Block count:              29119820
+Block size:               4096
+</pre><p>
+In this case the block size is 4096 bytes.
+
+Third Step: we need to determine which File System Block contains this
+LBA.  The formula is:
+</p><pre class="programlisting">
+  b = (int)((L-S)*512/B)
+where:
+b = File System block number
+B = File system block size in bytes
+L = LBA of bad sector
+S = Starting sector of partition as shown by fdisk -lu
+and (int) denotes the integer part.
+</pre><p>
+
+In our example, L=23421417, S=5269320, and B=4096.  Hence the
+'problem' LBA is in block number
+</p><pre class="programlisting">
+   b = (int)18152097*512/4096 = (int)2269012.125
+so b=2269012.
+</pre><p>
+</p><p>
+Note: the fractional part of 0.125 indicates that this problem LBA is
+actually the second of the eight sectors that make up this file system
+block.
+</p><p>
+Fourth Step: we use debugfs to locate the inode stored in this block,
+and the file that contains that inode:
+</p><pre class="programlisting">
+root]# debugfs
+debugfs 1.32 (09-Nov-2002)
+debugfs:  open /dev/hda3
+debugfs:  testb 2269012
+Block 2269012 not in use
+</pre><p>
+
+If the block is not in use, as in the above example, then you can skip
+the rest of this step and go ahead to Step Five.
+</p><p>
+If, on the other hand, the block is in use, we want to identify
+the file that uses it:
+</p><pre class="programlisting">
+debugfs:  testb 2269012
+Block 2269012 marked in use
+debugfs:  icheck 2269012
+Block   Inode number
+2269012 41032
+debugfs:  ncheck 41032
+Inode   Pathname
+41032   /S1/R/H/714197568-714203359/H-R-714202192-16.gwf
+</pre><p>
+In this example, you can see that the problematic file (with the mount
+point included in the path) is:
+<code class="filename">/data/S1/R/H/714197568-714203359/H-R-714202192-16.gwf</code>
+</p><p>
+When we are working with an ext3 file system, it may happen that the
+affected file is the journal itself.  Generally, if this is the case,
+the inode number will be very small.  In any case, debugfs will not
+be able to get the file name:
+</p><pre class="programlisting">
+debugfs:  testb 2269012
+Block 2269012 marked in use
+debugfs:  icheck 2269012
+Block   Inode number
+2269012 8
+debugfs:  ncheck 8
+Inode   Pathname
+debugfs:
+</pre><p>
+</p><p>
+To get around this situation, we can remove the journal altogether:
+</p><pre class="programlisting">
+tune2fs -O ^has_journal /dev/hda3
+</pre><p>
+
+and then start again with Step Four: we should see this time that the
+wrong block is not in use any more.  If we removed the journal file, at
+the end of the whole procedure we should remember to rebuild it:
+</p><pre class="programlisting">
+tune2fs -j /dev/hda3
+</pre><p>
+</p><p>
+Fifth Step
+<span class="emphasis"><em>NOTE:</em></span> This last step will <span class="emphasis"><em>permanently
+
+</em></span> and irretrievably <span class="emphasis"><em>destroy</em></span> the contents
+of the file system block that is damaged: if the block was allocated to
+a file, some of the data that is in this file is going to be overwritten
+with zeros.  You will not be able to recover that data unless you can
+replace the file with a fresh or correct version.
+</p><p>
+To force the disk to reallocate this bad block we'll write zeros to
+the bad block, and sync the disk:
+</p><pre class="programlisting">
+root]# dd if=/dev/zero of=/dev/hda3 bs=4096 count=1 seek=2269012
+root]# sync
+</pre><p>
+</p><p>
+Now everything is back to normal: the sector has been reallocated.
+Compare the output just below to similar output near the top of this
+article:
+</p><pre class="programlisting">
+root]# smartctl -A /dev/hda
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       1
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       1
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       1
+</pre><p>
+
+Note: for some disks it may be necessary to update the SMART Attribute values by using
+<span class="command"><strong>smartctl -t offline /dev/hda</strong></span>
+</p><p>
+We have corrected the first errored block.  If more than one blocks
+were errored, we should repeat all the steps for the subsequent ones.
+After we do that, the disk will pass its self-tests again:
+
+</p><pre class="programlisting">
+root]# smartctl -t long /dev/hda  [wait until test completes, then]
+root]# smartctl -l selftest /dev/hda
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended offline    Completed without error       00%       239         -
+# 2  Extended offline    Completed: read failure       90%       217         0x016561e9
+# 3  Extended offline    Completed: read failure       90%       212         0x016561e9
+# 4  Extended offline    Completed: read failure       90%       181         0x016561e9
+# 5  Extended offline    Completed without error       00%        14         -
+# 6  Extended offline    Completed without error       00%         4         -
+</pre><p>
+</p><p>
+and no longer shows any offline uncorrectable sectors:
+
+</p><pre class="programlisting">
+root]# smartctl -A /dev/hda
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       1
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       1
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
+</pre><p>
+</p></div><div class="sect2" title="ext2/ext3 second example"><div class="titlepage"><div><div><h3 class="title"><a name="e2_example2"></a>ext2/ext3 second example</h3></div></div></div><p>
+On this drive, the first sign of trouble was this email from smartd:
+</p><pre class="programlisting">
+    To: ballen
+    Subject: SMART error (selftest) detected on host: medusa-slave166.medusa.phys.uwm.edu
+
+    This email was generated by the smartd daemon running on host:
+    medusa-slave166.medusa.phys.uwm.edu in the domain: master001-nis
+
+    The following warning/error was logged by the smartd daemon:
+    Device: /dev/hda, Self-Test Log error count increased from 0 to 1
+</pre><p>
+</p><p>
+Running <span class="command"><strong>smartctl -a /dev/hda</strong></span> confirmed the problem:
+    
+</p><pre class="programlisting">
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended offline    Completed: read failure       80%       682         0x021d9f44
+
+Note that the failing LBA reported is 0x021d9f44 (base 16) = 35495748 (base 10)
+    
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       3
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       3
+</pre><p>
+</p><p>
+and one can see above that there are 3 sectors on the list of pending
+sectors that the disk can't read but would like to reallocate.
+</p><p>
+The device also shows errors in the SMART error log:
+</p><pre class="programlisting">
+Error 212 occurred at disk power-on lifetime: 690 hours
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 12 46 9f 1d e2  Error: UNC 18 sectors at LBA = 0x021d9f46 = 35495750
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  25 00 12 46 9f 1d e0 00 2485545.000  READ DMA EXT
+</pre><p>
+</p><p>
+Signs of trouble at this LBA may also be found in SYSLOG:
+</p><pre class="programlisting">
+[root]# grep LBA /var/log/messages | awk '{print $12}' | sort | uniq
+ LBAsect=35495748
+ LBAsect=35495750
+</pre><p>
+</p><p>
+So I decide to do a quick check to see how many bad sectors there
+really are. Using the bash shell I check 70 sectors around the trouble
+area:
+</p><pre class="programlisting">
+[root]# export i=35495730
+[root]# while [ $i -lt 35495800 ]
+        &gt; do echo $i
+        &gt; dd if=/dev/hda of=/dev/null bs=512 count=1 skip=$i
+        &gt; let i+=1
+        &gt; done
+&lt;SNIP&gt;   
+
+35495734
+1+0 records in
+1+0 records out
+35495735
+dd: reading `/dev/hda': Input/output error
+0+0 records in
+0+0 records out
+
+&lt;SNIP&gt;
+
+35495751
+dd: reading `/dev/hda': Input/output error
+0+0 records in
+0+0 records out
+35495752
+1+0 records in
+1+0 records out
+
+&lt;SNIP&gt;
+</pre><p>
+</p><p>
+which shows that the seventeen sectors 35495735-35495751 (inclusive)
+are not readable.
+</p><p>
+Next, we identify the files at those locations.  The partitioning
+information on this disk is identical to the first example above, and
+as in that case the problem sectors are on the third partition
+<code class="filename">/dev/hda3</code>.  So we have:
+</p><pre class="programlisting">
+     L=35495735 to 35495751
+     S=5269320
+     B=4096
+</pre><p>
+so that b=3778301 to 3778303 are the three bad blocks in the file
+system.
+
+</p><pre class="programlisting">
+[root]# debugfs
+debugfs 1.32 (09-Nov-2002)
+debugfs:  open /dev/hda3
+debugfs:  icheck 3778301
+Block   Inode number
+3778301 45192
+debugfs:  icheck 3778302
+Block   Inode number
+3778302 45192
+debugfs:  icheck 3778303
+Block   Inode number
+3778303 45192
+debugfs:  ncheck 45192
+Inode   Pathname
+45192   /S1/R/H/714979488-714985279/H-R-714979984-16.gwf
+debugfs:  quit
+</pre><p>
+Note that the first few steps of this procedure could also be done
+with a single command, which is very helpful if there are many bad
+blocks (thanks to Danie Marais for pointing this out):
+</p><pre class="programlisting">
+debugfs: icheck 3778301 3778302 3778303
+</pre><p>
+</p><p>
+And finally, just to confirm that this is really the damaged file:
+</p><p>
+</p><pre class="programlisting">
+[root]# md5sum /data/S1/R/H/714979488-714985279/H-R-714979984-16.gwf
+md5sum: /data/S1/R/H/714979488-714985279/H-R-714979984-16.gwf: Input/output error
+</pre><p>
+</p><p>
+Finally we force the disk to reallocate the three bad blocks:
+</p><pre class="programlisting">
+[root]# dd if=/dev/zero of=/dev/hda3 bs=4096 count=3 seek=3778301
+[root]# sync
+</pre><p>
+</p><p>
+We could also probably use:
+</p><pre class="programlisting">
+[root]# dd if=/dev/zero of=/dev/hda bs=512 count=17 seek=35495735
+</pre><p>
+</p><p>
+At this point we now have:
+</p><pre class="programlisting">
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
+</pre><p>
+</p><p>
+which is encouraging, since the pending sectors count is now zero.
+Note that the drive reallocation count has not yet increased: the
+drive may now have confidence in these sectors and have decided not to
+reallocate them..
+</p><p>
+A device self test: 
+</p><pre class="programlisting">
+  [root#] smartctl -t long /dev/hda
+(then wait about an hour) shows no unreadable sectors or errors:
+
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended offline    Completed without error       00%       692         -
+# 2  Extended offline    Completed: read failure       80%       682         0x021d9f44
+</pre><p>
+</p></div><div class="sect2" title="Unassigned sectors"><div class="titlepage"><div><div><h3 class="title"><a name="unassigned"></a>Unassigned sectors</h3></div></div></div><p>
+This section was written by Kay Diederichs. Even though this section
+assumes Linux and the ext2/ext3 file system, the strategy should be
+more generally applicable.
+</p><p>
+I read your badblocks-howto at and greatly
+benefited from it. One thing that's (maybe) missing is that often the
+<span class="command"><strong>smartctl -t long</strong></span> scan finds a bad sector which is
+<span class="emphasis"><em> not</em></span> assigned to
+any file. In that case it does not help to run debugfs, or rather
+debugfs reports the fact that no file owns that sector. Furthermore,
+it is somewhat laborious to come up with the correct numbers for
+debugfs, and debugfs is slow ...
+</p><p>
+So what I suggest in the case of presence of
+Current_Pending_Sector/Offline_Uncorrectable errors is to create a
+huge file on that file system.
+</p><pre class="programlisting">
+  dd if=/dev/zero of=/some/mount/point bs=4k
+</pre><p>
+creates the file. Leave it running until the partition/file system is
+full. This will make the disk reallocate those sectors which do not
+belong to a file. Check the <span class="command"><strong>smartctl -a</strong></span> output after
+that and make
+sure that the sectors are reallocated. If any remain, use the debugfs
+method.  Of course the usual caveats apply - back it up first, and so
+on.
+</p></div><div class="sect2" title="ReiserFS example"><div class="titlepage"><div><div><h3 class="title"><a name="reiserfs_ex"></a>ReiserFS example</h3></div></div></div><p>
+This section was written by Joachim Jautz with additions from Manfred
+Schwarb.
+</p><p>
+The following problems were reported during a scheduled test:
+</p><pre class="programlisting">
+smartd[575]: Device: /dev/hda, starting scheduled Offline Immediate Test.
+[... 1 hour later ...]
+smartd[575]: Device: /dev/hda, 1 Currently unreadable (pending) sectors
+smartd[575]: Device: /dev/hda, 1 Offline uncorrectable sectors
+</pre><p>
+</p><p>
+[Step 0] The SMART selftest/error log
+(see <span class="command"><strong>smartctl -l selftest</strong></span>) indicated there was a problem
+with block address (i.e. the 512 byte sector at) 58656333. The partition
+table (e.g. see <span class="command"><strong>sfdisk -luS /dev/hda</strong></span> or
+<span class="command"><strong>fdisk -ul /dev/hda</strong></span>) indicated that this block was in the
+<code class="filename">/dev/hda3</code> partition which contained a ReiserFS file
+system. That partition started at block address 54781650.
+</p><p>
+While doing the initial analysis it may also be useful to take a copy
+of the disk attributes returned by <span class="command"><strong>smartctl -A /dev/hda</strong></span>.
+Specifically the values associated with the "Reallocated_Sector_Ct" and
+"Reallocated_Event_Count" attributes (for ATA disks, the grown list (GLIST)
+length for SCSI disks). If these are incremented at the end of the procedure
+it indicates that the disk has re-allocated one or more sectors.
+</p><p>
+[Step 1] Get the file system's block size:
+</p><pre class="programlisting">
+# debugreiserfs /dev/hda3 | grep '^Blocksize'
+Blocksize: 4096
+</pre><p>
+</p><p>
+[Step 2] Calculate the block number:
+</p><pre class="programlisting">
+# echo "(58656333-54781650)*512/4096" | bc -l
+484335.37500000000000000000
+</pre><p>
+It is re-assuring that the calculated 4 KB damaged block address in
+<code class="filename">/dev/hda3</code> is less than "Count of blocks on the
+device" shown in the output of <span class="command"><strong>debugreiserfs</strong></span> shown above.
+</p><p>
+[Step 3] Try to get more info about this block =&gt; reading the block
+fails as expected but at least we see now that it seems to be unused.
+If we do not get the `Cannot read the block' error we should
+check if our calculation in [Step 2] was correct ;)
+</p><pre class="programlisting">
+# debugreiserfs -1 484335 /dev/hda3
+debugreiserfs 3.6.19 (2003 http://www.namesys.com)
+
+484335 is free in ondisk bitmap
+The problem has occurred looks like a hardware problem.
+</pre><p>
+</p><p>
+If you have bad blocks, we advise you to get a new hard drive, because
+once you get one bad block that the disk drive internals cannot hide from
+your sight, the chances of getting more are generally said to become
+much higher (precise statistics are unknown to us), and this disk
+drive is probably not expensive enough for you to risk your
+time and data on it. If you don't want to follow that 
+advice then if you have just a few bad blocks, try writing to the
+bad blocks and see if the drive remaps the bad blocks (that means
+it takes a block it has in reserve and allocates it for use for
+of that block number). If it cannot remap the block, use
+<span class="command"><strong>badblock</strong></span> option (-B) with reiserfs utils to handle
+this block correctly.
+</p><pre class="programlisting">
+bread: Cannot read the block (484335): (Input/output error).
+
+Aborted
+</pre><p>
+So it looks like we have the right (i.e. faulty) block address.
+</p><p>
+[Step 4] Try then to find the affected file
+<sup>[<a name="id2550815" href="#ftn.id2550815" class="footnote">3</a>]</sup>:
+</p><pre class="programlisting">
+tar -cO /mydir | cat &gt;/dev/null
+</pre><p>
+If you do not find any unreadable files, then the block may be free or
+located in some metadata of the file system.
+</p><p>
+[Step 5] Try your luck: bang the affected block with
+<span class="command"><strong>badblocks -n</strong></span> (non-destructive read-write mode, do unmount
+first), if you are very lucky the failure is transient and you can provoke
+reallocation
+<sup>[<a name="id2550862" href="#ftn.id2550862" class="footnote">4</a>]</sup>:
+</p><pre class="programlisting">
+# badblocks -b 4096 -p 3 -s -v -n /dev/hda3 `expr 484335 + 100` `expr 484335 - 100`
+</pre><p>
+<sup>[<a name="id2550876" href="#ftn.id2550876" class="footnote">5</a>]</sup>
+</p><p>
+check success with <span class="command"><strong>debugreiserfs -1 484335 /dev/hda3</strong></span>.
+Otherwise:
+</p><p>
+[Step 6] Perform this step <span class="emphasis"><em>only</em></span> if Step 5 has failed
+to fix the problem: overwrite that block to force reallocation:
+</p><pre class="programlisting">
+# dd if=/dev/zero of=/dev/hda3 count=1 bs=4096 seek=484335
+1+0 records in
+1+0 records out
+4096 bytes transferred in 0.007770 seconds (527153 bytes/sec)
+</pre><p>
+</p><p>
+[Step 7] If you can't rule out the bad block being in metadata, do
+a file system check:
+</p><pre class="programlisting">
+reiserfsck --check
+</pre><p>
+This could take a long time so you probably better go for lunch ...
+</p><p>
+[Step 8] Proceed as stated earlier. For example, sync disk and run a long
+selftest that should succeed now.
+</p></div></div><div class="sect1" title="Repairs at the disk level"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sdisk"></a>Repairs at the disk level</h2></div></div></div><p>
+This section first looks at a damaged partition table. Then it ignores
+the upper level impact of a bad block and just repairs the underlying
+sector so that defective sector will not cause problems in the future.
+</p><div class="sect2" title="Partition table problems"><div class="titlepage"><div><div><h3 class="title"><a name="partition"></a>Partition table problems</h3></div></div></div><p>
+Some software failures can lead to zeroes or random data being written
+on the first block of a disk. For disks that use a DOS-based partitioning
+scheme this will overwrite the partition table which is found at the
+end of the first block. This is a single point of failure so after the
+damage tools like <span class="command"><strong>fdisk</strong></span> have no alternate data to use
+so they report no partitions or a damaged partition table.
+</p><p>
+One utility that may help is 
+<a class="ulink" href="http://www.cgsecurity.org/wiki/TestDisk" target="_top">
+<code class="literal">testdisk</code></a> which can scan a disk looking for
+partitions and recreate a partition table if requested.
+<sup>[<a name="id2550980" href="#ftn.id2550980" class="footnote">6</a>]</sup>
+</p><p>
+Programs that create DOS partitions
+often place the first partition at logical block address 63. In Linux
+a loop back mount can be attempted at the appropriate offset of a disk
+with a damaged partition table. This approach may involve placing the
+disk with the damaged partition table in a working computer or perhaps
+an external USB enclosure. Assuming the disk with the damaged partition
+is <code class="filename">/dev/hdb</code>. Then the following read-only loop back
+mount could be tried:
+</p><pre class="programlisting">
+# mount -r /dev/hdb -o loop,offset=32256 /mnt
+</pre><p>
+The offset is in bytes so the number given is (63 * 512). If the file
+system cannot be identified then a '-t &lt;fs_type&gt;'
+may be needed (although this is not a good sign). If this mount is
+successful, a backup procedure is advised.
+</p><p>
+Only the primary DOS partitions are recorded in the first block of
+a disk. The extended DOS partition table is placed elsewhere on
+a disk. Again there is only one copy of it so it represents another
+single point of failure. All DOS partition information can be
+read in a form that can be used to recreate the tables with the
+<span class="command"><strong>sfdisk</strong></span> command. Obviously this needs to be done
+beforehand and the file put on other media. Here is how to fetch the
+partition table information:
+</p><pre class="programlisting">
+# sfdisk -dx /dev/hda &gt; my_disk_partition_info.txt
+</pre><p>
+Then <code class="filename">my_disk_partition_info.txt</code> should be placed on
+other media. If disaster strikes, then the disk with the damaged partition
+table(s) can be placed in a working system, let us say the damaged disk is
+now at <code class="filename">/dev/hdc</code>, and the following command restores
+the partition table(s):
+</p><pre class="programlisting">
+# sfdisk -x -O part_block_prior.img /dev/hdc &lt; my_disk_partition_info.txt
+</pre><p>
+Since the above command is potentially destructive it takes a copy of the
+block(s) holding the partition table(s) and puts it in
+<code class="filename">part_block_prior.img</code> prior to any changes. Then it
+changes the partition tables as indicated by
+<code class="filename">my_disk_partition_info.txt</code>. For what it is worth the
+author did test this on his system!
+<sup>[<a name="id2551099" href="#ftn.id2551099" class="footnote">7</a>]</sup>
+</p><p>
+For creating, destroying, resizing, checking and copying partitions, and
+the file systems on them, GNU's
+<a class="ulink" href="http://www.gnu.org/software/parted" target="_top">
+<code class="literal">parted</code></a> is worth examining.
+The <a class="ulink" href="http://www.tldp.org/HOWTO/Large-Disk-HOWTO.html" target="_top">
+<code class="literal">Large Disk HOWTO</code></a> is also a useful resource.
+</p></div><div class="sect2" title="LVM repairs"><div class="titlepage"><div><div><h3 class="title"><a name="lvm"></a>LVM repairs</h3></div></div></div><p>
+This section was written by Frederic BOITEUX. It was titled: "HOW TO
+LOCATE AND REPAIR BAD BLOCKS ON AN LVM VOLUME".
+</p><p>
+Smartd reports an error in a short test :
+</p><pre class="programlisting">
+# smartctl -a /dev/hdb
+...
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short offline       Completed: read failure       90%        66         37383668
+</pre><p>
+So the disk has a bad block located in LBA block 37383668
+</p><p>
+In which physical partition is the bad block ?
+</p><pre class="programlisting">
+# sfdisk -luS /dev/hdb  # or 'fdisk -ul /dev/hdb'
+
+Disk /dev/hdb: 9729 cylinders, 255 heads, 63 sectors/track
+Units = sectors of 512 bytes, counting from 0
+
+   Device Boot    Start       End   #sectors  Id  System
+/dev/hdb1            63    996029     995967  82  Linux swap / Solaris
+/dev/hdb2   *    996030   1188809     192780  83  Linux
+/dev/hdb3       1188810 156296384  155107575  8e  Linux LVM
+/dev/hdb4             0         -          0   0  Empty
+</pre><p>
+
+It's in the <code class="filename">/dev/hdb3</code> partition, a LVM2 partition.
+From the LVM2 partition beginning, the bad block has an offset of
+</p><pre class="programlisting">
+(37383668 - 1188810) = 36194858
+</pre><p>
+</p><p>
+We have to find in which LVM2 logical partition the block belongs to.
+</p><p>
+In which logical partition is the bad block ?
+</p><p>
+<span class="emphasis"><em>IMPORTANT</em></span> : LVM2 can use different schemes dividing
+its physical partitions to logical ones : linear, striped, contiguous or
+ not... The following example assumes that allocation is linear !
+</p><p>
+The physical partition used by LVM2 is divided in PE (Physical Extent)
+units of the same size, starting at pe_start' 512 bytes blocks from
+the beginning of the physical partition.
+</p><p>
+The 'pvdisplay' command gives the size of the PE (in KB) of the
+LVM partition :
+</p><pre class="programlisting">
+#  part=/dev/hdb3 ; pvdisplay -c $part | awk -F: '{print $8}'
+4096
+</pre><p>
+</p><p>
+To get its size in LBA block size (512 bytes or 0.5 KB), we multiply this
+number by 2 : 4096 * 2 = 8192 blocks for each PE.
+</p><p>
+To find the offset from the beginning of the physical partition is a
+bit more difficult : if you have a recent LVM2 version, try :
+</p><pre class="programlisting">
+# pvs -o+pe_start $part
+</pre><p>
+</p><p>
+Either, you can look in /etc/lvm/backup :
+</p><pre class="programlisting">
+# grep pe_start $(grep -l $part /etc/lvm/backup/*)
+                        pe_start = 384
+</pre><p>
+</p><p>
+Then, we search in which PE is the badblock, calculating the PE rank
+in which the faulty block of the partition is :
+physical partition's bad block number / sizeof(PE) =
+</p><pre class="programlisting">
+36194858 / 8192 = 4418.3176
+</pre><p>
+</p><p>
+So we have to find in which LVM2 logical partition is used the PE
+number 4418 (count starts from 0) :
+</p><pre class="programlisting">
+# lvdisplay --maps |egrep 'Physical|LV Name|Type'
+  LV Name                /dev/WDC80Go/racine
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    0 to 127
+  LV Name                /dev/WDC80Go/usr
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    128 to 1407
+  LV Name                /dev/WDC80Go/var
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    1408 to 1663
+  LV Name                /dev/WDC80Go/tmp
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    1664 to 1791
+  LV Name                /dev/WDC80Go/home
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    1792 to 3071
+  LV Name                /dev/WDC80Go/ext1
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    3072 to 10751
+  LV Name                /dev/WDC80Go/ext2
+    Type                linear
+    Physical volume     /dev/hdb3
+    Physical extents    10752 to 18932
+</pre><p>
+</p><p>
+So the PE #4418 is in the <code class="filename">/dev/WDC80Go/ext1</code>
+LVM logical partition.
+</p><p>
+Size of logical block of file system on <code class="filename">/dev/WDC80Go/ext1
+</code> :
+</p><p>
+It's a ext3 fs, so I get it like this :
+</p><pre class="programlisting">
+# dumpe2fs /dev/WDC80Go/ext1 | grep 'Block size'
+dumpe2fs 1.37 (21-Mar-2005)
+Block size:               4096
+</pre><p>
+</p><p>
+bad block number for the file system :
+</p><p>
+The logical partition begins on PE 3072 :
+</p><pre class="programlisting">
+ (# PE's start of partition * sizeof(PE)) + parttion offset[pe_start] =
+ (3072 * 8192) + 384 = 25166208
+</pre><p>
+512b block of the physical partition, so the bad block number for the
+file system  is :
+</p><pre class="programlisting">
+(36194858 - 25166208) / (sizeof(fs block) / 512)
+= 11028650 / (4096 / 512)  = 1378581.25
+</pre><p>
+</p><p>
+Test of the fs bad block :
+</p><pre class="programlisting">
+dd if=/dev/WDC80Go/ext1 of=block1378581 bs=4096 count=1 skip=1378581
+</pre><p>
+</p><p>
+If this dd command succeeds, without any error message in console or
+syslog, then the block number calculation is probably wrong ! *Don't*
+go further, re-check it and if you don't find the error, please
+renounce !
+</p><p>
+Search / correction follows the same scheme as for simple
+partitions :
+</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+find possible impacted files with debugfs (icheck &lt;fs block nb&gt;,
+then ncheck &lt;icheck nb&gt;).
+</p></li><li class="listitem"><p>
+reallocate bad block writing zeros in it, *using the fs block size* :
+</p></li></ul></div><p>
+</p><p>
+</p><pre class="programlisting">
+dd if=/dev/zero of=/dev/WDC80Go/ext1 count=1 bs=4096 seek=1378581
+</pre><p>
+</p><p>
+Et voilà !
+</p></div><div class="sect2" title="Bad block reassignment"><div class="titlepage"><div><div><h3 class="title"><a name="bb"></a>Bad block reassignment</h3></div></div></div><p>
+The SCSI disk command set and associated disk architecture are assumed
+in this section. SCSI disks have their own logical to physical mapping
+allowing a damaged sector (usually carrying 512 bytes of data) to be
+remapped irrespective of the operating system, file system or software
+RAID being used.
+</p><p>
+The terms <span class="emphasis"><em>block</em></span> and <span class="emphasis"><em>sector</em></span> are
+used interchangeably, although block tends to get used in higher level or
+more abstract contexts such as a <span class="emphasis"><em>logical block</em></span>.
+</p><p>
+When a SCSI disk is formatted, defective sectors identified during
+the manufacturing process (the so called primary list: PLIST),
+those found during the format itself (the certification list: CLIST),
+those given explicitly to the format command (the DLIST) and optionally
+the previous grown list (GLIST) are not used in the logical block
+map. The number (and low level addresses) of the unmapped sectors can be
+found with the READ DEFECT DATA SCSI command.
+</p><p>
+SCSI disks tend to be divided into zones which have spare sectors and
+perhaps spare tracks, to support the logical block address mapping
+process. The idea is that if a logical block is remapped, the heads do not
+have to move a long way to access the replacement sector. Note that spare
+sectors are a scarce resource.
+</p><p>
+Once a SCSI disk format has completed successfully, other problems
+may appear over time. These fall into two categories:
+</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+recoverable: the Error Correction Codes (ECC) detect a problem
+but it is small enough to be corrected. Optionally other strategies
+such as retrying the access may retrieve the data.
+</p></li><li class="listitem"><p>
+unrecoverable: try as it may, the disk logic and ECC algorithms
+cannot recover the data. This is often reported as a
+<span class="emphasis"><em>medium error</em></span>.
+</p></li></ul></div><p>
+</p><p>
+Other things can go wrong, typically associated with the transport and
+they will be reported using a term other than
+<span class="emphasis"><em>medium error</em></span>. For example a disk may decide a read
+operation was successful but a computer's host bus adapter (HBA) checking
+the incoming data detects a CRC error due to a bad cable or termination.
+</p><p>
+Depending on the disk vendor, recoverable errors can be ignored. After all,
+some disks have up to 68 bytes of ECC above the payload size of 512 bytes
+so why use up spare sectors which are limited in number
+<sup>[<a name="id2551516" href="#ftn.id2551516" class="footnote">8</a>]</sup>
+?
+If the disk can recover the data and does decide to re-allocate (reassign)
+a sector, then first it checks the settings of the ARRE and AWRE bits in the
+read-write error recovery mode page. Usually these bits are set
+<sup>[<a name="id2551535" href="#ftn.id2551535" class="footnote">9</a>]</sup>
+enabling automatic (read or write) re-allocation. The automatic
+re-allocation may also fail if the zone (or disk) has run out of spare
+sectors.
+</p><p>
+Another consideration with RAIDs, and applications that require a high
+data rate without pauses, is that the controller logic may not want a
+disk to spend too long trying to recover an error.
+</p><p>
+Unrecoverable errors will cause a <span class="emphasis"><em>medium error</em></span> sense
+key, perhaps with some useful additional sense information. If the extended
+background self test includes a full disk read scan, one would expect the
+self test log to list the bad block, as shown in the <a class="xref" href="#rfile" title="Repairs in a file system">the section called &#8220;Repairs in a file system&#8221;</a>.
+Recent SCSI disks with a periodic background scan should also list
+unrecoverable read errors (and some recoverable errors as well). The
+advantage of the background scan is that it runs to completion while self
+tests will often terminate at the first serious error.
+</p><p>
+SCSI disks expect unrecoverable errors to be fixed manually using the
+REASSIGN BLOCKS SCSI command since loss of data is involved. It is possible
+that an operating system or a file system could issue the REASSIGN BLOCKS
+command itself but the authors are unaware of any examples. The REASSIGN BLOCKS
+command will reassign one or more blocks, attempting to (partially ?) recover
+the data (a forlorn hope at this stage), fetch an unused spare sector from the
+current zone while adding the damaged old sector to the GLIST (hence the
+name "grown" list). The contents of the GLIST may not be that interesting
+but <span class="command"><strong>smartctl</strong></span> prints out the number of entries in the grown
+list and if that number grows quickly, the disk may be approaching the end
+of its useful life.
+</p><p>
+Here is an alternate brute force technique to consider: if the data on the
+SCSI or ATA disk has all been backed up (e.g. is held on the other disks in
+a RAID 5 enclosure), then simply reformatting the disk may be the least
+cumbersome approach.
+</p><div class="sect3" title="Example"><div class="titlepage"><div><div><h4 class="title"><a name="sexample"></a>Example</h4></div></div></div><p>
+Given a "bad block", it still may be useful to look at the
+<span class="command"><strong>fdisk</strong></span> command (if the disk has multiple partitions)
+to find out which partition is involved, then use
+<span class="command"><strong>debugfs</strong></span> (or a similar tool for the file system in
+question) to find out which, if any, file or other part of the file system
+may have been damaged. This is discussed in the <a class="xref" href="#rfile" title="Repairs in a file system">the section called &#8220;Repairs in a file system&#8221;</a>.
+</p><p>
+Then a program that can execute the REASSIGN BLOCKS SCSI command is
+required. In Linux (2.4 and 2.6 series), FreeBSD, Tru64(OSF) and Windows
+the author's <span class="command"><strong>sg_reassign</strong></span> utility in the sg3_utils
+package can be used. Also found in that package is
+<span class="command"><strong>sg_verify</strong></span> which can be used to check that a block is
+readable.
+</p><p>
+Assume that logical block address 1193046 (which is 123456 in hex) is
+corrupt
+<sup>[<a name="id2551756" href="#ftn.id2551756" class="footnote">10</a>]</sup>
+on the disk at <code class="filename">/dev/sdb</code>. A long selftest command like
+<span class="command"><strong>smartctl -t long /dev/sdb</strong></span> may result in log results
+like this:
+</p><pre class="programlisting">
+# smartctl -l selftest /dev/sdb
+smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+
+SMART Self-test log
+Num  Test              Status            segment  LifeTime  LBA_first_err [SK ASC ASQ]
+     Description                         number   (hours)
+# 1  Background long   Failed in segment      -     354           1193046 [0x3 0x11 0x0]
+# 2  Background short  Completed              -     323                 - [-   -    -]
+# 3  Background short  Completed              -     194                 - [-   -    -]
+</pre><p>
+</p><p>
+The <span class="command"><strong>sg_verify</strong></span> utility can be used to confirm that there
+is a problem at that address:
+</p><pre class="programlisting">
+# sg_verify --lba=1193046 /dev/sdb
+verify (10):  Fixed format, current;  Sense key: Medium Error
+ Additional sense: Unrecovered read error
+  Info fld=0x123456 [1193046]
+  Field replaceable unit code: 228
+  Actual retry count: 0x008b
+medium or hardware error, reported lba=0x123456
+</pre><p>
+</p><p>
+Now the GLIST length is checked before the block reassignment:
+</p><pre class="programlisting">
+# sg_reassign --grown /dev/sdb
+&gt;&gt; Elements in grown defect list: 0
+</pre><p>
+</p><p>
+And now for the actual reassignment followed by another check of the GLIST
+length:
+</p><pre class="programlisting">
+# sg_reassign --address=1193046 /dev/sdb
+
+# sg_reassign --grown /dev/sdb
+&gt;&gt; Elements in grown defect list: 1
+</pre><p>
+</p><p>
+The GLIST length has grown by one as expected. If the disk was unable to
+recover any data, then the "new" block at lba 0x123456 has vendor specific
+data in it. The <span class="command"><strong>sg_reassign</strong></span> utility can also do bulk
+reassigns, see <span class="command"><strong>man sg_reassign</strong></span> for more information.
+</p><p>
+The <span class="command"><strong>dd</strong></span> command could be used to read the contents of
+the "new" block:
+</p><pre class="programlisting">
+# dd if=/dev/sdb iflag=direct skip=1193046 of=blk.img bs=512 count=1
+</pre><p>
+</p><p>
+and a hex editor
+<sup>[<a name="id2551874" href="#ftn.id2551874" class="footnote">11</a>]</sup>
+used to view and potentially change the
+<code class="filename">blk.img</code> file. An altered <code class="filename">blk.img</code>
+file (or <code class="filename">/dev/zero</code>) could be written back with:
+</p><pre class="programlisting">
+# dd if=blk.img of=/dev/sdb seek=1193046 oflag=direct bs=512 count=1
+</pre><p>
+</p><p>
+More work may be needed at the file system level, especially if the
+reassigned block held critical file system information such as
+a superblock or a directory.
+</p><p>
+Even if a full backup of the disk is available, or the disk has been
+"ejected" from a RAID, it may still be worthwhile to reassign the bad
+block(s) that caused the problem (or simply format the disk (see
+<span class="command"><strong>sg_format</strong></span> in the sg3_utils package)) and re-use the
+disk later (not unlike the way a replacement disk from a manufacturer
+might be used).
+</p><p>
+$Id: badblockhowto.xml 2873 2009-08-11 21:46:20Z dipohl $
+</p></div></div></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id2506421" href="#id2506421" class="para">1</a>] </sup>
+Self-Monitoring, Analysis and Reporting Technology -&gt; SMART
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2506498" href="#id2506498" class="para">2</a>] </sup>
+Starting with GNU coreutils release 5.3.0, the <span class="command"><strong>dd</strong></span>
+command in Linux includes the options 'iflag=direct' and 'oflag=direct'.
+Using these with the <span class="command"><strong>dd</strong></span> commands should be helpful,
+because adding these flags should avoid any interaction
+with the block buffering IO layer in Linux and permit direct reads/writes
+from the raw device.  Use <span class="command"><strong>dd --help</strong></span> to see if your
+version of dd supports these options. If not, the latest code for dd
+can be found at <a class="ulink" href="http://alpha.gnu.org/gnu/coreutils" target="_top">
+<code class="literal">alpha.gnu.org/gnu/coreutils</code></a>.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2550815" href="#id2550815" class="para">3</a>] </sup>
+Do not use <span class="command"><strong>tar -c -f /dev/null</strong></span> or
+<span class="command"><strong>tar -cO /mydir &gt;/dev/null</strong></span>. GNU tar does not
+actually read the files if <code class="filename">/dev/null</code> is used as
+archive path or as standard output, see <span class="command"><strong>info tar</strong></span>.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2550862" href="#id2550862" class="para">4</a>] </sup>
+Important: set blocksize range is arbitrary, but do not only test a single
+block, as bad blocks are often social. Not too large as this test probably
+has not 0% risk.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2550876" href="#id2550876" class="para">5</a>] </sup>
+The rather awkward `expr 484335 + 100` (note the back quotes) can be replaced
+with $((484335+100)) if the bash shell is being used. Similarly the last
+argument can become $((484335-100)) .
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2550980" href="#id2550980" class="para">6</a>] </sup>
+<span class="command"><strong>testdisk</strong></span> scans the media for the beginning of file
+systems that it recognizes. It can be tricked by data that looks
+like the beginning of a file system or an old file system from a
+previous partitioning of the media (disk). So care should be taken.
+Note that file systems should not overlap apart from the fact that
+extended partitions lie wholly within a extended partition table
+allocation. Also if the root partition of a Linux/Unix installation
+can be found then the <code class="filename">/etc/fstab</code> file is a useful
+resource for finding the partition numbers of other partitions.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2551099" href="#id2551099" class="para">7</a>] </sup>
+Thanks to Manfred Schwarb for the information about storing partition
+table(s) beforehand.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2551516" href="#id2551516" class="para">8</a>] </sup>
+Detecting and fixing an error with ECC "on the fly" and not going the further
+step and reassigning the block in question may explain why some disks have
+large numbers in their read error counter log. Various worried users have
+reported large numbers in the "errors corrected without substantial delay"
+counter field which is in the "Errors corrected by ECC fast" column in
+the <span class="command"><strong>smartctl -l error</strong></span> output.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2551535" href="#id2551535" class="para">9</a>] </sup>
+Often disks inside a hardware RAID have the ARRE and AWRE bits
+cleared (disabled) so the RAID controller can do things manually or flag
+the disk for replacement.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2551756" href="#id2551756" class="para">10</a>] </sup>
+In this case the corruption was manufactured by using the WRITE LONG
+SCSI command. See <span class="command"><strong>sg_write_long</strong></span> in sg3_utils.
+</p></div><div class="footnote"><p><sup>[<a name="ftn.id2551874" href="#id2551874" class="para">11</a>] </sup>
+Most window managers have a handy calculator that will do hex to
+decimal conversions. More work may be needed at the file system level,
+</p></div></div></div></body></html>
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..fd7e7c4
--- /dev/null
@@ -0,0 +1,773 @@
+smartmontools (6.2+svn3841-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/control: Switch to automake1.11. (Closes: #724436)
+
+ -- Eric Dorland <eric@debian.org>  Sun, 16 Feb 2014 16:27:11 -0500
+
+smartmontools (6.2+svn3841-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS on GNU/kFreeBSD. (Closes: #736660)
+
+ -- Robert Millan <rmh@debian.org>  Thu, 06 Feb 2014 13:48:48 +0100
+
+smartmontools (6.2+svn3841-1) unstable; urgency=low
+
+  * [3d17a85] Imported Upstream version 6.2+svn3841
+  * [8251afb] Fix  FTBFS[kfreebsd]
+    Thanks to Christoph Egger (Closes: #717567)
+  * [e57fafb] Refreshed patches
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Thu, 05 Sep 2013 14:53:36 +0200
+
+smartmontools (6.1+svn3812-1) unstable; urgency=low
+
+  * [ee38a43] Imported Upstream version 6.1+svn3812 (Closes: #691646)
+    - Support for WD MyBook Essential 0x1058:0x0910 (Closes: #633724)
+    - Added  USB bridge to known IDs (Closes: #643928)
+    - Added support for Seagate Expansion Desk external (usb) disks
+      (Closes: #621411)
+  * [1855d63] Refreshed patches and removed patches applied upstream
+  * [d3fc9d1] Remove quilt from depends
+  * [841c1a8] CHANGELOG file has been renamed, install Changelog
+  * [3502e16] Updated VCS control fields
+  * [8f14e44] debian/rules: Provide build-arch and build-indep
+  * [0f1c16c] Harden smartmontools binaries
+  * [555346e] Bump to 3.9.4 standards version
+  * [5ae3fa9] Use /var/lib/smartmontools/drivedb for drivedb.h updates
+    (Closes: #706909)
+  * [c16ffdc] Create  /var/lib/smartmontools/drivedb dir
+  * [79a3dc2] Trigger the removal of /etc/init.d/smartd when upgrading
+    (Closes: #684617, #704081)
+  * [a0a5725] Also remove /etc/init.d/smartd in preinst script
+  * [a26a490] Added man page for update-smart-drivedb.
+    Thanks to Hannes von Haugwitz (Closes: #708433)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sun, 02 Jun 2013 11:14:02 +0200
+
+smartmontools (5.42+svn3561-3) unstable; urgency=high
+
+  * [f10872d] Really fix FTBFS on kfreebsd.
+    Thanks to Petr Salinger (Closes: #677393)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Mon, 16 Jul 2012 15:21:56 +0200
+
+smartmontools (5.42+svn3561-2) unstable; urgency=high
+
+  * [743e0f4] Fixed FTBFS in kfreebsd.
+    Thanks to Petr Salinger (Closes: #677393)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Mon, 16 Jul 2012 12:06:15 +0200
+
+smartmontools (5.42+svn3561-1) unstable; urgency=low
+
+  * [f4e463d] Imported Upstream version 5.42+svn3561
+  * [23f7a2f] Refreshed patches
+  * [16216c8] Fixed FTBFS on kfreebsd.
+    Thanks to Petr Salinger (Closes: #676142)
+  * [6652700] Fixed regression introduced in 10mail script (Closes: #649515)
+  * [fd647e5] Remove /etc/init.d/smartd (Closes: #677095)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Wed, 20 Jun 2012 16:36:24 +0200
+
+smartmontools (5.42+svn3539-1) unstable; urgency=low
+
+  * [e165493] Imported Upstream version 5.42+svn3539
+    (Closes: #668391, #608953)
+  * [9fcd449] Refreshed patches
+  * [65c801f] Do not install upstream init (Closes: #631075)
+  * [9a19418] Fixed check for /usr/bin/mail.
+    Thanks to Martin von Gagern (Closes: #649515)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sat, 12 May 2012 13:02:49 +0200
+
+smartmontools (5.41+svn3365-1) unstable; urgency=low
+
+  * [a7e8ffe] Imported Upstream version 5.41+svn3365
+  * [471d14a] Refreshed patches, removed install.diff applied upstream
+  * [fae0ec9] Added a missing include for hurd-i386.
+    Thanks to Pino Toscano (Closes: #619208)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sun, 19 Jun 2011 17:28:10 +0200
+
+smartmontools (5.40+svn3296-1) unstable; urgency=low
+
+  * [cfbba5b] Imported Upstream version 5.40+svn3296
+    - Intel X18-M/X25-M/X25-V G2 SSDs: Add firmware bug warning
+      (Closes: #581996)
+    - handles missing attributes and prints attributes of SandForce based SSDs
+      correctly (Closes: #601258)
+    - Added a note about smartctl is unable to print a warning if autosave is
+      disabled (Closes: 570892)
+    - Print help message if no option is specified (Closes: 435579)
+    - Only some of the controller specific parts of the code may still use the
+      old ioctl (LP: #658469)
+    - New drive database entry for F4EG (LP: #684809)
+  * [b5b85ba] Refreshed patches
+  * [2b7f0f1] Update to Standards-Version 3.9.1, no changes needed
+  * [3ed7206] debian/rules: remove make -C examplescripts
+  * [f8250f3] Pass exampledir in configure
+  * [0711e68] Install examples files and update-smart-drivedb (Closes: #607689)
+    (Closes: #593502)
+  * [f36e375] Do not install CHANGELOG COPYING INSTALL and initd files
+  * [a76819a] Re-enabled capability-dropping on armel (Closes: #552044)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sun, 20 Mar 2011 19:09:39 +0100
+
+smartmontools (5.39.1+svn3124-2) unstable; urgency=low
+
+  [ Florian Weimer ]
+  * [88b6d44] 3w-sas support (from upstream changeset r3128) (Closes:
+    #604016)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sun, 26 Dec 2010 12:26:16 +0100
+
+smartmontools (5.39.1+svn3124-1) unstable; urgency=low
+
+  * [1e46e09] Set state and attribute file directory to
+    /var/lib/smartmontools/ (Closes: #582158)
+  * [e20147c] Don't warn about being disabled unless verbose (Closes: #583386)
+  * [3390c07] Fixed example path in man pages (Closes: #588134)
+  * [e9583e0] Imported Upstream version 5.39.1+svn3124
+  * [789e123] Refreshed patches
+  * [cbecf14] Bump to Standards-Version 3.9.0, no changes needed
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Tue, 13 Jul 2010 13:16:54 +0200
+
+smartmontools (5.39.1+svn3077-1) unstable; urgency=low
+
+  * [ffe62ea] Removed powersaved from Suggests (Closes: #570956)
+  * [7f0798e] Imported Upstream version 5.39.1+svn3077 (Closes: #575435)
+  * [b1b3452] Enabled drivedb, savestates, and attributelog
+  * [9f28fd4] Switch to dpkg-source 3.0 (quilt) format
+  * [52be6ce] Updated to Standards-Version 3.8.4, no changes needed
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Fri, 26 Mar 2010 22:01:58 +0100
+
+smartmontools (5.39.1+svn3060-1) unstable; urgency=low
+
+  * [a23d511] Imported Upstream version 5.39.1+svn3060
+    - A regression caused by capabilities was fixed. (Closes: #564876)
+  * [89c9890] Removed patches merged in upstream
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Thu, 04 Feb 2010 08:16:37 +0100
+
+smartmontools (5.39-3) unstable; urgency=low
+
+  * [3d32778] Fixed quietmode option (Closes: #545784)
+  * [e66f4fd] Allow smartd 'DEVICESCAN -d sat' (Closes: #546566)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Fri, 22 Jan 2010 20:02:53 +0100
+
+smartmontools (5.39-2) unstable; urgency=low
+
+  * [f7f4c51] Fixed crash on kfreebsd. (Closes: #561113) - thanks to
+    Petr Salinger and Axel Beckert
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sat, 26 Dec 2009 11:11:58 +0100
+
+smartmontools (5.39-1) unstable; urgency=low
+
+  * [e9e8c2b] Imported Upstream version 5.39
+  * [b00706e] Adeed libusb2-dev for kfreebsd in Build-Depends.
+    (Closes: #560241)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Mon, 14 Dec 2009 12:24:35 +0100
+
+smartmontools (5.38+svn2993-1) unstable; urgency=low
+
+  * [bed9426] Imported Upstream version 5.38+svn2993
+  * [4a5d1d1] Fixed status action in init script (LP: #491324)
+  * [9dd2a1d] Add selinux for avr32 in build-depends
+  * [26ec4bc] Refreshed patches
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Wed, 09 Dec 2009 17:45:19 +0100
+
+smartmontools (5.38+svn2956-1) unstable; urgency=low
+
+  * [283f281] Updated my email address and removed DM-Upload-Allowed
+    control field
+  * [eb07ddf] Imported Upstream version 5.38+svn2956
+    + Added a note in smartctl (8) about 2^16 wrap of LifeTime value in
+      Self-test log. (Closes: #535298)
+  * [ed382e8] Refreshed patches
+  * [f4ff277] Updated lowcap patch, make capabilities optional and
+    clarify that mail notification could not work when used. (Closes:
+    #544940)
+  * [a7e19a3] Do not Build-depends in libcap-ng-dev in armel, libcap-ng
+    is broken in this arch. (Closes: #548438)
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Sun, 11 Oct 2009 09:42:47 +0200
+
+smartmontools (5.38+svn2920-2) unstable; urgency=low
+
+  * [a117ede] Enable Selinux only in linux platforms
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it>  Tue, 22 Sep 2009 13:22:39 +0200
+
+smartmontools (5.38+svn2920-1) unstable; urgency=low
+
+  * [a94eb83] run.d/10mail: Do not exit silently if /usr/bin/mail is
+    missing (Closes: #541192) - thanks to Francesco Potorti`
+  * [0197215] Enabled SELinux support
+  * [091eb3a] debian/smartmontools-bug: Fixed a spelling error (Closes:
+    #547197) - thanks to Sandro Tosi
+  * [5496574] Imported Upstream version 5.38+svn2920
+  * [5d593fa] Removed patches merged in upstream: 64_r2898.patch,
+    65_freebsd.patch
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it>  Sun, 20 Sep 2009 14:51:52 +0200
+
+smartmontools (5.38+svn2879-4) unstable; urgency=low
+
+  * [af11f9b] debian/patches/65_freebsd.patch: The os_freebsd.cpp uses
+    reallocf(), which is specific for *BSD libc. Added an implementation
+    directly into os_freebsd.cpp - thanks to Petr Salinger
+  * [b2a680f] debian/watch: Removed uupdate
+  * [4fe54cf] Do not Build-depends on libcap-ng-dev on avr32
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it>  Mon, 07 Sep 2009 20:55:53 +0200
+
+smartmontools (5.38+svn2879-3) unstable; urgency=low
+
+  * [1b75411] Freebsd patch was not entirely merged in upstream. Applied
+    remaining changes and try to fix FTBFS on GNU/kFreeBSD (Closes: #537856)
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it>  Mon, 07 Sep 2009 15:33:34 +0200
+
+smartmontools (5.38+svn2879-2) unstable; urgency=low
+
+  * [51c0fd9] Build-depends on libcap-ng-dev only on linux. - thanks to
+    Petr Salinger
+  * [94843b0] Fixed Vcs-Browser field
+  * [c2d3bf4] Do not Build-depends on libcap-ng-dev on sparc
+  * [27a32a3] Dereference '/dev/disk/by-*/*' symlink before device type
+    autodetection. (Closes: #544823)
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it>  Mon, 07 Sep 2009 14:24:17 +0200
+
+smartmontools (5.38+svn2879-1) unstable; urgency=low
+
+  [ Guido Günther ]
+  * [d5c8d71] suggest graphical helpers (Closes: #524752)
+  * [b11b96e] support status action in init script (Closes: #525196) -
+    thanks to Peter Eisentraut
+  * [b092558] fix Vcs-Browser URL
+
+  [ Giuseppe Iuculano ]
+  * [101b745] New maintainers, thanks to Guido Günther for the prior
+    work on smartmontools. (Closes: #543861)
+  * [35bece3] debian/rules: Added a get-orig-source target to retrieve a
+    svn snapshot
+  * [4482c05] Bump to debhelper 7 compatibility levels
+  * [2127e19] Imported Upstream version 5.38+svn2879
+    - Fixed FTBFS (Closes: #539430)
+    - GNU/kFreeBSD patches merged in upstream (Closes: #537856)
+    - More drives recognized: Fujitsu MHW2 BJ series, WD Caviar Black family,
+      Western Digital AV-GP series, Transcend Solid-State Drive and Transcend
+      Solid-State Drive V series, Seagate Momentus 5400.5 series.
+  * [6052436] Refreshed patches
+  * [91ad575] move badblockhowto.html in debian/ (Closes: #538631)
+  * [bbdf8c9] debian/control: Depend on lsb >= 3.2-14, which has the
+    status_of_proc() function.
+  * [9afe5af] Removed stop links from rc0 and rc6 (Closes: #494951) -
+    thanks to James Westby
+  * [6dcd8ec] Updated to standards version 3.8.3 (No changes needed)
+  * [608687b] debian/rules: Use dh_prep instead of dh_clean -k
+  * [a52f90d] debian/rules: Do not ignore make clean errors
+  * [31e40f7] debian/rules: use dh_install to install files
+  * [9ca7a79] debian/control: Added Florian Maier in Uploaders, fixed
+    VCS field, added DM-Upload-Allowed field
+  * [d494f00] Updated debian/badblockhowto.html (Closes: #540359) -
+    thanks to Francesco Potorti`
+  * [3db595a] Use the `-n standby' option by default in smartd.conf
+    (Closes: #531325)
+  * [52b4501] Added /etc/smartmontools/run.d/10powersave-notify to
+    enable desktop notification over powersave-notify and added
+    powersaved in Recommends
+  * [0dcf301] debian/patches/62_lowcap.patch: Drop all unnecessary
+    capabilities
+  * [5afdd10] Added the removable option by default. This indicates to
+    smartd that it should continue if the device does not appear to be
+    present when smartd is started. (Closes: #406130)
+
+ -- Giuseppe Iuculano <giuseppe@iuculano.it>  Tue, 01 Sep 2009 12:59:13 +0200
+
+smartmontools (5.38-3) unstable; urgency=low
+
+  * [3ea288e] add Homepage, Vcs-{Git,Browser} fields (Closes: #500530)
+  * [76a9163] check if daemon is running befor starting it (Closes: #516430)
+  * [8a3e8a3] fix maintainer name
+
+ -- Guido Günther <agx@sigxcpu.org>  Sat, 21 Feb 2009 17:19:19 +0100
+
+smartmontools (5.38-2) unstable; urgency=low
+
+  * [fd9c675] add lintian override Full stop at end of synopsis is OK -
+    it doesn't end a sentence but is part of an abbreviation.
+  * [fab76b4] update copyright
+  * [1731d9e] bump standards version
+  * [d0f2f2e] add README.source
+  * [2d3e4b9] new patch 61_cciss-doc.patch update ccis examples/docs
+    (Closes: #488371) - thanks to Matt Taggart
+
+ -- Guido Guenther <agx@sigxcpu.org>  Thu, 24 Jul 2008 12:15:34 -0400
+
+smartmontools (5.38-1) unstable; urgency=low
+
+  * new upstream version
+  * drop 51_add-kfreebsd-support.diff, applied upstream
+  * add watch file from dehs.debian.org
+
+ -- Guido Guenther <agx@sigxcpu.org>  Tue, 11 Mar 2008 20:54:41 +0100
+
+smartmontools (5.38~rc0-2) unstable; urgency=low
+
+  [ Petter Reinholdtsen ]
+  * smartmontools: Problem with LSB header in init.d script (Closes:
+    Bug#469377)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Wed, 05 Mar 2008 08:55:46 +0100
+
+smartmontools (5.38~rc0-1) unstable; urgency=low
+
+  * New Upstream Version release candidate
+      * detects Hitachi drives with newer kernels (Closes: #314629)
+      * updated drives table (Closes: #381251)
+  * correct logfile location (Closes: #464193)
+  * drop 01_sat-error-handling.diff - originally pulld from upstream
+  * drop 05_wait-for-daemon-startup.diff - applied upstream
+  * refresh 51_add-kfreebsd-support.diff
+  * bump standards version
+  * ship badblockshowto.html (Closes: #454565)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Tue, 26 Feb 2008 11:59:50 +0100
+
+smartmontools (5.38~cvs20071118-2) experimental; urgency=low
+
+  * add LSB header (Closes: #458391)
+  * move debian specific patches to >= 50
+  * pull 01_sat-error-handling.diff from upstream CVS to improve SAT
+    handling of aborted ATA commands - thanks to Doug Gilbert!
+
+ -- Guido Guenther <agx@sigxcpu.org>  Sun, 09 Dec 2007 14:51:57 +0100
+
+smartmontools (5.38~cvs20071118-1) experimental; urgency=low
+
+  * new upstream CVS snapshot 20071118
+  * update patches:
+     * rework 01_add-kfreebsd-support.diff to apply again
+     * rework 05_wait-for-daemon-startup.diff to apply again
+     * rediff 10_remove-redhatism.diff
+     * drop 20_fix-scsi-disk-detection.diff - merged upstream
+     * drop 30_gcc4.3.diff - fixed upstream
+     * drop 40_fix-sata-hsm-violation.diff - pulled from upstream
+
+ -- Guido Guenther <agx@sigxcpu.org>  Mon, 19 Nov 2007 13:54:42 +0100
+
+smartmontools (5.37-6) unstable; urgency=low
+
+  * don't redefine CISS_MAX_LUN (Closes: #441598)
+  * Patch pulled from upstream to fix HSM violation errors on SATA systems
+    (Closes: #448781) - thanks to Sven Hartge for sorting this out
+
+ -- Guido Guenther <agx@sigxcpu.org>  Thu, 01 Nov 2007 13:29:11 +0100
+
+smartmontools (5.37-5) unstable; urgency=low
+
+  * NEWS.Debian: SCSI disks need -W for temperature logging, thanks to GSR for
+    feedback and testing. (Closes: #411932)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Thu, 05 Apr 2007 10:15:52 +0200
+
+smartmontools (5.37-4) unstable; urgency=low
+
+  * 05_wait-for-daemon-startup.diff: fix startup race condition (Closes: #246032)
+  * document good testing practice (Closes: #412543)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Sat, 31 Mar 2007 16:01:27 +0200
+
+smartmontools (5.37-3) unstable; urgency=low
+
+  * rebuild with pbuilder (Closes: #415950)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Fri, 23 Mar 2007 13:51:43 +0100
+
+smartmontools (5.37-2) unstable; urgency=low
+
+  * switch from dpatch to quilt
+  * 20_fix-scsi-disk-detection.diff: patch from Douglas Gilbert to fix scsi
+    disk detection (Closes: #411932)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Mon, 19 Mar 2007 23:04:15 +0100
+
+smartmontools (5.37-1) unstable; urgency=low
+
+  * New Upstream Version
+  * adjusted 04_remove-Id-from-smartd.conf.dpatch
+
+ -- Guido Guenther <agx@sigxcpu.org>  Thu, 21 Dec 2006 13:12:26 +0100
+
+smartmontools (5.37~cvs20061111-1) experimental; urgency=low
+
+  * The No Narro ihr Mäschkerle release
+  * New upstream cvs release candidate (Closes: #398055, #398054, #391999)
+  * dropped 60_cciss.dpatch, merged upstream
+  * adjusted 04_remove-Id-from-smartd.conf.dpatch
+
+ -- Guido Guenther <agx@sigxcpu.org>  Sat, 11 Nov 2006 19:19:27 +0100
+
+smartmontools (5.37~cvs20061002-1) experimental; urgency=low
+
+  * New upstream CVS release candidate
+  * adjusted patches: 60_cciss, 04_remove-Id-from-smartd.conf
+
+ -- Guido Guenther <agx@sigxcpu.org>  Mon,  2 Oct 2006 17:45:51 +0200
+
+smartmontools (5.36-8) unstable; urgency=low
+
+  * 60_cciss (smartd.c): make sure we pass the correct mode and device
+    parameters to the lower level functions (the code assumed "SCSI" in those
+    places although it was "CCISS"). Patch by Frédéric BOITEUX
+    <fboiteux@calistel.com>, thanks a lot! (Closes: #36802)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Fri, 29 Sep 2006 15:22:19 +0200
+
+smartmontools (5.36-7) unstable; urgency=low
+
+  * README.Debian: actually mention the term "smartd-runner" in README.Debian
+    instead of only explaining what it does
+  * /etc/init.d/smartmontools: use LSB logging, patch by David Härdeman
+    <david@hardeman.nu> (Closes: #385903)
+  * Bump standards version to 3.7.2 (no other changes necessary) 
+
+ -- Guido Guenther <agx@sigxcpu.org>  Mon, 25 Sep 2006 11:41:21 +0200
+
+smartmontools (5.36-6) unstable; urgency=low
+
+  * Explicitly discourage using enable_smart with SATA disks in README.Debian
+    (Closes: #365027) - many thanks to Francois Marier and Doug Gilbert for
+    their feedback and help.
+  * Document what smartd-runner really does (Closes: #352244)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Wed,  3 May 2006 21:44:01 +0200
+
+smartmontools (5.36-5) unstable; urgency=low
+
+  * apply current version of the cciss patch, updated to be less intrusive
+    by Douglas Gilbert
+
+ -- Guido Guenther <agx@sigxcpu.org>  Wed, 26 Apr 2006 23:10:07 +0200
+
+smartmontools (5.36-4) unstable; urgency=low
+
+  * really apply the cciss patch, thanks again to Frederic Boiteux
+  * adjust the cciss patch to include <linux/cciss.h> instead of
+    "cciss.h", we don't ship a local copy.
+
+ -- Guido Guenther <agx@sigxcpu.org>  Tue, 25 Apr 2006 13:54:17 +0200
+
+smartmontools (5.36-3) unstable; urgency=low
+
+  * depend on debianutils (>= 2.2) for run-parts --lsbsysinit, thanks to
+    Frederic Boiteux (Closes: #364713)
+
+ -- Guido Guenther <agx@sigxcpu.org>  Tue, 25 Apr 2006 10:59:37 +0200
+
+smartmontools (5.36-2) unstable; urgency=low
+
+  * Build depend on automake/autoconf since we run autogen.sh 
+    from debian/rules
+
+ -- Guido Guenther <agx@sigxcpu.org>  Mon, 24 Apr 2006 16:02:42 +0200
+
+smartmontools (5.36-1) unstable; urgency=low
+
+  * new upstream version (Closes: #363087)
+  * use dpatch
+  * bump standards version
+  * update cciss patch
+
+ -- Guido Guenther <agx@sigxcpu.org>  Mon, 24 Apr 2006 14:39:19 +0200
+
+smartmontools (5.33+5.34cvs20050802-6) experimental; urgency=low
+
+  * update cciss patch to also support smartd not only smartctl
+
+ -- Guido Guenther <agx@debian.org>  Thu, 13 Apr 2006 09:34:39 +0200
+
+smartmontools (5.33+5.34cvs20050802-5) experimental; urgency=low
+
+  * add (experimental) cciss patch by Praveen Chidambaram
+    <bunchofmails@gmail.com>, with slight modfifications to apply and work
+    with current CVS
+  * Build depend on libcam-dev for kfreebsd-amd64 too (Closes: #361478)
+  * Remove $Id$ from smartd.conf (Closes: #324703)
+
+ -- Guido Guenther <agx@debian.org>  Mon, 10 Apr 2006 17:33:18 +0200
+
+smartmontools (5.33+5.34cvs20050802-4) unstable; urgency=low
+
+  * avoid usage of cat in 10mail (Closes: #327338)
+  * add patch by Aurelin Jano to build on kfreebsd (Closes: #327642) 
+
+ -- Guido Guenther <agx@debian.org>  Tue, 24 Jan 2006 09:56:28 +0100
+
+smartmontools (5.33+5.34cvs20050802-3) unstable; urgency=low
+
+  * add note about 3ware raid controlers to NEWS.Debian (Closes: #322265)
+
+ -- Guido Guenther <agx@debian.org>  Thu, 11 Aug 2005 11:04:56 +0200
+
+smartmontools (5.33+5.34cvs20050802-2) unstable; urgency=low
+
+  * rules: make ./configure executable (Closes: #321060)
+  * smartd.conf: add smartd-runner to the default DEVICESCAN directive
+  * README.Debian: mention smartd-runner
+  * control: remove debianutils, it's an essential package
+
+ -- Guido Guenther <agx@debian.org>  Wed,  3 Aug 2005 11:32:53 +0200
+
+smartmontools (5.33+5.34cvs20050802-1) unstable; urgency=low
+
+  * New CVS snapshot as of 2005-08-02 (Closes: #269051)
+
+  * added smartd-runner which runs scripts in /etc/smartmontools/run.d
+  * added /etc/smartmontools/run.d/10mail to emulate smartd's -m option
+  * add a comment on howto use this to /etc/smartd.conf
+  * Many thanks for this go to Brian Sutherland <jinty@web.de>
+
+ -- Guido Guenther <agx@debian.org>  Tue,  2 Aug 2005 20:58:47 +0200
+
+smartmontools (5.33-1) experimental; urgency=low
+
+  * new upstream version
+  * upload to experimental since we want 5.32 in sarge for now
+
+ -- Guido Guenther <agx@debian.org>  Sat, 20 Nov 2004 19:52:39 +0100
+
+smartmontools (5.32-2) unstable; urgency=medium
+
+  * urgency medium since the sarge version is unusable on arm
+  * use __attribute__((packed)) instead of #pragma(packed) since the later
+    causes alignment problems on arm - based on a patch by armcc@lycos.com,
+    many thanks! (Closes: #278459)
+  * simplify /usr/share/bug/smartmontools a bit (Closes: #262055)
+
+ -- Guido Guenther <agx@debian.org>  Thu, 28 Oct 2004 09:20:57 +0200
+
+smartmontools (5.32-1) unstable; urgency=low
+
+  * new upstream version
+
+ -- Guido Guenther <agx@debian.org>  Mon, 19 Jul 2004 10:57:53 +0200
+
+smartmontools (5.30-6) unstable; urgency=low
+
+  * be more verbose in /etc/init.d/smartmontools iff smartd has been disabled
+    via /etc/default/smartmontools (Closes: #246615)
+  * explain removal of cron selftests in NEWS.Debian (Closes: #247622)
+
+ -- Guido Guenther <agx@debian.org>  Thu,  6 May 2004 09:05:40 +0200
+
+smartmontools (5.30-5) unstable; urgency=low
+
+  * rm selftests from CVS, so they don't get picked up by cvs-buildpackage
+    (Closes: #242580), sigh
+  * thanks again to Jean-Luc Coulon and Bruce Allen for resolving #208964
+
+ -- Guido Guenther <agx@debian.org>  Wed,  7 Apr 2004 19:07:58 +0200
+
+smartmontools (5.30-4) unstable; urgency=low
+
+  * improve restart in init.d script so that smartd can shut down
+    properly (Closes: #242344)
+  * remove cron selftests at all, use smartd's -s option instead
+
+ -- Guido Guenther <agx@debian.org>  Tue,  6 Apr 2004 12:18:52 +0200
+
+smartmontools (5.30-3) unstable; urgency=low
+
+  * deprecated cron selftests, this is now better handled by smartd's "-s"
+    option
+  * check for existence of smartmontools-selftests in cron.d snippet
+  * in accordance with upstream (who adopted our naming scheme) use smartd's
+    compiled in default values in /etc/default/smartmontools
+
+ -- Guido Guenther <agx@debian.org>  Sat, 27 Mar 2004 07:11:12 +0100
+
+smartmontools (5.30-2) unstable; urgency=low
+
+  * clarify usage of enable_smart in (Closes: #239737)
+  * add reload to /etc/init.d/smartmontools
+
+ -- Guido Guenther <agx@debian.org>  Thu, 25 Mar 2004 14:43:33 +0100
+
+smartmontools (5.30-1) unstable; urgency=low
+
+  * new upstream version (Closes: #238790)
+  * logging severity fixed upstream (Closes: #234519)
+
+ -- Guido Guenther <agx@debian.org>  Tue, 23 Mar 2004 00:40:25 +0100
+
+smartmontools (5.26-5) unstable; urgency=low
+
+  * install /u/s/bug/smartmontools as reportbug helper
+  * use install instead of cp/chmod
+  * remove no longer needed debian/dirs
+
+ -- Guido Guenther <agx@debian.org>  Wed, 11 Feb 2004 19:08:49 +0100
+
+smartmontools (5.26-4) unstable; urgency=low
+
+  * remove sections not relevant on debian systems from smartd.8.in manpage
+  * include /etc/smartd.conf again, thanks Wolfram Quester.
+  * change smartd.conf to only use DEVICESCAN 
+
+ -- Guido Guenther <agx@debian.org>  Tue,  3 Feb 2004 15:25:32 +0100
+
+smartmontools (5.26-3) unstable; urgency=low
+
+  * The "where did the chmod go" release
+  * make sure selftests is executable (Closes: #223627)
+
+ -- Guido Guenther <agx@debian.org>  Thu, 11 Dec 2003 12:33:56 +0100
+
+smartmontools (5.26-2) unstable; urgency=low
+
+  * actually include /usr/share/smartmontools/selftests again
+
+ -- Guido Guenther <agx@debian.org>  Tue,  9 Dec 2003 12:45:22 +0100
+
+smartmontools (5.26-1) unstable; urgency=low
+
+  * new upstream version
+
+ -- Guido Guenther <agx@debian.org>  Fri,  5 Dec 2003 22:12:33 +0100
+
+smartmontools (5.1.18-3) unstable; urgency=low
+
+  * make sure /usr/share/smartmontools/selftests is executable
+
+ -- Guido Guenther <agx@debian.org>  Wed, 12 Nov 2003 01:08:20 +0100
+
+smartmontools (5.1.18-2) unstable; urgency=low
+
+  * Conflict: ucsc-smartsuite (Closes: #218573)
+  * introduce run_cron_selftests in /etc/defaults/smartmontools which
+    contains a list of devices to run regular selftests on via cron
+
+ -- Guido Guenther <agx@debian.org>  Mon,  3 Nov 2003 22:36:34 +0100
+
+smartmontools (5.1.18-1) unstable; urgency=low
+
+  * new upstream version
+  * bump Standards-Version to 3.6.1
+
+ -- Guido Guenther <agx@debian.org>  Thu, 28 Aug 2003 21:54:06 +0200
+
+smartmontools (5.1.16-1) unstable; urgency=low
+
+  * new upstream version
+    - log normal exit at LOG_INFO, not LOG_CRIT (Closes: #201173)
+    - allows to acces disks behind 3ware RAID controllers, maybe 
+      closes: #188515, the submitter never specified any details.
+  * bump Standards-Version to 3.6.0
+  * add NEWS.Debian file
+
+ -- Guido Guenther <agx@debian.org>  Thu,  7 Aug 2003 13:54:26 +0200
+
+smartmontools (5.1.14-1) unstable; urgency=low
+
+  * new upstream version
+  * fix the regexp in smartmontools-cron matching the first disk only
+  * bump Standards-Version to 3.5.10
+
+ -- Guido Guenther <agx@debian.org>  Sun, 22 Jun 2003 14:07:11 +0200
+
+smartmontools (5.1.11-1) unstable; urgency=low
+
+  * new upstream version (Closes: #191831)
+  * rework debian/rules since we can now pass most of the
+    needed options to the Makefile
+
+ -- Guido Guenther <agx@debian.org>  Wed,  7 May 2003 21:43:53 +0200
+
+smartmontools (5.1.10-1) unstable; urgency=low
+
+  * new upstream version (Closes: #186213)
+  * add ${misc:Depends} to control file
+  * bump debhelper Build-Depends to >=4
+  * bump Standards-Version to 3.5.9
+  * smartd now writes a pidfile, use it in the init script
+  * add smartd_opts to /etc/defaults/smartmontools 
+  * add cron.daily example
+
+ -- Guido Guenther <agx@debian.org>  Mon, 21 Apr 2003 19:32:46 +0200
+
+smartmontools (5.1.9-3) unstable; urgency=low
+
+  * init.d script prints more sensible error messages (Closes: #187697)
+
+ -- Guido Guenther <agx@debian.org>  Sat,  5 Apr 2003 19:17:43 +0200
+
+smartmontools (5.1.9-2) unstable; urgency=low
+
+  * /etc/init.d/smartmontools cleanup:
+    - Don't fail when the package was removed but not purged
+      (Closes: #186091).
+    - sleep 1 second on restart
+    - fix wrong scriptname in usage output
+  * install smartd.conf to /etc
+  * adjust README.Debian
+  * don't install CHANGELOG, dh_installchangelogs handles this for us
+
+ -- Guido Guenther <agx@debian.org>  Mon, 24 Mar 2003 19:24:53 +0100
+
+smartmontools (5.1.9-1) unstable; urgency=low
+
+  * new upstream version (Closes: #178151)
+  * Recommends: mailx | mailutils (Closes: #184890)
+  * add '-e' to shebang line of init script
+  * use debian/compat not DH_COMPAT 
+
+ -- Guido Guenther <agx@debian.org>  Sat, 15 Mar 2003 12:40:04 +0100
+
+smartmontools (5.1.4-2) unstable; urgency=low
+
+  * remove 'function' bashism from initscript (Closes: #178411),
+    Thanks Martin Waitz.
+
+ -- Guido Guenther <agx@debian.org>  Sun, 26 Jan 2003 00:52:49 +0100
+
+smartmontools (5.1.4-1) unstable; urgency=low
+
+  * new upstream version
+  * turn on S.M.A.R.T. for devices listed in enable_smart
+  * honor DEB_BUILD_OPTIONS 
+  * bump standards version to 3.5.8
+
+ -- Guido Guenther <agx@debian.org>  Sat, 25 Jan 2003 19:40:14 +0100
+
+smartmontools (5.1.1-3) unstable; urgency=low
+
+  * conflict with smartsuite (Closes: #178010)
+  * remove superflous whitespaces in description
+  * remove usr/bin from debian/dirs
+
+ -- Guido Guenther <agx@debian.org>  Fri, 24 Jan 2003 00:51:26 +0100
+
+smartmontools (5.1.1-2) unstable; urgency=low
+
+  * only start smartd if start_smartd=yes in /etc/default/smartmontools.
+  * initial upload (Closes: #174828).
+
+ -- Guido Guenther <agx@debian.org>  Fri, 17 Jan 2003 23:04:50 +0000
+
+smartmontools (5.1.1-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Guido Guenther <agx@debian.org>  Tue, 14 Jan 2003 12:58:00 +0000
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..280ea89
--- /dev/null
@@ -0,0 +1,23 @@
+Source: smartmontools
+Section: utils
+Priority: optional
+Maintainer: Giuseppe Iuculano <iuculano@debian.org>
+Uploaders: Florian Maier <contact@marsmenschen.com>
+Build-Depends: debhelper (>= 7), libcam-dev [kfreebsd-any], freebsd-glue [kfreebsd-any], automake1.11, autoconf, libcap-ng-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386 !sparc !avr32], libselinux1-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], libusb2-dev [kfreebsd-i386 kfreebsd-amd64], hardening-wrapper
+Standards-Version: 3.9.4
+Vcs-Git: git://anonscm.debian.org/collab-maint/smartmontools.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/smartmontools.git
+Homepage: http://smartmontools.sourceforge.net/
+
+Package: smartmontools
+Architecture: any
+Conflicts: smartsuite, ucsc-smartsuite
+Depends: ${misc:Depends}, ${shlibs:Depends}, debianutils (>= 2.2), lsb-base (>= 3.2-14)
+Recommends: mailx | mailutils
+Suggests: gsmartcontrol, smart-notifier
+Description: control and monitor storage systems using S.M.A.R.T.
+ The smartmontools package contains two utility programs (smartctl and smartd)
+ to control and monitor storage systems using the Self-Monitoring, Analysis and
+ Reporting Technology System (S.M.A.R.T.) built into most modern ATA and SCSI
+ hard disks. It is derived from the smartsuite package, and includes support
+ for ATA/ATAPI-5 disks. It should run on any modern Linux system.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..0803ab3
--- /dev/null
@@ -0,0 +1,18 @@
+This package was debianized by Guido Guenther <agx@debian.org> on
+Tue, 14 Jan 2003 12:58:00 +0000.
+
+It was downloaded from http://smartmontools.sourceforge.net/
+
+Upstream Authors: 
+
+       Bruce Allen <smartmontools-support@lists.sourceforge.net>
+
+Copyright:
+       
+        Copyright (C) 2002-8 Bruce Allen
+
+License:
+
+You are free to distribute this software under the terms of the GNU General
+Public License Version 2. The full text of this license can be found in the
+file /usr/share/common-licenses/GPL-2
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..5851cdc
--- /dev/null
@@ -0,0 +1,4 @@
+etc/smartmontools/run.d
+usr/share/smartmontools
+usr/sbin
+var/lib/smartmontools/drivedb
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..73754a6
--- /dev/null
@@ -0,0 +1,5 @@
+README
+TODO
+AUTHORS
+WARNINGS
+debian/badblockhowto.html
diff --git a/debian/patches/3w-sas b/debian/patches/3w-sas
new file mode 100644 (file)
index 0000000..53449e3
--- /dev/null
@@ -0,0 +1,405 @@
+Author: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
+Date:   Tue Jul 27 13:08:31 2010 +0000
+
+    Linux: Support SATA drives on LSI 3ware 9750 controllers (ticket #86).
+    
+Index: smartmontools-5.39.1+svn3124/CHANGELOG
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/CHANGELOG        2010-07-12 21:21:00.000000000 +0200
++++ smartmontools-5.39.1+svn3124/CHANGELOG     2010-12-23 11:05:12.103063859 +0100
+@@ -86,6 +86,10 @@
+        This fixes build on QNX (ticket #1).
+        Thanks to Stefan (stevestereo) for testing.
++  [CF] Linux: Support SATA drives on LSI 3ware 9750 controllers.
++       Patch provided by Victor Payno (ticket #86).
++       Modified to avoid duplicate code.
++
+   [CF] drivedb.h update:
+        - WD Caviar Green (Adv. Format) family
+Index: smartmontools-5.39.1+svn3124/NEWS
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/NEWS     2010-06-11 18:21:25.000000000 +0200
++++ smartmontools-5.39.1+svn3124/NEWS  2010-12-23 11:05:12.103063859 +0100
+@@ -22,6 +22,7 @@
+   SCT Error Recovery Control time limit.
+ - smartctl options '--scan, --scan-open'.
+ - Linux: Add '/dev/sd[a-c][a-z]' to smartd DEVICESCAN.
++- Linux: Support SATA drives on LSI 3ware 9750 controllers.
+ - Windows: Read 'drivedb.h' and 'smartd.conf' from exe directory.
+ - Windows: Support for 64-bit executables.
+ - Windows: Support for cross compilation on Linux.
+Index: smartmontools-5.39.1+svn3124/os_linux.cpp
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/os_linux.cpp     2010-04-30 19:35:35.000000000 +0200
++++ smartmontools-5.39.1+svn3124/os_linux.cpp  2010-12-23 11:05:12.103063859 +0100
+@@ -196,6 +196,7 @@
+                 "  smartctl --all --device=3ware,2 /dev/sda\n"
+                 "  smartctl --all --device=3ware,2 /dev/twe0\n"
+                 "  smartctl --all --device=3ware,2 /dev/twa0\n"
++                "  smartctl --all --device=3ware,2 /dev/twl0\n"
+                 "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
+                 "  smartctl --all --device=hpt,1/1/3 /dev/sda\n"
+                 "          (Prints all SMART info for the SATA disk attached to the 3rd PMPort\n"
+@@ -1216,7 +1217,8 @@
+   enum escalade_type_t {
+     AMCC_3WARE_678K,
+     AMCC_3WARE_678K_CHAR,
+-    AMCC_3WARE_9000_CHAR
++    AMCC_3WARE_9000_CHAR,
++    AMCC_3WARE_9700_CHAR
+   };
+   linux_escalade_device(smart_interface * intf, const char * dev_name,
+@@ -1389,12 +1391,17 @@
+ bool linux_escalade_device::open()
+ {
+-  if (m_escalade_type == AMCC_3WARE_9000_CHAR || m_escalade_type == AMCC_3WARE_678K_CHAR) {
++  if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR ||
++      m_escalade_type == AMCC_3WARE_678K_CHAR) {
+     // the device nodes for these controllers are dynamically assigned,
+     // so we need to check that they exist with the correct major
+     // numbers and if not, create them
+-    const char * node   = (m_escalade_type == AMCC_3WARE_9000_CHAR ? "twa"    : "twe"    );
+-    const char * driver = (m_escalade_type == AMCC_3WARE_9000_CHAR ? "3w-9xxx": "3w-xxxx");
++    const char * node   = (m_escalade_type == AMCC_3WARE_9700_CHAR ? "twl"     :
++                           m_escalade_type == AMCC_3WARE_9000_CHAR ? "twa"     :
++                                                                     "twe"      );
++    const char * driver = (m_escalade_type == AMCC_3WARE_9700_CHAR ? "3w-sas"  :
++                           m_escalade_type == AMCC_3WARE_9000_CHAR ? "3w-9xxx" :
++                                                                     "3w-xxxx"  );
+     if (setup_3ware_nodes(node, driver))
+       return set_err((errno ? errno : ENXIO), "setup_3ware_nodes(\"%s\", \"%s\") failed", node, driver);
+   }
+@@ -1461,7 +1468,7 @@
+   memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE);
+   // TODO: Handle controller differences by different classes
+-  if (m_escalade_type==AMCC_3WARE_9000_CHAR) {
++  if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR) {
+     tw_ioctl_apache                               = (TW_Ioctl_Buf_Apache *)ioctl_buffer;
+     tw_ioctl_apache->driver_command.control_code  = TW_IOCTL_FIRMWARE_PASS_THROUGH;
+     tw_ioctl_apache->driver_command.buffer_length = 512; /* payload size */
+@@ -1523,7 +1530,8 @@
+     // in dwords by 1 to account for the 64-bit single sgl 'address'
+     // field. Note that this doesn't agree with the typedefs but it's
+     // right (agree with kernel driver behavior/typedefs).
+-    if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
++    if ((m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
++        && sizeof(long) == 8)
+       passthru->size++;
+   }
+   else if (in.direction == ata_cmd_in::no_data) {
+@@ -1535,7 +1543,7 @@
+     passthru->sector_count = 0x0;
+   }
+   else if (in.direction == ata_cmd_in::data_out) {
+-    if (m_escalade_type == AMCC_3WARE_9000_CHAR)
++    if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
+       memcpy(tw_ioctl_apache->data_buffer, in.buffer, in.size);
+     else if (m_escalade_type == AMCC_3WARE_678K_CHAR)
+       memcpy(tw_ioctl_char->data_buffer,   in.buffer, in.size);
+@@ -1548,7 +1556,8 @@
+     passthru->byte0.sgloff = 0x5;
+     passthru->size         = 0x7;  // TODO: Other value for multi-sector ?
+     passthru->param        = 0xF;  // PIO data write
+-    if (m_escalade_type==AMCC_3WARE_9000_CHAR && sizeof(long)==8)
++    if ((m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
++        && sizeof(long) == 8)
+       passthru->size++;
+   }
+   else
+@@ -1556,7 +1565,7 @@
+   // Now send the command down through an ioctl()
+   int ioctlreturn;
+-  if (m_escalade_type==AMCC_3WARE_9000_CHAR)
++  if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
+     ioctlreturn=ioctl(get_fd(), TW_IOCTL_FIRMWARE_PASS_THROUGH, tw_ioctl_apache);
+   else if (m_escalade_type==AMCC_3WARE_678K_CHAR)
+     ioctlreturn=ioctl(get_fd(), TW_CMD_PACKET_WITH_DATA, tw_ioctl_char);
+@@ -1607,7 +1616,7 @@
+   // If this is a read data command, copy data to output buffer
+   if (readdata) {
+-    if (m_escalade_type==AMCC_3WARE_9000_CHAR)
++    if (m_escalade_type == AMCC_3WARE_9700_CHAR || m_escalade_type == AMCC_3WARE_9000_CHAR)
+       memcpy(in.buffer, tw_ioctl_apache->data_buffer, in.size);
+     else if (m_escalade_type==AMCC_3WARE_678K_CHAR)
+       memcpy(in.buffer, tw_ioctl_char->data_buffer, in.size);
+@@ -2695,7 +2704,7 @@
+     if (!memcmp(req_buff + 8, "3ware", 5) || !memcmp(req_buff + 8, "AMCC", 4)) {
+       close();
+       set_err(EINVAL, "AMCC/3ware controller, please try adding '-d 3ware,N',\n"
+-                      "you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
++                      "you may need to replace %s with /dev/twlN, /dev/twaN or /dev/tweN", get_dev_name());
+       return this;
+     }
+@@ -2997,6 +3006,7 @@
+ static const char * lin_dev_scsi_tape1 = "ns";
+ static const char * lin_dev_scsi_tape2 = "os";
+ static const char * lin_dev_scsi_tape3 = "nos";
++static const char * lin_dev_3ware_9700_char = "twl";
+ static const char * lin_dev_3ware_9000_char = "twa";
+ static const char * lin_dev_3ware_678k_char = "twe";
+ static const char * lin_dev_cciss_dir = "cciss/";
+@@ -3080,6 +3090,11 @@
+                strlen(lin_dev_scsi_tape3)))
+     return new linux_scsi_device(this, name, "");
++  // form /dev/twl*
++  if (!strncmp(lin_dev_3ware_9700_char, dev_name,
++               strlen(lin_dev_3ware_9700_char)))
++    return missing_option("-d 3ware,N");
++
+   // form /dev/twa*
+   if (!strncmp(lin_dev_3ware_9000_char, dev_name,
+                strlen(lin_dev_3ware_9000_char)))
+@@ -3122,7 +3137,9 @@
+       return 0;
+     }
+-    if (!strncmp(name, "/dev/twa", 8))
++    if (!strncmp(name, "/dev/twl", 8))
++      return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_9700_CHAR, disknum);
++    else if (!strncmp(name, "/dev/twa", 8))
+       return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_9000_CHAR, disknum);
+     else if (!strncmp(name, "/dev/twe", 8))
+       return new linux_escalade_device(this, name, linux_escalade_device::AMCC_3WARE_678K_CHAR, disknum);
+Index: smartmontools-5.39.1+svn3124/smartctl.8.in
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/smartctl.8.in    2010-06-11 18:21:25.000000000 +0200
++++ smartmontools-5.39.1+svn3124/smartctl.8.in 2010-12-23 11:05:12.103063859 +0100
+@@ -65,7 +65,7 @@
+ \fB"/dev/sg*"\fP.  For SATA disks accessed with libata, use
+ \fB"/dev/sd[a\-z]"\fP and append \fB"\-d ata"\fP. For disks behind
+ 3ware controllers you may need \fB"/dev/sd[a\-z]"\fP or
+-\fB"/dev/twe[0\-9]"\fP or \fB"/dev/twa[0\-9]"\fP: see details
++\fB"/dev/twe[0\-9]"\fP, \fB"/dev/twa[0\-9]"\fP or \fB"/dev/twl[0\-9]"\fP: see details
+ below. For disks behind HighPoint RocketRAID controllers you may need
+ \fB"/dev/sd[a\-z]"\fP.  For disks behind Areca SATA RAID controllers,
+ you need \fB"/dev/sg[2\-9]"\fP (note that smartmontools interacts with
+@@ -303,6 +303,9 @@
+ .nf
+ \fBsmartctl \-a \-d 3ware,1 /dev/twa0\fP
+ .fi
++.nf
++\fBsmartctl \-a \-d 3ware,1 /dev/twl0\fP
++.fi
+ where in the argument \fI3ware,N\fP, the integer N is the disk number
+ (3ware \'port\') within the 3ware ATA RAID controller.  The allowed
+ values of N are from 0 to 127 inclusive.  The first two forms, which
+@@ -314,12 +317,17 @@
+ /dev/twa0\-15, must be used with 3ware 9000 series controllers, which
+ use the 3w\-9xxx driver.
+-Note that if the special character device nodes /dev/twa? and
+-/dev/twe? do not exist, or exist with the incorrect major or minor
++The devices /dev/twl0\-15 must be used with the 3ware/LSI 9750 series
++controllers which use the 3w-sas driver.
++
++Note that if the special character device nodes /dev/twl?, /dev/twa?
++and /dev/twe? do not exist, or exist with the incorrect major or minor
+ numbers, smartctl will recreate them on the fly.  Typically /dev/twa0
+ refers to the first 9000\-series controller, /dev/twa1 refers to the
+-second 9000 series controller, and so on. Likewise /dev/twe0 refers to
+-the first 6/7/8000\-series controller, /dev/twa1 refers to the second
++second 9000 series controller, and so on. The /dev/twl0 devices refers
++to the first 9750 series controller, /dev/twl1 resfers to the second
++9750 series controller, and so on. Likewise /dev/twe0 refers to
++the first 6/7/8000\-series controller, /dev/twe1 refers to the second
+ 6/7/8000 series controller, and so on.
+ Note that for the 6/7/8000 controllers, \fBany\fP of the physical
+@@ -354,7 +362,7 @@
+ instructions.  Alternatively, use the character device /dev/twe0\-15 interface.
+ The selective self\-test functions (\'\-t select,A\-B\') are only supported
+-using the character device interface /dev/twa0\-15 and /dev/twe0\-15.
++using the character device interface /dev/twl0\-15, /dev/twa0\-15 and /dev/twe0\-15.
+ The necessary WRITE LOG commands can not be passed through the SCSI
+ interface.
+@@ -1688,8 +1696,14 @@
+ .nf
+ .B smartctl \-a \-d 3ware,0 /dev/twa0
+ .fi
+-Examine all SMART data for the first ATA disk connected to a 3ware
+-RAID 9000 controller card.
++Examine all SMART data for the first ATA disk connected to a
++3ware RAID 9000 controller card.
++.PP
++.nf
++.B smartctl \-a \-d 3ware,0 /dev/twl0
++.fi
++Examine all SMART data for the first SATA (not SAS) disk connected to a
++3ware RAID 9750 controller card.
+ .PP
+ .nf
+ .B smartctl \-t short \-d 3ware,3 /dev/sdb
+Index: smartmontools-5.39.1+svn3124/smartd.8.in
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/smartd.8.in      2010-12-23 11:00:15.000000000 +0100
++++ smartmontools-5.39.1+svn3124/smartd.8.in   2010-12-23 11:06:26.676860226 +0100
+@@ -601,10 +601,17 @@
+ .B #
+ .nf
+ .B # Two ATA disks on a 3ware 9000 controller.
+-.B # Start long self-tests Sundays between  midnight and 
++.B # Start long self-tests Sundays between midnight and
+ .B # 1am and 2-3 am
+ .B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00
+ .B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
++.nf
++.B #
++.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
++.B # Start long self-tests Sundays between midnight and
++.B # 1am and 2-3 am
++.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
++.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
+ .B #
+ .nf
+ .B # Monitor 2 disks connected to the first HP SmartArray controller which
+@@ -703,11 +710,11 @@
+ status fails, or if new errors appear in the self-test log.
+ .B If a 3ware controller is used
+-then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
+-or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
+-(see below).  The individual ATA disks hosted by the 3ware controller
+-appear to \fBsmartd\fP as normal ATA devices.  Hence all the ATA
+-directives can be used for these disks (but see note below).
++then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
++/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
++Directive (see below).  The individual ATA disks hosted by the 3ware
++controller appear to \fBsmartd\fP as normal ATA devices.  Hence all
++the ATA directives can be used for these disks (but see note below).
+ .B If an Areca controller is used
+ then the corresponding SCSI generic device (/dev/sg?)  must be listed,
+@@ -791,11 +798,11 @@
+ ATA disks behind 3ware controllers may alternatively be accessed via a
+ character device interface /dev/twe0-15 (3ware 6000/7000/8000
+-controllers) and /dev/twa0-15 (3ware 9000 series controllers).  Note
+-that the 9000 series controllers may \fBonly\fP be accessed using the
+-character device interface /dev/twa0-15 and not the SCSI device
+-interface /dev/sd?.  Please see the \fBsmartctl\fP(8) man page for
+-further details.
++controllers), /dev/twa0-15 (3ware 9000 series controllers) and
++/dev/twl0-15 (3ware 9750 series controllers).  Note that the 9000 series
++controllers may \fBonly\fP be accessed using the character device
++interface /dev/twa0-15 and not the SCSI device interface /dev/sd?.
++Please see the \fBsmartctl\fP(8) man page for further details.
+ Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
+ (\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
+@@ -806,8 +813,8 @@
+ patch to older versions.  See
+ \fBhttp://smartmontools.sourceforge.net/\fP for instructions.
+ Alternatively use the character device interfaces /dev/twe0-15 (3ware
+-6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
+-controllers).
++6/7/8000 series controllers), /dev/twa0-15 (3ware 9000 series
++controllers) or /dev/twl0-15 (3ware 9750 series controllers).
+ .I areca,N
+ \- the device consists of one or more SATA disks connected to an Areca
+Index: smartmontools-5.39.1+svn3124/smartd.conf
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/smartd.conf      2010-12-23 11:00:15.000000000 +0100
++++ smartmontools-5.39.1+svn3124/smartd.conf   2010-12-23 11:05:12.107063211 +0100
+@@ -75,12 +75,18 @@
+ #/dev/sdc -d 3ware,2 -a -s L/../../7/03
+ #/dev/sdc -d 3ware,3 -a -s L/../../7/04
+-# Monitor 2 ATA disks connected to a 3ware 9000 controller which uses
+-# the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
++# Monitor 2 ATA disks connected to a 3ware 9000 controller which
++# uses the 3w-9xxx driver (Linux, FreeBSD). Start long self-tests Tuesdays
+ # between 1-2 and 3-4 am.
+ #/dev/twa0 -d 3ware,0 -a -s L/../../2/01
+ #/dev/twa0 -d 3ware,1 -a -s L/../../2/03
++# Monitor 2 SATA (not SAS) disks connected to a 3ware 9000 controller which
++# uses the 3w-sas driver (Linux, FreeBSD). Start long self-tests Tuesdays
++# between 1-2 and 3-4 am.
++#/dev/twl0 -d 3ware,0 -a -s L/../../2/01
++#/dev/twa0 -d 3ware,1 -a -s L/../../2/03
++
+ # Same as above for Windows. Option '-d 3ware,N' is not necessary,
+ # disk (port) number is specified in device name.
+ # NOTE: On Windows, DEVICESCAN works also for 3ware controllers.
+Index: smartmontools-5.39.1+svn3124/smartd.conf.5.in
+===================================================================
+--- smartmontools-5.39.1+svn3124.orig/smartd.conf.5.in 2010-12-23 11:00:15.000000000 +0100
++++ smartmontools-5.39.1+svn3124/smartd.conf.5.in      2010-12-23 11:07:46.278565643 +0100
+@@ -177,12 +177,19 @@
+ .B #
+ .nf
+ .B # Two ATA disks on a 3ware 9000 controller.
+-.B # Start long self-tests Sundays between  midnight and 
++.B # Start long self-tests Sundays between midnight and
+ .B # 1am and 2-3 am
+ .B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00
+ .B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
+ .B #
+ .nf
++.B # Two SATA (not SAS) disks on a 3ware 9750 controller.
++.B # Start long self-tests Sundays between midnight and
++.B # 1am and 2-3 am
++.B \ \ /dev/twl0 -d 3ware,0 -a -s L/../../7/00
++.B \ \ /dev/twl0 -d 3ware,1 -a -s L/../../7/02
++.B #
++.nf
+ .B # Monitor 2 disks connected to the first HP SmartArray controller which
+ .B # uses the cciss driver. Start long tests on Sunday nights and short
+ .B # self-tests every night and send errors to root
+@@ -279,11 +286,11 @@
+ status fails, or if new errors appear in the self-test log.
+ .B If a 3ware controller is used
+-then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
+-or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
+-(see below).  The individual ATA disks hosted by the 3ware controller
+-appear to \fBsmartd\fP as normal ATA devices.  Hence all the ATA
+-directives can be used for these disks (but see note below).
++then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?,
++/dev/twa? or /dev/twl?) must be listed, along with the \'\-d 3ware,N\'
++Directive (see below).  The individual ATA disks hosted by the 3ware
++controller appear to \fBsmartd\fP as normal ATA devices.  Hence all
++the ATA directives can be used for these disks (but see note below).
+ .B If an Areca controller is used
+ then the corresponding SCSI generic device (/dev/sg?)  must be listed,
+@@ -367,11 +374,11 @@
+ ATA disks behind 3ware controllers may alternatively be accessed via a
+ character device interface /dev/twe0-15 (3ware 6000/7000/8000
+-controllers) and /dev/twa0-15 (3ware 9000 series controllers).  Note
+-that the 9000 series controllers may \fBonly\fP be accessed using the
+-character device interface /dev/twa0-15 and not the SCSI device
+-interface /dev/sd?.  Please see the \fBsmartctl\fP(8) man page for
+-further details.
++controllers), /dev/twa0-15 (3ware 9000 series controllers) and
++/dev/twl0-15 (3ware 9750 series controllers).  Note that the 9000 series
++controllers may \fBonly\fP be accessed using the character device
++interface /dev/twa0-15 and not the SCSI device interface /dev/sd?.
++Please see the \fBsmartctl\fP(8) man page for further details.
+ Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
+ (\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
+@@ -382,8 +389,8 @@
+ patch to older versions.  See
+ \fBhttp://smartmontools.sourceforge.net/\fP for instructions.
+ Alternatively use the character device interfaces /dev/twe0-15 (3ware
+-6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
+-controllers).
++6/7/8000 series controllers), /dev/twa0-15 (3ware 9000 series
++controllers) or /dev/twl0-15 (3ware 9750 series controllers).
+ .I areca,N
+ \- the device consists of one or more SATA disks connected to an Areca
diff --git a/debian/patches/52_remove-pragma.diff b/debian/patches/52_remove-pragma.diff
new file mode 100644 (file)
index 0000000..3aa85f1
--- /dev/null
@@ -0,0 +1,124 @@
+Index: smartmontools/atacmds.h
+===================================================================
+--- smartmontools.orig/atacmds.h       2013-09-05 13:32:05.011972432 +0200
++++ smartmontools/atacmds.h    2013-09-05 13:32:05.007972432 +0200
+@@ -125,7 +125,6 @@
+ // Needed parts of the ATA DRIVE IDENTIFY Structure. Those labeled
+ // word* are NOT used.
+-#pragma pack(1)
+ struct ata_identify_device {
+   unsigned short words000_009[10];
+   unsigned char  serial_no[20];
+@@ -147,7 +146,6 @@
+ ASSERT_SIZEOF_STRUCT(ata_identify_device, 512);
+ /* ata_smart_attribute is the vendor specific in SFF-8035 spec */ 
+-#pragma pack(1)
+ struct ata_smart_attribute {
+   unsigned char id;
+   // meaning of flag bits: see MACROS just below
+@@ -208,7 +206,6 @@
+ // Format of data returned by SMART READ DATA
+ // Table 62 of T13/1699-D (ATA8-ACS) Revision 6a, September 2008
+-#pragma pack(1)
+ struct ata_smart_values {
+   unsigned short int revnumber;
+   struct ata_smart_attribute vendor_attributes [NUMBER_ATA_SMART_ATTRIBUTES];
+@@ -241,7 +238,6 @@
+ */
+ /* Vendor attribute of SMART Threshold (compare to ata_smart_attribute above) */
+-#pragma pack(1)
+ struct ata_smart_threshold_entry {
+   unsigned char id;
+   unsigned char threshold;
+@@ -252,7 +248,6 @@
+ /* Format of Read SMART THreshold Command */
+ /* Compare to ata_smart_values above */
+-#pragma pack(1)
+ struct ata_smart_thresholds_pvt {
+   unsigned short int revnumber;
+   struct ata_smart_threshold_entry thres_entries[NUMBER_ATA_SMART_ATTRIBUTES];
+@@ -264,7 +259,6 @@
+ // Table 42 of T13/1321D Rev 1 spec (Error Data Structure)
+-#pragma pack(1)
+ struct ata_smart_errorlog_error_struct {
+   unsigned char reserved;
+   unsigned char error_register;
+@@ -283,7 +277,6 @@
+ // Table 41 of T13/1321D Rev 1 spec (Command Data Structure)
+-#pragma pack(1)
+ struct ata_smart_errorlog_command_struct {
+   unsigned char devicecontrolreg;
+   unsigned char featuresreg;
+@@ -299,7 +292,6 @@
+ ASSERT_SIZEOF_STRUCT(ata_smart_errorlog_command_struct, 12);
+ // Table 40 of T13/1321D Rev 1 spec (Error log data structure)
+-#pragma pack(1)
+ struct ata_smart_errorlog_struct {
+   struct ata_smart_errorlog_command_struct commands[5];
+   struct ata_smart_errorlog_error_struct error_struct;
+@@ -308,7 +300,6 @@
+ ASSERT_SIZEOF_STRUCT(ata_smart_errorlog_struct, 90);
+ // Table 39 of T13/1321D Rev 1 spec (SMART error log sector)
+-#pragma pack(1)
+ struct ata_smart_errorlog {
+   unsigned char revnumber;
+   unsigned char error_log_pointer;
+@@ -405,7 +396,6 @@
+ // Table 45 of T13/1321D Rev 1 spec (Self-test log descriptor entry)
+-#pragma pack(1)
+ struct ata_smart_selftestlog_struct {
+   unsigned char selftestnumber; // Sector number register
+   unsigned char selfteststatus;
+@@ -418,7 +408,6 @@
+ ASSERT_SIZEOF_STRUCT(ata_smart_selftestlog_struct, 24);
+ // Table 44 of T13/1321D Rev 1 spec (Self-test log data structure)
+-#pragma pack(1)
+ struct ata_smart_selftestlog {
+   unsigned short int revnumber;
+   struct ata_smart_selftestlog_struct selftest_struct[21];
+@@ -467,7 +456,6 @@
+ ASSERT_SIZEOF_STRUCT(ata_smart_extselftestlog, 512);
+ // SMART LOG DIRECTORY Table 52 of T13/1532D Vol 1 Rev 1a
+-#pragma pack(1)
+ struct ata_smart_log_entry {
+   unsigned char numsectors;
+   unsigned char reserved;
+@@ -475,7 +463,6 @@
+ #pragma pack()
+ ASSERT_SIZEOF_STRUCT(ata_smart_log_entry, 2);
+-#pragma pack(1)
+ struct ata_smart_log_directory {
+   unsigned short int logversion;
+   struct ata_smart_log_entry entry[255];
+@@ -485,7 +472,6 @@
+ // SMART SELECTIVE SELF-TEST LOG Table 61 of T13/1532D Volume 1
+ // Revision 3
+-#pragma pack(1)
+ struct test_span {
+   uint64_t start;
+   uint64_t end;
+@@ -493,7 +479,6 @@
+ #pragma pack()
+ ASSERT_SIZEOF_STRUCT(test_span, 16);
+-#pragma pack(1)
+ struct ata_selective_self_test_log {
+   unsigned short     logversion;
+   struct test_span   span[5];
diff --git a/debian/patches/53_use-smartd-runner-by-default.diff b/debian/patches/53_use-smartd-runner-by-default.diff
new file mode 100644 (file)
index 0000000..35b28ad
--- /dev/null
@@ -0,0 +1,13 @@
+Index: smartmontools/smartd.conf
+===================================================================
+--- smartmontools.orig/smartd.conf     2013-09-05 13:32:11.471972451 +0200
++++ smartmontools/smartd.conf  2013-09-05 13:32:11.467972451 +0200
+@@ -20,7 +20,7 @@
+ # Directives listed below, which will be applied to all devices that
+ # are found.  Most users should comment out DEVICESCAN and explicitly
+ # list the devices that they wish to monitor.
+-DEVICESCAN
++DEVICESCAN -n standby -m root -M exec /usr/share/smartmontools/smartd-runner
+ # Alternative setting to ignore temperature and power-on hours reports
+ # in syslog.
diff --git a/debian/patches/54_remove-Id-from-smartd.conf.diff b/debian/patches/54_remove-Id-from-smartd.conf.diff
new file mode 100644 (file)
index 0000000..22176b3
--- /dev/null
@@ -0,0 +1,13 @@
+Index: smartmontools/smartd.conf
+===================================================================
+--- smartmontools.orig/smartd.conf     2013-09-05 13:32:14.371972459 +0200
++++ smartmontools/smartd.conf  2013-09-05 13:32:14.363972459 +0200
+@@ -2,8 +2,6 @@
+ # Home page is: http://smartmontools.sourceforge.net
+-# $Id: smartd.conf 3651 2012-10-18 15:11:36Z samm2 $
+-
+ # smartd will re-read the configuration file if it receives a HUP
+ # signal
diff --git a/debian/patches/60_remove-redhatism.diff b/debian/patches/60_remove-redhatism.diff
new file mode 100644 (file)
index 0000000..3538aec
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/smartd.cpp
++++ b/smartd.cpp
+@@ -1038,7 +1038,7 @@ static void MailWarning(const dev_config
+              "  NIS domain: %s\n\n"
+              "The following warning/error was logged by the smartd daemon:\n\n"
+              "%s\n\n"
+-             "For details see host's SYSLOG (default: /var/log/messages).\n\n"
++             "For details see host's SYSLOG (default: /var/log/syslog).\n\n"
+              "%s%s%s",
+            hostname, domainname, nisdomain, message, further, original, additional);
+   exportenv(environ_strings[10], "SMARTD_FULLMESSAGE", fullmessage);
diff --git a/debian/patches/61_cciss-doc.patch b/debian/patches/61_cciss-doc.patch
new file mode 100644 (file)
index 0000000..26f5c4d
--- /dev/null
@@ -0,0 +1,84 @@
+Author: Matt Taggart <taggart@debian.org>
+Subject: Update cciss examples/docs
+
+Here is a patch that adds examples for cciss to the default smartd.conf
+file and adds some more cciss documentation to the manpages. I think this
+patch gets things to parity with the 3ware documentation with a couple
+minor exceptions
+
+Index: smartmontools/smartd.8.in
+===================================================================
+--- smartmontools.orig/smartd.8.in     2013-09-05 13:32:17.291972468 +0200
++++ smartmontools/smartd.8.in  2013-09-05 13:32:17.283972468 +0200
+@@ -153,6 +153,10 @@
+ .SH 
+ OPTIONS
++.B If a cciss controller is used
++then the corresponding block device (/dev/cciss/c?d?) must be listed,
++along with the \'\-d cciss,N\' Directive (see below).
++
+ .TP
+ .B \-A PREFIX, \-\-attributelog=PREFIX
+ Writes \fBsmartd\fP attribute information (normalized and raw
+Index: smartmontools/smartd.conf
+===================================================================
+--- smartmontools.orig/smartd.conf     2013-09-05 13:32:17.291972468 +0200
++++ smartmontools/smartd.conf  2013-09-05 13:32:17.283972468 +0200
+@@ -92,6 +92,12 @@
+ # NOTE: On Windows, DEVICESCAN works also for 3ware controllers.
+ #/dev/hdc,0 -a -s L/../../2/01
+ #/dev/hdc,1 -a -s L/../../2/03
++#
++# Monitor 2 disks connected to the first HP SmartArray controller which
++# uses the cciss driver. Start long tests on Sunday nights and short
++# self-tests every night and send errors to root
++#/dev/cciss/c0d0 -d cciss,0 -a -s (L/../../7/02|S/../.././02) -m root
++#/dev/cciss/c0d0 -d cciss,1 -a -s (L/../../7/03|S/../.././03) -m root
+ # Monitor 3 ATA disks directly connected to a HighPoint RocketRAID. Start long
+ # self-tests Sundays between 1-2, 2-3, and 3-4 am. 
+Index: smartmontools/smartd.conf.5.in
+===================================================================
+--- smartmontools.orig/smartd.conf.5.in        2013-09-05 13:32:17.291972468 +0200
++++ smartmontools/smartd.conf.5.in     2013-09-05 13:32:17.287972468 +0200
+@@ -97,10 +97,11 @@
+ .B # This is an example smartd startup config file
+ .B # /usr/local/etc/smartd.conf for monitoring three
+ .B # ATA disks, three SCSI disks, six ATA disks
+-.B # behind two 3ware controllers, three SATA disks
+-.B # directly connected to the HighPoint Rocket-
+-.B # RAID controller, two SATA disks connected to
+-.B # the HighPoint RocketRAID controller via a pmport
++.B # behind two 3ware controllers, two disks on a cciss
++.B # controller, three SATA disks directly connected
++.B # to the HighPoint Rocket-RAID controller,
++.B # two SATA disks connected to the HighPoint
++.B # RocketRAID controller via a pmport
+ .B # device, four SATA disks connected to an Areca
+ .B # RAID controller, and one SATA disk.
+ .B #
+@@ -178,6 +179,13 @@
+ .\" %ENDIF OS FreeBSD
+ .B #
+ .nf
++.B # Monitor 2 disks connected to the first HP SmartArray controller which
++.B # uses the cciss driver. Start long tests on Sunday nights and short
++.B # self-tests every night and send errors to root
++.B \ \ /dev/cciss/c0d0 -d cciss,0 -a -s (L/../../7/02|S/../.././02) -m root
++.B \ \ /dev/cciss/c0d0 -d cciss,1 -a -s (L/../../7/03|S/../.././03) -m root
++.B #
++.nf
+ .B # Three SATA disks on a HighPoint RocketRAID controller.
+ .B # Start short self-tests daily between 1-2, 2-3, and
+ .B # 3-4 am.
+@@ -1497,6 +1505,9 @@
+ If you want more frequent information, use:
+ .B -a.
++.B If a cciss controller is used
++then the corresponding block device (/dev/cciss/c?d?) must be listed,
++along with the \'\-d cciss,N\' Directive (see below).
+ .TP
+ .B ADDITIONAL DETAILS ABOUT DEVICESCAN
+ If a non-comment entry in the configuration file is the text
diff --git a/debian/patches/63_removable.patch b/debian/patches/63_removable.patch
new file mode 100644 (file)
index 0000000..e2635fa
--- /dev/null
@@ -0,0 +1,16 @@
+Added the removable option by default. This indicates to smartd that it should continue if the device does not appear to be present when smartd is started.
+
+Closes: #406130
+Index: smartmontools/smartd.conf
+===================================================================
+--- smartmontools.orig/smartd.conf     2013-09-05 13:32:21.599972480 +0200
++++ smartmontools/smartd.conf  2013-09-05 13:32:21.591972480 +0200
+@@ -18,7 +18,7 @@
+ # Directives listed below, which will be applied to all devices that
+ # are found.  Most users should comment out DEVICESCAN and explicitly
+ # list the devices that they wish to monitor.
+-DEVICESCAN -n standby -m root -M exec /usr/share/smartmontools/smartd-runner
++DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner
+ # Alternative setting to ignore temperature and power-on hours reports
+ # in syslog.
diff --git a/debian/patches/kfreebsd.patch b/debian/patches/kfreebsd.patch
new file mode 100644 (file)
index 0000000..4833bf7
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/dev_areca.h
++++ b/dev_areca.h
+@@ -58,7 +58,7 @@
+ #define ARCMSR_IOCTL_CLEAR_RQBUFFER          (ARECA_SATA_RAID | FUNCTION_CLEAR_RQBUFFER)
+ #define ARCMSR_IOCTL_CLEAR_WQBUFFER          (ARECA_SATA_RAID | FUNCTION_CLEAR_WQBUFFER)
+ #define ARCMSR_IOCTL_RETURN_CODE_3F          (ARECA_SATA_RAID | FUNCTION_RETURN_CODE_3F)
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__)  || defined(__FreeBSD_kernel__)
+ #include <sys/ioctl.h> // _IOWR
+ /*FunctionCode*/
+--- a/cciss.cpp
++++ b/cciss.cpp
+@@ -18,18 +18,10 @@
+ #  ifndef be32toh
+ #    define be32toh __be32_to_cpu
+ #  endif
+-#elif defined(__FreeBSD__)
++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ #  include <sys/endian.h>
+ #  include CISS_LOCATION
+ #  define _HAVE_CCISS
+-#elif defined(__FreeBSD_kernel__)
+-#  include <endian.h>
+-#  ifdef __GLIBC__
+-#  include <bsd/sys/cdefs.h>
+-#  include <stdint.h>
+-#  endif
+-#  include CISS_LOCATION
+-#  define _HAVE_CCISS
+ #endif
+ #ifdef _HAVE_CCISS
diff --git a/debian/patches/manpage.diff b/debian/patches/manpage.diff
new file mode 100644 (file)
index 0000000..2f43137
--- /dev/null
@@ -0,0 +1,14 @@
+Fixed example path in man pages
+Index: smartmontools/smartd.conf.5.in
+===================================================================
+--- smartmontools.orig/smartd.conf.5.in        2013-09-05 13:32:24.783972489 +0200
++++ smartmontools/smartd.conf.5.in     2013-09-05 13:32:24.775972489 +0200
+@@ -1601,7 +1601,7 @@
+ .fi
+ Some example scripts are distributed with the smartmontools package,
+-in /usr/local/share/doc/smartmontools/examplescripts/.
++in /usr/local/share/doc/smartmontools/examples/.
+ Please note that these scripts typically run as root, so any files
+ that they read/write should not be writable by ordinary users or
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..fe9cf92
--- /dev/null
@@ -0,0 +1,7 @@
+52_remove-pragma.diff
+53_use-smartd-runner-by-default.diff
+54_remove-Id-from-smartd.conf.diff
+61_cciss-doc.patch
+63_removable.patch
+manpage.diff
+kfreebsd.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..dbe146f
--- /dev/null
@@ -0,0 +1,128 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export DEB_BUILD_HARDENING=1
+
+DEB_BUILD_ARCH_OS  ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
+DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
+
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+       CONFIGURE_ARGS += --with-selinux
+endif
+
+ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
+       CFLAGS += -I/usr/include/freebsd
+endif
+
+CFLAGS += -fsigned-char -Wall
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        CFLAGS += -O0
+else
+        CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+        INSTALL_PROGRAM = install -s
+else
+        INSTALL_PROGRAM = install
+endif
+
+PACKAGE = smartmontools
+SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p'| cut -d':' -f2)
+SVN_REVISION := $(shell echo $(SRC_VERSION) | awk -F"+" '{ print $$2 }' | sed 's/svn//' )
+TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.gz
+
+get-orig-source:
+               rm -rf get-orig-source $(TARBALL)
+               mkdir get-orig-source
+               svn export -r $(SVN_REVISION) https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk/smartmontools/ \
+                       get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig
+               GZIP=--best tar czf $(TARBALL) -C get-orig-source $(PACKAGE)-$(SRC_VERSION).orig
+               rm -rf get-orig-source
+               echo "  "$(TARBALL)" created; move it to the right destination to build the package"
+
+configure: configure-stamp
+configure-stamp: 
+       dh_testdir
+       ./autogen.sh
+       CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" ./configure --prefix=/usr                \
+                               --sysconfdir=/etc                \
+                               --mandir=/usr/share/man          \
+                               --with-initscriptdir=no \
+                               --with-docdir=/usr/share/doc/smartmontools \
+                               --enable-drivedb \
+                               --enable-savestates \
+                               --enable-attributelog \
+                               --with-savestates=/var/lib/smartmontools/smartd. \
+                               --with-attributelog=/var/lib/smartmontools/attrlog. \
+                               --with-exampledir=/usr/share/doc/smartmontools/examples/ \
+                               --with-drivedbdir=/var/lib/smartmontools/drivedb \
+                               ${CONFIGURE_ARGS}
+       touch configure-stamp
+
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
+build-stamp: configure-stamp
+       dh_testdir
+       # Add here commands to compile the package.
+       $(MAKE)
+       touch build-stamp
+
+clean: 
+       dh_testdir
+       dh_testroot
+       # rm -f debian/logcheck.logcheck.ignore.*
+       # Add here commands to clean up after the build process.
+       [ ! -f Makefile ] || $(MAKE) distclean
+       rm -f build-stamp configure-stamp \
+             Makefile.in examplescripts/Makefile.in aclocal.m4 configure
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_prep
+       dh_installdirs
+       $(MAKE) DESTDIR=$(CURDIR)/debian/smartmontools install
+       install -D -m 755 debian/smartmontools-bug \
+               $(CURDIR)/debian/smartmontools/usr/share/bug/smartmontools
+
+# Build architecture-independent files here.
+binary-indep:
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installdocs
+       dh_installexamples
+       dh_installmenu
+       dh_installlogrotate
+       dh_install
+       dh_installinit -- start 20 2 3 4 5 . stop 20 1 .
+       dh_installcron
+       dh_installman debian/update-smart-drivedb.8
+       dh_installinfo
+       dh_lintian
+       dh_installchangelogs ChangeLog
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+       chmod 755 $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10mail \
+               $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10powersave-notify \
+               $(CURDIR)/debian/smartmontools/usr/share/smartmontools/smartd-runner
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure get-orig-source
diff --git a/debian/smartd-runner b/debian/smartd-runner
new file mode 100644 (file)
index 0000000..a85961c
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash -e
+
+tmp=$(tempfile)
+cat >$tmp
+
+run-parts --report --lsbsysinit --arg=$tmp --arg="$1" \
+    --arg="$2" --arg="$3" -- /etc/smartmontools/run.d
+
+rm -f $tmp
+
diff --git a/debian/smartmontools-bug b/debian/smartmontools-bug
new file mode 100644 (file)
index 0000000..82cc513
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+#
+# reportbug helper for smartmontools
+#
+# check what IDE_TASK options are set in the kernel:
+
+echo "Output of $0:" >&3
+CONFIG=/boot/config-`uname -r`
+if [ -r "$CONFIG" ]; then
+       grep IDE_TASK $CONFIG >&3
+else
+       echo "Couldn't parse $CONFIG" >&3
+fi
diff --git a/debian/smartmontools.default b/debian/smartmontools.default
new file mode 100644 (file)
index 0000000..6cbd289
--- /dev/null
@@ -0,0 +1,12 @@
+# Defaults for smartmontools initscript (/etc/init.d/smartmontools)
+# This is a POSIX shell fragment
+
+# List of devices you want to explicitly enable S.M.A.R.T. for
+# Not needed (and not recommended) if the device is monitored by smartd
+#enable_smart="/dev/hda /dev/hdb"
+
+# uncomment to start smartd on system startup
+#start_smartd=yes
+
+# uncomment to pass additional options to smartd on startup
+#smartd_opts="--interval=1800"
diff --git a/debian/smartmontools.init b/debian/smartmontools.init
new file mode 100644 (file)
index 0000000..a64b0e6
--- /dev/null
@@ -0,0 +1,137 @@
+#!/bin/sh -e
+# 
+# smartmontools init.d startup script
+#
+# (C) 2003,04,07 Guido Günther <agx@sigxcpu.org>
+# 
+# loosely based on the init script that comes with smartmontools which is
+# copyrighted 2002 by Bruce Allen <smartmontools-support@lists.sourceforge.net>
+#
+### BEGIN INIT INFO
+# Provides:          smartmontools
+# Required-Start:    $syslog $remote_fs
+# Required-Stop:     $syslog $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      1
+# Short-Description: SMART monitoring daemon
+### END INIT INFO
+
+SMARTCTL=/usr/sbin/smartctl
+DAEMON=/usr/sbin/smartd
+PIDFILE=/var/run/smartd.pid
+[ -x $SMARTCTL ] || exit 0
+[ -x $DAEMON ] || exit 0
+. /lib/lsb/init-functions
+
+RET=0
+
+[ -r /etc/default/rcS ] && . /etc/default/rcS
+[ -r /etc/default/smartmontools ] && . /etc/default/smartmontools
+
+smartd_opts="--pidfile $PIDFILE $smartd_opts"
+
+enable_smart() {
+  log_action_begin_msg "Enabling S.M.A.R.T."
+  for device in $enable_smart; do
+      log_action_cont_msg "$device"
+      if ! $SMARTCTL --quietmode=errorsonly --smart=on $device; then
+          log_action_cont_msg "(failed)"
+          RET=2
+      fi
+  done
+  log_action_end_msg 0
+}
+
+check_start_smartd_option() {
+  if [ ! "$start_smartd" = "yes" ]; then
+    [ "$VERBOSE" = "yes" ] && log_warning_msg "Not starting S.M.A.R.T. daemon smartd, disabled via /etc/default/smartmontools"
+    return 1
+  else
+    return 0
+  fi
+}
+
+running_pid()
+{
+    # Check if a given process pid's cmdline matches a given name
+    pid=$1
+    name=$2
+    [ -z "$pid" ] && return 1 
+    [ ! -d /proc/$pid ] &&  return 1
+    cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
+    # Is this the expected child?
+    [ "$cmd" != "$name" ] &&  return 1
+    return 0
+}
+
+running()
+{
+# Check if the process is running looking at /proc
+# (works for all users)
+    # No pidfile, probably no daemon present
+    [ ! -f "$PIDFILE" ] && return 1
+    # Obtain the pid and check it against the binary name
+    pid=`cat $PIDFILE`
+    running_pid $pid $DAEMON || return 1
+    return 0
+}
+
+case "$1" in
+  start)
+        [ -n "$enable_smart" ] && enable_smart
+       if check_start_smartd_option; then
+
+           log_daemon_msg "Starting S.M.A.R.T. daemon" "smartd"
+           if running; then
+               log_progress_msg "already running"
+               log_end_msg 0
+               exit 0
+           fi
+           rm -f $PIDFILE
+           if start-stop-daemon --start --quiet --pidfile $PIDFILE \
+                       --exec $DAEMON -- $smartd_opts; then 
+               log_end_msg 0
+           else
+               log_end_msg 1
+               RET=1
+           fi
+       fi
+       ;;
+  stop)
+       log_daemon_msg "Stopping S.M.A.R.T. daemon" "smartd"
+       start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
+       log_end_msg 0
+       ;;
+  reload|force-reload)
+         log_daemon_msg "Reloading S.M.A.R.T. daemon" "smartd"
+       if start-stop-daemon --stop --quiet --signal 1 \
+                       --pidfile $PIDFILE; then
+           log_end_msg 0
+       else
+           log_end_msg 1
+           RET=1
+       fi
+         ;;
+  restart)
+       if check_start_smartd_option; then
+           log_daemon_msg "Restarting S.M.A.R.T. daemon" "smartd"
+           start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
+           rm -f $PIDFILE
+           if start-stop-daemon --start --quiet --pidfile $PIDFILE \
+                       --exec $DAEMON -- $smartd_opts; then 
+               log_end_msg 0
+           else
+               log_end_msg 1
+               RET=1
+           fi
+       fi
+        ;;
+  status)
+       status_of_proc $DAEMON smartd && exit 0 || exit $?
+       ;;
+  *)
+       echo "Usage: /etc/init.d/smartmontools {start|stop|restart|reload|force-reload|status}"
+       exit 1
+esac
+
+exit $RET
diff --git a/debian/smartmontools.install b/debian/smartmontools.install
new file mode 100644 (file)
index 0000000..bae997b
--- /dev/null
@@ -0,0 +1,3 @@
+debian/smartd-runner usr/share/smartmontools
+debian/10mail etc/smartmontools/run.d
+debian/10powersave-notify etc/smartmontools/run.d
diff --git a/debian/smartmontools.lintian-overrides b/debian/smartmontools.lintian-overrides
new file mode 100644 (file)
index 0000000..c615f67
--- /dev/null
@@ -0,0 +1,3 @@
+# Full stop at end of synopsis is OK - it doesn't end a sentence but is part of
+# an abbreviation.
+smartmontools: description-synopsis-might-not-be-phrased-properly
diff --git a/debian/smartmontools.postinst b/debian/smartmontools.postinst
new file mode 100644 (file)
index 0000000..b2fcad0
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+# Remove shutdown and reboot links; this init script does not need them.
+if dpkg --compare-versions "$2" lt "5.38+svn2879-1"; then
+       if [ -e /etc/rc0.d/K20smartmontools ]; then
+               rm -f /etc/rc0.d/K20smartmontools
+       fi
+       if [ -e /etc/rc6.d/K20smartmontools ]; then
+               rm -f /etc/rc6.d/K20smartmontools
+       fi
+fi
+
+dpkg-maintscript-helper rm_conffile \
+       /etc/init.d/smartd 6.1+svn3812-1~ smartmontools -- "$@" 
+
+#DEBHELPER#
diff --git a/debian/smartmontools.preinst b/debian/smartmontools.preinst
new file mode 100644 (file)
index 0000000..c1af0d6
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+dpkg-maintscript-helper rm_conffile \
+        /etc/init.d/smartd 6.1+svn3812-1~ smartmontools -- "$@"
+
+#DEBHELPER#
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/update-smart-drivedb.8 b/debian/update-smart-drivedb.8
new file mode 100644 (file)
index 0000000..154ccd2
--- /dev/null
@@ -0,0 +1,48 @@
+.TH UPDATE-SMART-DRIVEDB 8 "May 15, 2013" "smartmontools" ""
+.SH "NAME"
+update-smart-drivedb \- update smartmontools drive database
+.SH "SYNOPSIS"
+.B update-smart-drivedb
+.RB [ -v ]
+.RI [ DESTFILE ]
+
+.SH "DESCRIPTION"
+.B update-smart-drivedb
+updates
+.B /usr/share/smartmontools/drivedb.h
+or
+.I DESTFILE
+from smartmontools SVN repository.
+
+It tries to download first from the current branch and then from
+trunk. The tools used for downloading are either
+.BR curl (1),
+.BR wget "(1) or"
+.BR lynx (1).
+
+The old file is kept if the downloaded file is identical (ignoring
+the differences in Id string) otherwise it is moved to
+.BR drivedb.h.old .
+
+.SH "OPTIONS"
+.TP
+\-v
+verbose output
+
+.SH "EXAMPLES"
+.nf
+# update-smart-drivedb
+/usr/share/smartmontools/drivedb.h updated from branches/RELEASE_5_43_DRIVEDB
+.fi
+
+.SH "EXIT STATUS"
+The exit status is 0 if the database has been successfully
+updated. If an error occurs the exit status is 1.
+
+.SH "SEE ALSO"
+.BR smartctl(8),
+.BR smartd (8).
+
+.SH "AUTHOR"
+This manual page was written by
+.BR "Hannes von Haugwitz <hannes@vonhaugwitz.com>" .
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..959854a
--- /dev/null
@@ -0,0 +1,3 @@
+version=3
+opts=uversionmangle=s/\.(tar.*|tgz|zip|gz|bz2)$//i,dversionmangle=s/[-.+~]?(cvs|svn|git|snapshot|pre|hg)(.*)$//i,pasv \
+http://sf.net/smartmontools/smartmontools-?_?([\d+\.]+|\d+)\.(tar.*|tgz|zip|gz|bz2|)