haveged

package: haveged

title: haveged(8)

text:
# haveged(8)

## NAME
haveged - Generate random numbers and feed Linux's random device.

## SYNOPSIS
haveged [options]

## DESCRIPTION
haveged generates an unpredictable stream of random numbers harvested from the indirect effects of hardware events on hidden processor state (caches, branch predictors, memory translation tables, etc) using the HAVEGE (HArdware Volatile Entropy Gathering and Expansion) algorithm. The algorithm operates in user space, no special privilege is required for file system access to the output stream.

Linux pools randomness for distribution by the /dev/random and /dev/urandom device interfaces. The standard mechanisms of filling the /dev/random pool may not be sufficient to meet demand on systems with high needs or limited user interaction. In those circumstances, haveged may be run as a privileged daemon to fill the /dev/random pool whenever the supply of random bits in /dev/random falls below the low water mark of the device.

haveged tunes itself to its environment and provides the same built-in test suite for the output stream as used on certified hardware security devices. See NOTES below for further information.

## OPTIONS
-b nnn, --buffer=nnn

Set collection buffer size to nnn KW. Default is 128KW (or 512KB).

-c cmd, --command=cmd

Switch to command mode and send a command to an already running haveged process or daemon. Currently the only known commands are close to close the current communication socket of the running haveged process as well as root=<new_root> where <new_root> is a place holder for the path of the real new root directory which should provide a haveged installation. The haveged process or daemon will perform a chroot(2) system call followed by a execv(3) to become rebased within the new root directory.

-d nnn, --data=nnn

Set data cache size to nnn KB. Default is 16 or as determined dynamically.

-f file, --file=file

Set output file path for non-daemon use. Default is "sample", use "-" for stdout.

-F , --Foreground

Run daemon in foreground. Do not fork and detach.

-i nnn, --inst=nnn

Set instruction cache size to nnn KB. Default is 16 or as determined dynamically.

-n nnn, --number=nnn

Set number of bytes written to the output file. The value may be specified using one of the suffixes k, m, g, or t. The upper bound of this value is "16t" (2^44 Bytes = 16TB). A value of 0 indicates unbounded output and forces output to stdout. This argument is required if the daemon interface is not present. If the daemon interface is present, this setting takes precedence over any --run value.

-o <spec>, --onlinetest=<spec>

Specify online tests to run. The <spec> consists of optional "t"ot and "c"ontinuous groups, each group indicates the procedures to be run, using "a<n>" to indicate a AIS-31 procedure A variant, and "b" to indicate AIS procedure B. The specifications are order independent (procedure B always runs first in each group) and case insensitive. The a<n> variations exist to mitigate the a slow autocorrelation test (test5). Normally all procedure A tests, except the first are iterated 257 times. An a<n> option indicates test5 should only be executed every modulo <n> times during the procedure's 257 repetitions. The effect is so noticeable that A8 is the usual choice. The "tot" tests run only at initialization - there are no negative performance consequences except for a slight increase in the time required to initialize. The "tot" tests guarantee haveged has initialized properly. The use of both test procedures in the "tot" test is highly recommended because the two test emphasize different aspects of RNG quality.

In continuous testing, the test sequence is cycled repeatedly. For example, the string "tbca8b" (suitable for an AIS NTG.1 device) would run procedure B for the "tot" test, then cycle between procedure A8 and procedure B continuously for all further output. Continuous testing does not come for free, impacting both throughput and resource consumption. Continual testing also opens up the possibility of a test failure. A strict retry procedure recovers from spurious failure in all but the most extreme circumstances. When the retry fails, operation will terminate unless a "w" has been appended to the test token to make the test advisory only. In our example above, the string "tbca8wbw" would make all continuous tests advisory. For more detailed information on AIS retries see NOTES below.

Complete control over the test configuration is provided for flexibility. The defaults (ta8bcb" if run as a daemon and "ta8b" otherwise) are suitable for most circumstances.

-p file, --pidfile=file

Set file path for the daemon pid file. Default is "/var/run/haveged.pid",

-r n, --run=n

Set run level for daemon interface: n = 0 Run as daemon - must be root. Fills /dev/random when the supply of random bits

falls below the low water mark of the device.

n = 1 Display configuration info and terminate.

n > 1 Write <n> kb of output. Deprecated (use --number instead), only provided for backward compatibility.

If --number is specified, values other than 0,1 are ignored. Default is 0.

-v n, --verbose=n

Set diagnostic bitmap as sum of following options: 1=Show build/tuning summary on termination, summary for online test retries.

2=Show online test retry details

4=Show timing for collections

8=Show collection loop layout

16=Show collection loop code offsets

32=Show all online test completion detail

Default is 0. Use -1 for all diagnostics.

-w nnn, --write=nnn

Set write_wakeup_threshold of daemon interface to nnn bits. Applies only to run level 0.

-?, --help

This summary of program options.

## NOTES
haveged tunes the HAVEGE algorithm for maximum effectiveness using a hierarchy of defaults, command line options, virtual file system information, and cpuid information where available. Under most circumstances, user input is not required for excellent results.

Run-time testing provides assurance of correct haveged operation. The run-time test suite is modeled upon the AIS-31 specification of the German Common Criteria body, BIS. This specification is typically applied to hardware devices, requiring formal certification and mandated start-up and continuous operational testing. Because haveged runs on many different hardware platforms, certification cannot be a goal, but the AIS-31 test suite provides the means to assess haveged output with the same operational tests applied to certified hardware devices.

AIS test procedure A performs 6 tests to check for statistically inconspicuous behavior. AIS test procedure B performs more theoretical tests such as checking multi-step transition probabilities and making an empirical entropy estimate. Procedure A is the much more resource and compute intensive of the two but is still recommended for the haveged start-up tests. Procedure B is well suited to use of haveged as a daemon because the test entropy estimate confirms the entropy estimate haveged uses when adding entropy to the /dev/random device.

No test is perfect. There is a 10e-4 probability that a perfect generator will fail either of the test procedures. AIS-31 mandates a strict retry policy to filter out false alarms and haveged always logs test procedure failures. Retries are expected but rarely observed except when large data sets are generated with continuous testing. See the libhavege(3) notes for more detailed information.

## FILES
If running as a daemon, access to the following files is required

/dev/random

/proc/sys/kernel/osrelease

/proc/sys/kernel/random/poolsize

/proc/sys/kernel/random/write_wakeup_threshold

## DIAGNOSTICS
Haveged returns 0 for success and non-zero for failure. The failure return code is 1 "general failure" unless execution is terminated by signal <n>, in which case the return code will be 128 + <n>. The following diagnostics are issued to stderr upon non-zero termination:

Cannot fork into the background

Call to daemon(3) failed.

Cannot open file <s> for writing. Could not open sample file <s> for writing.

Cannot write data in file: Could not write data to the sample file.

Couldn't get pool size. Unable to read /proc/sys/kernel/random/poolsize

Couldn't initialize HAVEGE rng Invalid data or instruction cache size.

Couldn't open PID file <s> for writing Unable to write daemon PID

Couldn't open random device Could not open /dev/random for read-write.

Couldn't query entropy-level from kernel: error Call to ioctl(2) failed.

Couldn't open PID file <path> for writing Error writing /var/run/haveged.pid

Fail:set_watermark() Unable to write to /proc/sys/kernel/random/write_wakeup_threshold

RNDADDENTROPY failed! Call to ioctl(2) to add entropy failed

RNG failed The random number generator failed self-test or encountered a fatal error.

Select error Call to select(2) failed.

Stopping due to signal <n> Signal <n> caught.

Unable to setup online tests Memory unavailable for online test resources.

## EXAMPLES
Write 1.5MB of random data to the file /tmp/random

haveged -n 1.5M -f /tmp/random

Generate a /tmp/keyfile for disk encryption with LUKS

haveged -n 2048 -f /tmp/keyfile

Overwrite partition /dev/sda1 with random data. Be careful, all data on the partition will be lost!

haveged -n 0 | dd of=/dev/sda1

Generate random ASCII passwords of the length 16 characters

(haveged -n 1000 -f - 2>/dev/null | tr -cd '[:graph:]' | fold -w 16 && echo ) | head

Write endless stream of random bytes to the pipe. Utility pv measures the speed by which data are written to the pipe.

haveged -n 0 | pv > /dev/null

Evaluate speed of haveged to generate 1GB of random data

haveged -n 1g -f - | dd of=/dev/null

Create a random key file containing 65 random keys for the encryption program aespipe.

haveged -n 3705 -f - 2>/dev/null | uuencode -m - | head -n 66 | tail -n 65

Test the randomness of the generated data with dieharder test suite

haveged -n 0 | dieharder -g 200 -a

Generate 16k of data, testing with procedure A and B with detailed test results. No c result seen because a single buffer fill did not contain enough data to complete the test.

haveged -n 16k -o tba8ca8 -v 33

Generate 16k of data as above with larger buffer. The c test now completes - enough data now generated to complete the test.

haveged -n 16k -o tba8ca8 -v 33 -b 512

Generate 16m of data as above, observe many c test completions with default buffer size.

haveged -n 16m -o tba8ca8 -v 33

Generate large amounts of data - in this case 16TB. Enable initialization test but made continuous tests advisory only to avoid a possible situation that program will terminate because of procedureB failing two times in a row. The probability of procedureB to fail two times in a row can be estimated as <TB to generate>/3000 which yields 0.5% for 16TB.

haveged -n 16T -o tba8cbw -f - | pv > /dev/null

Generate large amounts of data (16TB). Disable continuous tests for the maximum throughput but run the online tests at the startup to make sure that generator for properly initialized:

haveged -n 16T -o tba8c -f - | pv > /dev/null

## SEE ALSO
libhavege(3),

cryptsetup(8), aespipe(1), pv(1), openssl(1), uuencode(1)

## REFERENCES
HArdware Volatile Entropy Gathering and Expansion: generating unpredictable random numbers at user level by A. Seznec, N. Sendrier, INRIA Research Report, RR-4592, October 2002

A proposal for: Functionality classes for random number generators by W. Killmann and W. Schindler, version 2.0, Bundesamt fur Sicherheit in der Informationstechnik (BSI), September, 2011

A Statistical Test Suite for the Validation of Random NUmber Generators and Pseudorandom Number Generators for Cryptographic Applications, special publication SP800-22, National Institute of Standards and Technology, revised April, 2010

Additional information can also be found at http://www.issihosts.com/haveged/

## AUTHORS
Gary Wuertz <gary@issiweb.com> and Jirka Hladky <hladky jiri AT gmail DOT com>


hddtemp

package: hddtemp

title: hddtemp(8)

text:
# hddtemp(8)

## NAME
hddtemp - Utility to monitor hard drive temperature

## SYNOPSIS
hddtemp [options] [[type:]disk]...

## DESCRIPTION
hddtemp will give you the temperature of your hard drive by reading Self-Monitoring Analysis and Reporting Technology (S.M.A.R.T.) information on drives that support this feature. Only modern hard drives have a temperature sensor. hddtemp supports reading S.M.A.R.T. information from SCSI drives too. hddtemp can work as simple command line tool or as a daemon.

You can specify one or more device drive path, where each path can be prefixed with a type like PATA, SATA or SCSI to force hddtemp too use one of these type (because detection can fail). If no paths are specified, autodetection of installed drives is attempted.

## OPTIONS
The program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below.

-b, --drivebase

Display the database file that allows hddtemp to recognize a supported drive.

-D, --debug

Display various S.M.A.R.T. fields and their values. Useful for finding a value that seems to match the temperature and/or to send a report. (done for every drive supplied)

-d, --daemon

Execute hddtemp in TCP/IP daemon mode (port 7634 by default).

-f, --file=file

Specify the database file to use.

-F, --foreground

Don't fork into the background even in daemon mode. This is useful when running under a process supervisor.

-l, --listen=addr

Listen on a specific address. addr is a string containing a host name or a numeric host address string. The numeric host address string is a dotted-decimal IPv4 address or an IPv6 hex address.

-n, --numeric

Print only the temperature (without the unit).

-p, --port=#

Port number to listen to (in TCP/IP daemon mode).

-s, --separator=char

Separator to use between fields (in TCP/IP daemon mode). The default separator is `|'.

-S, --syslog=s

Switch to daemon mode and log temperatures to syslog every s seconds.

-q, --quiet

Don't check if the drive is supported.

-u, --unit=C|F

Force output temperature either in Celsius or Fahrenheit.

-v, --version

Display hddtemp version number.

-w, --wake-up

Wake-up the drive if needed (ATA drives only).

-4

Listen on IPv4 sockets only.

-6

Listen on IPv6 sockets only.

## DRIVE DATABASE
If you know your drive has a temperature sensor but it is being reported unsupported, tell me which model and which manufacturer it is, and/or just add a new entry in /etc/hddtemp.db. Each line of hddtemp.db is either a comment, a blank line or a line containing:

- a regular expression that allow hddtemp to recognize a drive or a

set of drives from its model name or from a generic model name,

- a value (ATTRIBUTE_ID from S.M.A.R.T.),

- a C or an F to set the unit to Celsius or Fahrenheit,

- a description.

Feedback is welcome (see the REPORT section below).

## TCP/IP DAEMON MODE
Example of type forcing:

\# hddtemp SATA:/dev/sda PATA:/dev/hda

To test hddtemp in daemon mode, start it like this:

\# hddtemp -d /dev/hd[abcd]

and use telnet or netcat (which is known as nc on some systems) to get a reply:

\# netcat localhost 7634

The drive database is read only once at startup, so hddtemp must be restarted if the database is updated for the changes to take effect.

## REPORT
As I receive a lot of reports, things must be clarified. When running hddtemp with debug options, hddtemp will show sort of a dump of S.M.A.R.T. data. Each field corresponds to an information field. The standard field for drive temperature is 194. But this is not always the case (mostly for older drives). Even if your drive has S.M.A.R.T. capabilities, it doesn't necessarily mean that it can report its temperature. So, things must be determined through experimentation.

So, you can try to guess which field by is the good one by running hddtemp at regular intervals:

- just after starting up your PC/server/station,

- after opening a window (a physical window :),

- after opening the case,

- whatever you can think of...

and looking for a field's value that would increase or decrease depending on what effect you want to induce. Be careful, fields 4, 9, and 12 are often reported to match a temperature field but after some investigation they do not. But fields 194 (which is the standard field for temperature) and 231 are good candidates.

Then, you can send me a report with outputs from `hddtemp --debug ...', `smartctl' or `hdparm -i ...', and/or add an entry in hddtemp.db yourself.

## BUGS
If hddtemp crashes (yes, it might) for some unknown reasons, look for a file named hddtemp.backtrace.<PID>.XXXXXX (where XXXXXX is a random number generated at runtime) in /tmp. Then, you can then send me this file and the hddtemp binary. The backtrace functionality is currently supported on i386 architectures only.

## SEE ALSO
smartctl(8), syslog(3), syslogd(8).

## AUTHOR
Emmanuel Varagnat (hddtemp@guzu.net).

This manual page was originally written by Aurelien Jarno <aurel32@debian.org>, for the Debian GNU/Linux system (but may be used by others).


hdparm

package: hdparm

title: hdparm(8)

summary: get/set SATA/IDE device parameters

text:
# hdparm(8)

## NAME
hdparm - get/set SATA/IDE device parameters

## SYNOPSIS
hdparm [options] [device ...]

## DESCRIPTION
hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore may also work with hdparm. E.g. recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with the latest kernels.

## OPTIONS
When no options are given, -acdgkmur is assumed. For "Get/set" options, a query without the optional parameter (e.g. -d) will query (get) the device state, and with a parameter (e.g., -d0) will set the device state.

-a

Get/set sector count for filesystem (software) read-ahead. This is used to improve performance in sequential reads of large files, by prefetching additional blocks in anticipation of them being needed by the running task. Many IDE drives also have a separate built-in read-ahead function, which augments this filesystem (software) read-ahead function.

-A

Get/set the IDE drive´s read-lookahead feature (usually ON by default). Usage: -A0 (disable) or -A1 (enable).

-b

Get/set bus state.

-B

Get/set Advanced Power Management feature, if the drive supports it. A low value means aggressive power management and a high value means better performance. Possible settings range from values 1 through 127 (which permit spin-down), and values 128 through 254 (which do not permit spin-down). The highest degree of power management is attained with a setting of 1, and the highest I/O performance with a setting of 254. A value of 255 tells hdparm to disable Advanced Power Management altogether on the drive (not all drives support disabling it, but most do).

-c

Get/set (E)IDE 32-bit I/O support. A numeric parameter can be used to enable/disable 32-bit I/O support. Currently supported values include 0 to disable 32-bit I/O support, 1 to enable 32-bit data transfers, and 3 to enable 32-bit data transfers with a special sync sequence required by many chipsets. The value 3 works with nearly all 32-bit IDE chipsets, but incurs slightly more overhead. Note that "32-bit" refers to data transfers across a PCI or VLB bus to the interface card only; all (E)IDE drives still have only a 16-bit connection over the ribbon cable from the interface card.

-C

Check the current IDE power mode status, which will always be one of unknown (drive does not support this command), active/idle (normal operation), standby (low power mode, drive has spun down), or sleeping (lowest power mode, drive is completely shut down). The -S, -y, -Y, and -Z options can be used to manipulate the IDE power modes.

-d

Get/set the "using_dma" flag for this drive. This option now works with most combinations of drives and PCI interfaces which support DMA and which are known to the kernel IDE driver. It is also a good idea to use the appropriate -X option in combination with -d1 to ensure that the drive itself is programmed for the correct DMA mode, although most BIOSs should do this for you at boot time. Using DMA nearly always gives the best performance, with fast I/O throughput and low CPU usage. But there are at least a few configurations of chipsets and drives for which DMA does not make much of a difference, or may even slow things down (on really messed up hardware!). Your mileage may vary.

--dco-freeze

DCO stands for Device Configuration Overlay, a way for vendors to selectively disable certain features of a drive. The --dco-freeze option will freeze/lock the current drive configuration, thereby preventing software (or malware) from changing any DCO settings until after the next power-on reset.

--dco-identify

Query and dump information regarding drive configuration settings which can be disabled by the vendor or OEM installer. These settings show capabilities of the drive which might be disabled by the vendor for "enhanced compatibility". When disabled, they are otherwise hidden and will not show in the -I identify output. For example, system vendors sometimes disable 48_bit addressing on large drives, for compatibility (and loss of capacity) with a specific BIOS. In such cases, --dco-identify will show that the drive is 48_bit capable, but -I will not show it, and nor will the drive accept 48_bit commands.

--dco-restore

Reset all drive settings, features, and accessible capacities back to factory defaults and full capabilities. This command will fail if DCO is frozen/locked, or if a -Np maximum size restriction has also been set. This is EXTREMELY DANGEROUS and will very likely cause massive loss of data. DO NOT USE THIS COMMAND.

--direct

Use the kernel´s "O_DIRECT" flag when performing a -t timing test. This bypasses the page cache, causing the reads to go directly from the drive into hdparm's buffers, using so-called "raw" I/O. In many cases, this can produce results that appear much faster than the usual page cache method, giving a better indication of raw device and driver performance.

--drq-hsm-error

VERY DANGEROUS, DON'T EVEN THINK ABOUT USING IT. This option causes hdparm to issue an IDENTIFY command to the kernel, but incorrectly marked as a "non-data" command. This results in the drive being left with its DataReQust(DRQ) line "stuck" high. This confuses the kernel drivers, and may crash the system immediately with massive data loss. The option exists to help in testing and fortifying the kernel against similar real-world drive malfunctions. VERY DANGEROUS, DO NOT USE!!

-D

Enable/disable the on-drive defect management feature, whereby the drive firmware tries to automatically manage defective sectors by relocating them to "spare" sectors reserved by the factory for such. Control of this feature via the -D option is not supported for most modern drives since ATA-4; thus this command may fail.

-E

Set cd/dvd drive speed. This is NOT necessary for regular operation, as the drive will automatically switch speeds on its own. But if you want to play with it, just supply a speed number after the option, usually a number like 2 or 4. This can be useful in some cases, though, to smooth out DVD video playback.

-f

Sync and flush the buffer cache for the device on exit. This operation is also performed internally as part of the -t and -T timings and other options.

--fallocate

This option currently works only on ext4 and xfs filesystem types. When used, this must be the only option given. It requires two parameters: the desired file size in kilo-bytes (byte count divided by 1024), followed by the pathname for the new file. It will create a new file of the specified size, but without actually having to write any data to the file. This will normally complete very quickly, and without thrashing the storage device.

E.g. Create a 10KByte file: hdparm --fallocate 10 temp_file

--fibmap

When used, this must be the only option given. It requires a file path as a parameter, and will print out a list of the block extents (sector ranges) occupied by that file on disk. Sector numbers are given as absolute LBA numbers, referenced from sector 0 of the physical device rather than from the partition or filesystem. This information can then be used for a variety of purposes, such as examining the degree of fragmenation of larger files, or determining appropriate sectors to deliberately corrupt during fault-injection testing procedures.

This option uses the new FIEMAP (file extent map) ioctl() when available, and falls back to the older FIBMAP (file block map) ioctl() otherwise. Note that FIBMAP suffers from a 32-bit block-number interface, and thus not work beyond 8TB or 16TB. FIBMAP is also very slow, and does not deal well with preallocated uncommitted extents in ext4/xfs filesystems, unless a sync() is done before using this option.

--fwdownload

When used, this should be the only option given. It requires a file path immediately after the option, indicating where the new drive firmware should be read from. The contents of this file will be sent to the drive using the (S)ATA DOWNLOAD MICROCODE command, using either transfer protocol 7 (entire file at once), or, if the drive supports it, transfer protocol 3 (segmented download). This command is EXTREMELY DANGEROUS and could destroy both the drive and all data on it. DO NOT USE THIS COMMAND. The --fwdownload-mode3 , --fwdownload-mode3-max , and --fwdownload-mode7 variations on basic --fwdownload allow overriding automatic protocol detection in favour of forcing hdparm to use a specific transfer protocol, for testing purposes only.

-F

Flush the on-drive write cache buffer (older drives may not implement this).

-g

Display the drive geometry (cylinders, heads, sectors), the size (in sectors) of the device, and the starting offset (in sectors) of the device from the beginning of the drive.

-h

Display terse usage information (help).

-H

Read the temperature from some (mostly Hitachi) drives. Also reports if the temperature is within operating condition range (this may not be reliable). Does not cause the drive to spin up if idle.

-i

Display the identification info which the kernel drivers (IDE, libata) have stored from boot/configuration time. This may differ from the current information obtainable directly from the drive itself with the -I option. The data returned may or may not be current, depending on activity since booting the system. For a more detailed interpretation of the identification info, refer to AT Attachment Interface for Disk Drives, ANSI ASC X3T9.2 working draft, revision 4a, April 19/93, and later editions.

--idle-immediate

Issue an ATA IDLE_IMMEDIATE command, to put the drive into a lower power state. Usually the device remains spun-up.

--idle-unload

Issue an ATA IDLE_IMMEDIATE_WITH_UNLOAD command, to unload or park the heads and put the drive into a lower power state. Usually the device remains spun-up.

-I

Request identification info directly from the drive, which is displayed in a new expanded format with considerably more detail than with the older -i option.

--Iraw <pathname>

This option dumps the drive's identify data in raw binary to the specified file.

--Istdin

This is a special variation on the -I option, which accepts a drive identification block as standard input instead of using a /dev/hd* parameter. The format of this block must be exactly the same as that found in the /proc/ide/*/hd*/identify "files", or that produced by the --Istdout option described below. This variation is designed for use with collected "libraries" of drive identification information, and can also be used on ATAPI drives which may give media errors with the standard mechanism. When --Istdin is used, it must be the *only* parameter given.

--Istdout

This option dumps the drive's identify data in hex to stdout, in a format similar to that from /proc/ide/*/identify, and suitable for later use with the --Istdin option.

-J

Get/set the Western Digital (WD) Green Drive's "idle3" timeout value. This timeout controls how often the drive parks its heads and enters a low power consumption state. The factory default is eight (8) seconds, which is a very poor choice for use with Linux. Leaving it at the default will result in hundreds of thousands of head load/unload cycles in a very short period of time. The drive mechanism is only rated for 300,000 to 1,000,000 cycles, so leaving it at the default could result in premature failure, not to mention the performance impact of the drive often having to wake-up before doing routine I/O.

WD supply a WDIDLE3.EXE DOS utility for tweaking this setting, and you should use that program instead of hdparm if at all possible. The reverse-engineered implementation in hdparm is not as complete as the original official program, even though it does seem to work on at a least a few drives. A full power cycle is required for any change in setting to take effect, regardless of which program is used to tweak things.

A setting of 30 seconds is recommended for Linux use. Permitted values are from 8 to 12 seconds, and from 30 to 300 seconds in 30-second increments. Specify a value of zero (0) to disable the WD idle3 timer completely (NOT RECOMMENDED!).

-k

Get/set the "keep_settings_over_reset" flag for the drive. When this flag is set, the drive will preserve the -dmu settings over a soft reset, (as done during the error recovery sequence). This option defaults to off, to prevent drive reset loops which could be caused by combinations of -dmu settings. The -k option should therefore only be set after one has achieved confidence in correct system operation with a chosen set of configuration settings. In practice, all that is typically necessary to test a configuration (prior to using -k) is to verify that the drive can be read/written, and that no error logs (kernel messages) are generated in the process (look in /var/log/messages on most systems).

-K

Set the drive´s "keep_features_over_reset" flag. Setting this enables the drive to retain the settings for -APSWXZ over a soft reset (as done during the error recovery sequence). Not all drives support this feature.

-L

Set the drive´s doorlock flag. Setting this to 1 will lock the door mechanism of some removable hard drives (e.g. Syquest, ZIP, Jazz..), and setting it to 0 will unlock the door mechanism. Normally, Linux maintains the door locking mechanism automatically, depending on drive usage (locked whenever a filesystem is mounted). But on system shutdown, this can be a nuisance if the root partition is on a removable disk, since the root partition is left mounted (read-only) after shutdown. So, by using this command to unlock the door after the root filesystem is remounted read-only, one can then remove the cartridge from the drive after shutdown.

-m

Get/set sector count for multiple sector I/O on the drive. A setting of 0 disables this feature. Multiple sector mode (aka IDE Block Mode), is a feature of most modern IDE hard drives, permitting the transfer of multiple sectors per I/O interrupt, rather than the usual one sector per interrupt. When this feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%. On many systems, it also provides increased data throughput of anywhere from 5% to 50%. Some drives, however (most notably the WD Caviar series), seem to run slower with multiple mode enabled. Your mileage may vary. Most drives support the minimum settings of 2, 4, 8, or 16 (sectors). Larger settings may also be possible, depending on the drive. A setting of 16 or 32 seems optimal on many systems. Western Digital recommends lower settings of 4 to 8 on many of their drives, due tiny (32kB) drive buffers and non-optimized buffering algorithms. The -i option can be used to find the maximum setting supported by an installed drive (look for MaxMultSect in the output). Some drives claim to support multiple mode, but lose data at some settings. Under rare circumstances, such failures can result in massive filesystem corruption.

--make-bad-sector

Deliberately create a bad sector (aka. "media error") on the disk. EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!! This can be useful for testing of device/RAID error recovery mechanisms. The sector number is given as a (base10) parameter after the option. Depending on the device, hdparm will choose one of two possible ATA commands for corrupting the sector. The WRITE_LONG works on most drives, but only up to the 28-bit sector boundary. Some very recent drives (2008) may support the new WRITE_UNCORRECTABLE_EXT command, which works for any LBA48 sector. If available, hdparm will use that in preference to WRITE_LONG. The WRITE_UNCORRECTABLE_EXT command itself presents a choice of how the new bad sector should behave. By default, it will look like any other bad sector, and the drive may take some time to retry and fail on subsequent READs of the sector. However, if a single letter f is prepended immediately in front of the first digit of the sector number parameter, then hdparm will issue a "flagged" WRITE_UNCORRECTABLE_EXT, which causes the drive to merely flag the sector as bad (rather than genuinely corrupt it), and subsequent READs of the sector will fail immediately (rather than after several retries). Note also that the --repair-sector option can be used to restore (any) bad sectors when they are no longer needed, including sectors that were genuinely bad (the drive will likely remap those to a fresh area on the media).

-M

Get/set Automatic Acoustic Management (AAM) setting. Most modern harddisk drives have the ability to speed down the head movements to reduce their noise output. The possible values are between 0 and 254. 128 is the most quiet (and therefore slowest) setting and 254 the fastest (and loudest). Some drives have only two levels (quiet / fast), while others may have different levels between 128 and 254. At the moment, most drives only support 3 options, off, quiet, and fast. These have been assigned the values 0, 128, and 254 at present, respectively, but integer space has been incorporated for future expansion, should this change.

-n

Get or set the "ignore_write_errors" flag in the driver. Do NOT play with this without grokking the driver source code first.

-N

Get/set max visible number of sectors, also known as the Host Protected Area setting. Without a parameter, -N displays the current setting, which is reported as two values: the first gives the current max sectors setting, and the second shows the native (real) hardware limit for the disk. The difference between these two values indicates how many sectors of the disk are currently hidden from the operating system, in the form of a Host Protected Area (HPA). This area is often used by computer makers to hold diagnostic software, and/or a copy of the originally provided operating system for recovery purposes. Another possible use is to hide the true capacity of a very large disk from a BIOS/system that cannot normally cope with drives of that size (eg. most current {2010} BIOSs cannot deal with drives larger than 2TB, so an HPA could be used to cause a 3TB drive to report itself as a 2TB drive). To change the current max (VERY DANGEROUS, DATA LOSS IS EXTREMELY LIKELY), a new value should be provided (in base10) immediately following the -N option. This value is specified as a count of sectors, rather than the "max sector address" of the drive. Drives have the concept of a temporary (volatile) setting which is lost on the next hardware reset, as well as a more permanent (non-volatile) value which survives resets and power cycles. By default, -N affects only the temporary (volatile) setting. To change the permanent (non-volatile) value, prepend a leading p character immediately before the first digit of the value. Drives are supposed to allow only a single permanent change per session. A hardware reset (or power cycle) is required before another permanent -N operation can succeed. Note that any attempt to set this value may fail if the disk is being accessed by other software at the same time. This is because setting the value requires a pair of back-to-back drive commands, but there is no way to prevent some other command from being inserted between them by the kernel. So if it fails initially, just try again. Kernel support for -N is buggy for many adapter types across many kernel versions, in that an incorrect (too small) max size value is sometimes reported. As of the 2.6.27 kernel, this does finally seem to be working on most hardware.

--offset

Offsets to given number of GiB (1024*1024*1024) when performing -t timings of device reads. Speed changes (about twice) along many mechanical drives. Usually the maximum is at the beginning, but not always. Solid-state drives (SSDs) should show similar timings regardless of offset.

-p

Attempt to reprogram the IDE interface chipset for the specified PIO mode, or attempt to auto-tune for the "best" PIO mode supported by the drive. This feature is supported in the kernel for only a few "known" chipsets, and even then the support is iffy at best. Some IDE chipsets are unable to alter the PIO mode for a single drive, in which case this option may cause the PIO mode for both drives to be set. Many IDE chipsets support either fewer or more than the standard six (0 to 5) PIO modes, so the exact speed setting that is actually implemented will vary by chipset/driver sophistication. Use with extreme caution! This feature includes zero protection for the unwary, and an unsuccessful outcome may result in severe filesystem corruption!

-P

Set the maximum sector count for the drive´s internal prefetch mechanism. Not all drives support this feature, and it was dropped from the official spec as of ATA-4.

--prefer-ata12

When using the SAT (SCSI ATA Translation) protocol, hdparm normally prefers to use the 16-byte command format whenever possible. But some USB drive enclosures don't work correctly with 16-byte commands. This option can be used to force use of the smaller 12-byte command format with such drives. hdparm will still revert to 16-byte commands for things that cannot be done with the 12-byte format (e.g. sector accesses beyond 28-bits).

-q

Handle the next option quietly, suppressing normal output (but not error messages). This is useful for reducing screen clutter when running from system startup scripts. Not applicable to the -i or -v or -t or -T options.

-Q

Get or set the device's command queue_depth, if supported by the hardware. This only works with 2.6.xx (or later) kernels, and only with device and driver combinations which support changing the queue_depth. For SATA disks, this is the Native Command Queuing (NCQ) queue depth.

-r

Get/set read-only flag for the device. When set, Linux disallows write operations on the device.

-R

Get/set Write-Read-Verify feature, if the drive supports it. Usage: -R0 (disable) or -R1 (enable). This feature is intended to have the drive firmware automatically read-back any data that is written by software, to verify that the data was successfully written. This is generally overkill, and can slow down disk writes by as much as a factor of two (or more).

--read-sector

Reads from the specified sector number, and dumps the contents in hex to standard output. The sector number must be given (base10) after this option. hdparm will issue a low-level read (completely bypassing the usual block layer read/write mechanisms) for the specified sector. This can be used to definitively check whether a given sector is bad (media error) or not (doing so through the usual mechanisms can sometimes give false positives).

--repair-sector

This is an alias for the --write-sector option. VERY DANGEROUS.

-s

Enable/disable the power-on in standby feature, if supported by the drive. VERY DANGEROUS. Do not use unless you are absolutely certain that both the system BIOS (or firmware) and the operating system kernel (Linux >= 2.6.22) support probing for drives that use this feature. When enabled, the drive is powered-up in the standby mode to allow the controller to sequence the spin-up of devices, reducing the instantaneous current draw burden when many drives share a power supply. Primarily for use in large RAID setups. This feature is usually disabled and the drive is powered-up in the active mode (see -C above). Note that a drive may also allow enabling this feature by a jumper. Some SATA drives support the control of this feature by pin 11 of the SATA power connector. In these cases, this command may be unsupported or may have no effect.

-S

Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive. This timeout value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means "timeouts are disabled": the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.

--set-sector-size

For drives which support reconfiguring of the Logical Sector Size, this flag can be used to specify the new desired sector size in bytes. VERY DANGEROUS. This most likely will scramble all data on the drive. The specified size must be one of 512, 520, 528, 4096, 4160, or 4224. Very few drives support values other than 512 and 4096. Eg. hdparm --set-sector-size 4096 /dev/sdb

-t

Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache to the disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead. To ensure accurate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl.

-T

Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test.

--trim-sector-ranges

For Solid State Drives (SSDs). EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!! Tells the drive firmware to discard unneeded data sectors, destroying any data that may have been present within them. This makes those sectors available for immediate use by the firmware's garbage collection mechanism, to improve scheduling for wear-leveling of the flash media. This option expects one or more sector range pairs immediately after the option: an LBA starting address, a colon, and a sector count (max 65535), with no intervening spaces. EXCEPTIONALLY DANGEROUS. DO NOT USE THIS OPTION!!

E.g. hdparm --trim-sector-ranges 1000:4 7894:16 /dev/sdz

--trim-sector-ranges-stdin

Identical to --trim-sector-ranges above, except the list of lba:count pairs is read from stdin rather than being specified on the command line. This can be used to avoid problems with excessively long command lines. It also permits batching of many more sector ranges into single commands to the drive, up to the currently configured transfer limit (max_sectors_kb).

-u

Get/set the interrupt-unmask flag for the drive. A setting of 1 permits the driver to unmask other interrupts during processing of a disk interrupt, which greatly improves Linux´s responsiveness and eliminates "serial port overrun" errors. Use this feature with caution: some drive/controller combinations do not tolerate the increased I/O latencies possible when this feature is enabled, resulting in massive filesystem corruption. In particular, CMD-640B and RZ1000 (E)IDE interfaces can be unreliable (due to a hardware flaw) when this option is used with kernel versions earlier than 2.0.13. Disabling the IDE prefetch feature of these interfaces (usually a BIOS/CMOS setting) provides a safe fix for the problem for use with earlier kernels.

-v

Display some basic settings, similar to -acdgkmur for IDE. This is also the default behaviour when no options are specified.

-V

Display program version and exit immediately.

--verbose

Display extra diagnostics from some commands.

-w

Perform a device reset (DANGEROUS). Do NOT use this option. It exists for unlikely situations where a reboot might otherwise be required to get a confused drive back into a useable state.

--write-sector

Writes zeros to the specified sector number. VERY DANGEROUS. The sector number must be given (base10) after this option. hdparm will issue a low-level write (completely bypassing the usual block layer read/write mechanisms) to the specified sector. This can be used to force a drive to repair a bad sector (media error).

-W

Get/set the IDE/SATA drive´s write-caching feature.

-X

Set the IDE transfer mode for (E)IDE/ATA drives. This is typically used in combination with -d1 when enabling DMA to/from a drive on a supported interface chipset, where -X mdma2 is used to select multiword DMA mode2 transfers and -X sdma1 is used to select simple mode 1 DMA transfers. With systems which support UltraDMA burst timings, -X udma2 is used to select UltraDMA mode2 transfers (you´ll need to prepare the chipset for UltraDMA beforehand). Apart from that, use of this option is seldom necessary since most/all modern IDE drives default to their fastest PIO transfer mode at power-on. Fiddling with this can be both needless and risky. On drives which support alternate transfer modes, -X can be used to switch the mode of the drive only. Prior to changing the transfer mode, the IDE interface should be jumpered or programmed (see -p option) for the new mode setting to prevent loss and/or corruption of data. Use this with extreme caution! For the PIO (Programmed Input/Output) transfer modes used by Linux, this value is simply the desired PIO mode number plus 8. Thus, a value of 09 sets PIO mode1, 10 enables PIO mode2, and 11 selects PIO mode3. Setting 00 restores the drive´s "default" PIO mode, and 01 disables IORDY. For multiword DMA, the value used is the desired DMA mode number plus 32. for UltraDMA, the value is the desired UltraDMA mode number plus 64.

-y

Force an IDE drive to immediately enter the low power consumption standby mode, usually causing it to spin down. The current power mode status can be checked using the -C option.

-Y

Force an IDE drive to immediately enter the lowest power consumption sleep mode, causing it to shut down completely. A hard or soft reset is required before the drive can be accessed again (the Linux IDE driver will automatically handle issuing a reset if/when needed). The current power mode status can be checked using the -C option.

-z

Force a kernel re-read of the partition table of the specified device(s).

-Z

Disable the automatic power-saving function of certain Seagate drives (ST3xxx models?), to prevent them from idling/spinning-down at inconvenient times.

## ATA Security Feature Set
These switches are DANGEROUS to experiment with, and might not work with some kernels. USE AT YOUR OWN RISK.

--security-help

Display terse usage info for all of the --security-* options.

--security-freeze

Freeze the drive´s security settings. The drive does not accept any security commands until next power-on reset. Use this function in combination with --security-unlock to protect drive from any attempt to set a new password. Can be used standalone, too. No other options are permitted on the command line with this one.

--security-prompt-for-password

Prompt for the --security PWD rather than getting from the command line args. This avoids having passwords show up in shell history or in /proc/self/cmdline during execution.

--security-unlock PWD

Unlock the drive, using password PWD. Password is given as an ASCII string and is padded with NULs to reach 32 bytes. The applicable drive password is selected with the --user-master switch (default is "user" password). No other options are permitted on the command line with this one.

--security-set-pass PWD

Lock the drive, using password PWD (Set Password) (DANGEROUS). Password is given as an ASCII string and is padded with NULs to reach 32 bytes. Use the special password NULL to set an empty password. The applicable drive password is selected with the --user-master switch (default is "user" password) and the applicable security mode with the --security-mode switch. No other options are permitted on the command line with this one.

--security-disable PWD

Disable drive locking, using password PWD. Password is given as an ASCII string and is padded with NULs to reach 32 bytes. The applicable drive password is selected with the --user-master switch (default is "user" password). No other options are permitted on the command line with this one.

--security-erase PWD

Erase (locked) drive, using password PWD (DANGEROUS). Password is given as an ASCII string and is padded with NULs to reach 32 bytes. Use the special password NULL to represent an empty password. The applicable drive password is selected with the --user-master switch (default is "user" password). No other options are permitted on the command line with this one.

--security-erase-enhanced PWD

Enhanced erase (locked) drive, using password PWD (DANGEROUS). Password is given as an ASCII string and is padded with NULs to reach 32 bytes. The applicable drive password is selected with the --user-master switch (default is "user" password). No other options are permitted on the command line with this one.

--user-master USER

Specifies which password (user/master) to select. Defaults to user password. Only useful in combination with --security-unlock, --security-set-pass, --security-disable, --security-erase or --security-erase-enhanced.

u user password

m master password

--security-mode MODE

Specifies which security mode (high/maximum) to set. Defaults to high. Only useful in combination with --security-set-pass.

h high security

m maximum security THIS FEATURE IS EXPERIMENTAL AND NOT WELL TESTED. USE AT YOUR OWN RISK.

## FILES
/etc/hdparm.conf

## BUGS
As noted above, the -m sectcount and -u 1 options should be used with caution at first, preferably on a read-only filesystem. Most drives work well with these features, but a few drive/controller combinations are not 100% compatible. Filesystem corruption may result. Backup everything before experimenting!

Some options (e.g. -r for SCSI) may not work with old kernels as necessary ioctl()´s were not supported.

Although this utility is intended primarily for use with SATA/IDE hard disk devices, several of the options are also valid (and permitted) for use with SCSI hard disk devices and MFM/RLL hard disks with XT interfaces.

The Linux kernel up until 2.6.12 (and probably later) doesn´t handle the security unlock and disable commands gracefully and will segfault and in some cases even panic. The security commands however might indeed have been executed by the drive. This poor kernel behaviour makes the PIO data security commands rather useless at the moment.

Note that the "security erase" and "security disable" commands have been implemented as two consecutive PIO data commands and will not succeed on a locked drive because the second command will not be issued after the segfault. See the code for hints how patch it to work around this problem. Despite the segfault it is often still possible to run two instances of hdparm consecutively and issue the two necessary commands that way.

## AUTHOR
hdparm has been written by Mark Lord <mlord@pobox.com>, the original primary developer and maintainer of the (E)IDE driver for Linux, and current contributor to the libata subsystem, along with suggestions and patches from many netfolk.

The disable Seagate auto-powersaving code is courtesy of Tomi Leppikangas(tomilepp@paju.oulu.fi).

Security freeze command by Benjamin Benz, 2005.

PIO data out security commands by Leonard den Ottolander, 2005. Some other parts by Benjamin Benz and others.

## SEE ALSO
http://www.t13.org/ Technical Committee T13 AT Attachment (ATA/ATAPI) Interface.

http://www.serialata.org/ Serial ATA International Organization.

http://www.compactflash.org/ CompactFlash Association.


fsck.hfsplus

package: hfsprogs

title: fsck.hfsplus(8)

summary: HFS file system consistency check

text:
# fsck.hfsplus(8)

## NAME
fsck.hfsplus — HFS file system consistency check

## SYNOPSIS
fsck.hfsplus

-q [-df] special ...

fsck.hfsplus

-p [-df] special ...

fsck.hfsplus

[-n | -y | -r] [-dfgxlE] [-D flags] [-b size] [-B path] [-m mode] [-c size] [-R flags] special ...

## DESCRIPTION
The fsck.hfsplus utility verifies and repairs standard HFS and HFS+ file systems.

The first form of fsck.hfsplus quickly checks the specified file systems to determine whether they were cleanly unmounted.

The second form of fsck.hfsplus preens the specified file systems. It is normally started by fsck(8) run from /etc/rc.boot during automatic reboot, when a HFS file system is detected. When preening file systems, fsck.hfsplus will fix common inconsistencies for file systems that were not unmounted cleanly. If more serious problems are found, fsck.hfsplus does not try to fix them, indicates that it was not successful, and exits.

The third form of fsck.hfsplus checks the specified file systems and tries to repair all detected inconsistencies.

If no options are specified fsck.hfsplus will always check and attempt to fix the specified file systems.

The options are as follows:

-c size

Specify the size of the cache used by fsck.hfsplus internally. Bigger size can result in better performance but can result in deadlock when used with -l option. Size can be specified as a decimal, octal, or hexadecimal number. If the number ends with a ``k'', ``m'', or ``g'', the number is multiplied by 1024 (1K), 1048576 (1M), or 1073741824 (1G), respectively.

-d

Display debugging information. This option may provide useful information when fsck.hfsplus cannot repair a damaged file system.

-D flags

Print extra debugging information. The flags are a bitmap that control which kind of debug information is printed. The following values are currently implemented: 0x0001

Informational messages

0x0002

Error messages

0x0010

Extended attributes related messages

0x0020

Overlapped extents related messages

-b size

Specify the size, in bytes, of the physical blocks used by the -B option.

-B path

Print the files containing the physical blocks listed in the file path. The file should contain one or more decimal, octal (with leading 0) or hexadecimal (with leading 0x) numbers separated by white space. The physical block numbers are relative to the start of the partition, so if you have block numbers relative to the start of the device, you will have to subtract the block number of the start of the partition. The size of a physical block is given with the -b option; the default is 512 bytes per block.

-f

When used with the -p option, force fsck.hfsplus to check `clean' file systems, otherwise it means force fsck.hfsplus to check and repair journaled HFS+ file systems.

-g

Causes fsck.hfsplus to generate its output strings in GUI format. This option is used when another application with a graphical user interface (like Mac OS X Disk Utility) is invoking the fsck.hfsplus tool.

-x

Causes fsck.hfsplus to generate its output strings in XML (plist) format. This option implies the -g option.

-l

Lock down the file system and perform a test-only check. This makes it possible to check a file system that is currently mounted, although no repairs can be made.

-m mode

Mode is an octal number that will be used to set the permissions for the lost+found directory when it is created. The lost+found directory is only created when a volume is repaired and orphaned files or directories are detected. fsck.hfsplus places orphaned files and directories into the lost+found directory (located at the root of the volume). The default mode is 01777.

-p

Preen the specified file systems.

-q

Causes fsck.hfsplus to quickly check whether the volume was unmounted cleanly. If the volume was unmounted cleanly, then the exit status is 0. If the volume was not unmounted cleanly, then the exit status will be non-zero. In either case, a message is printed to standard output describing whether the volume was clean or dirty.

-y

Always attempt to repair any damage that is found.

-n

Never attempt to repair any damage that is found.

-E

Cause fsck.hfsplus to exit (with a value of 47) if it encounters any major errors. A ``major error'' is considered one which would impact using the volume in normal usage; an inconsistency which would not impact such use is considered ``minor'' for this option. Only valid with the -n option.

-R flags

Rebuilds the requested btree. The following flags are supported: a

Attribute btree

c

Catalog btree

e

Extents overflow btree

Rebuilding a btree will only work if there is enough free space on the file system for the new btree file, and if fsck.hfsplus is able to traverse each of the nodes in the requested btree successfully. Rebuilding btrees is not supported on HFS Standard volumes.

-r

Rebuild the catalog btree. This is synonymous with -Rc.

Because of inconsistencies between the block device and the buffer cache, the raw device should always be used.

## EXIT VALUES
fsck.hfsplus indicates some status by exit value. The current list of exit status results is:

0

No errors found, or successfully repaired.

3

A quick-check (the -n option) found a dirty filesystem; no repairs were made.

4

During boot, the root filesystem was found to be dirty; repairs were made, and the filesystem was remounted. The system should be rebooted.

8

A corrupt filesystem was found during a check, or repairs did not succeed.

47

A major error was found with -E.

## SEE ALSO
fsck(8)

## BUGS
fsck.hfsplus is not able to fix some inconsistencies that it detects.

## HISTORY
The fsck.hfsplus command appeared in Mac OS X Server 1.0 .


mkfs.hfsplus

title: mkfs.hfsplus(8)

summary: construct a new HFS Plus file system

text:
# mkfs.hfsplus(8)

## NAME
mkfs.hfsplus — construct a new HFS Plus file system

## SYNOPSIS
mkfs.hfsplus

[-N] [-U uid] [-G gid] [-M mask] [-P] [-s] [-b block-size] [-c clump-size-list] [-i first-cnid] [-J [journal-size]] [-n node-size-list] [-v volume-name] special

mkfs.hfsplus

-N partition-size [-U uid] [-G gid] [-M mask] [-P] [-h | -w] [-s] [-b block-size] [-c clump-size-list] [-i first-cnid] [-J [journal-size]] [-n node-size-list] [-v volume-name]

## DESCRIPTION
mkfs.hfsplus builds an HFS Plus file system on the specified special device. Before running mkfs.hfsplus the disk should be partitioned using the Disk Utility application or pdisk(8).

The file system default parameters are calculated based on the size of the disk partition. Typically the defaults are reasonable, however mkfs.hfsplus has several options to allow the defaults to be selectively overridden. The options are as follows:

-N [partition-size]

Causes the file system parameters to be printed out without really creating the file system. If the argument following the -N starts with a decimal digit, it is assumed to be a partition size. The paritition size may be given in decimal, octal (with leading `0'), or hexadecimal (with leading `0x'). The partition size argument can be specified in 512-byte blocks (with a `b' suffix), petabytes (`p' suffix), terabytes (`t' suffix), gigabytes (`g' suffix), megabytes (`m' suffix), or kilobytes (`k' suffix). All suffixes indicate binary, not decimal, multipliers (e.g., `1k' is 1024 bytes). If no suffix is specified, the value is assumed to be in bytes; if an illegal suffix is specified, it results in a size of 0 bytes. If the partition size is given, then no special device argument shall be provided. If no partition size is given, then the size of the given special device is used instead, and the special device will not be written to.

-U uid

Set the owner of the file system's root directory to uid.

-G gid

Set the group of the file system's root directory to gid.

-M mask

Specify the octal access permissions mask for the file system's root directory.

-P

Set kHFSContentProtectionBit in the volume's attributes, which will cause the volume to be mounted with the "protect" option if the kernel supports it.

-s

Creates a case-sensitive HFS Plus filesystem. By default a case-insensitive filesystem is created. Case-sensitive HFS Plus file systems require a Mac OS X version of 10.3 (Darwin 7.0) or later.

-b block-size

The allocation block size of the file system. The default value is 4096.

-c clump-size-list

This specifies the clump and/or initial sizes, in allocation blocks, for the various metadata files. Clump sizes are specified with the -c option followed by a comma separated list of the form arg=blocks. Example: -c c=5000,e=500

a=blocks

Set the attribute file clump size.

b=blocks

Set the allocation bitmap file clump size.

c=blocks

Set the catalog file clump size.

d=blocks

Set the data fork clump size.

e=blocks

Set the extent overflow file clump size.

r=blocks

Set the resource fork clump size.

-i first-cnid

This specifies the initial catalog node ID for user files and directories. The default value is 16.

-J [journal-size]

Creates a journaled HFS+ volume. The default journal size varies, based on the size of the volume. Appending an 'M' to the journal size implies megabytes (i.e. 64M is 64 megabytes). The maximum journal size is 1024 megabytes.

-n node-size-list

This specifies the b-tree node sizes, in bytes, for the various b-tree files. Node sizes are specified with the -n option followed by a comma separated list of the form arg=bytes. The node size must be a power of two and no larger than 32768 bytes. Example: -n c=8192,e=4096

a=bytes

Set the attribute b-tree node size.

c=bytes

Set the catalog b-tree node size.

e=bytes

Set the extent overflow b-tree node size.

-v volume-name

Volume name (file system name) in ascii or UTF-8 format.

## SEE ALSO
mount(8), pdisk(8)

## HISTORY
The mkfs.hfsplus command appeared in Mac OS X Server 1.0 . As of Mac OS X 10.6, this utility no longer generates HFS standard file systems.


hibernate

package: hibernate-script

title: hibernate(8)

text:
# hibernate(8)

## NAME
hibernate - save your computer's state to disk, and then switch it off

## SYNOPSIS
hibernate [OPTION]...

## DESCRIPTION
The hibernate script (or "suspend script") is used to invoke the Linux kernel's Hibernation functionality.

When you hibernate your machine, the contents of your computer's memory will be saved to disc, and your computer will switch off. When you switch it back on again, it will resume exactly as it was when you hibernated. This script is designed for TuxOnIce, which is not yet included in the main kernel tree and must be downloaded from the TuxOnIce web site at http://www.tuxonice.net/, but can also utilise the vanilla kernel interfaces for swsusp or pmdisk (through /proc/acpi/sleep or /sys/power/state). Instructions on setting up the kernel can also be found on that web site.

The hibernate script takes care of the user-space side of the suspend, including unloading and reloading drivers which don't suspend properly, setting the system clock after resuming, taking down and bringing up network interfaces and various other hacks that may be required on some hardware. By default, all it does is restore the system clock after suspending; see hibernate.conf(5) for information on configuring the rest of its functionality.

If the hibernate script is invoked with a name of the form hibernate-foo then it will use the configuration file /etc/hibernate/foo.conf instead of the default.

The hibernate script accepts the following command-line options:

## OPTIONS
-h, --help

Shows this help screen.

--version

Shows the Hibernate Script version.

-f, --force

Ignore errors and suspend anyway.

-k, --kill

Kill processes if needed, in order to suspend.

-v<n>, --verbosity=<n>

Change verbosity level (0 = errors only, 3 = verbose, 4 = debug)

-F<file>, --config-file=<file>

Use the given configuration file instead of the default ()

--dry-run

Don't actually do anything.

-g, --restore-grub

Restores the grub menu to normal (use if a resume was not completed sucessfully) and exits the script. A suspend is not performed.

--lock-console-as <username>

Uses vlock to lock the entire system after resuming, requirng you to enter the password for the given user to unlock it. This overrides any username given in the configuration file. (Requires vlock)

-n, --no-suspend

Disables actually suspending the system. This is useful for testing the hibernate script itself.

-r[0|1], --reboot[=<0|1>] (requires UseTuxOnIce on)

If 0 is specified, disables rebooting after writing the image, regardless of the Reboot option in the configuration file. If 1 or omitted, will force a reboot after writing the image.

--bug-report (requires UseTuxOnIce on)

Gathers a bunch of information about your machine and writes it to standard output. Please attach this information along with any bug reports to the TuxOnIce mailing list.

## EXIT CODES
The exit codes returned by the hibernate script are currently as follows:

0

Hibernation was completed successfully.

2

Hibernation was aborted due to errors from some part of the script. (eg, modules not unloading, devices or filesystems in use).

3

Hibernate script was aborted by user with Ctrl+C. (This does not mean the suspend was aborted by a user by pressing Escape).

4

Hibernation was aborted by a kernel problem (hibernate.log and dmesg should indicate why), or the user aborted the suspend with the Escape key.

## FILES
/etc/hibernate/hibernate.conf

Contains options which influence the hibernate script's behaviour. See hibernate.conf(5) for more information.

/etc/hibernate/scriptlets.d/

/usr/share/hibernate/scriptlets.d/

/usr/local/share/hibernate/scriptlets.d/

These directories contains "scriptlets" that provide functionality when suspending and resuming. See the SCRIPTLET-API file included with the distribution (which can be found in /usr/share/doc/hibernate on Debian systems) for information on how these work.

## BUGS
Probably lots!

If you have problems with the hibernate script or TuxOnIce, the best place to ask is on the mailing list - tuxonice-users@lists.tuxonice.net. You will need to subscribe to post. See http://www.tuxonice.net/lists for details.

If the suspend process itself crashes (while "Writing caches", "Reading caches", or "Copying original kernel back", etc), then the problem lies with TuxOnIce itself. See the FAQ at http://www.tuxonice.net/ for help on debugging.

## AUTHOR
This script was written by Bernard Blackham, with contributions from:

- Carsten Rietzschel (modules, bootsplash and grub scriptlets. many ideas and bugfixes)

- Cameron Patrick (many bugfixes and ideas, man page and Debian packaging)

## SEE ALSO
hibernate.conf(5)


hostapd

package: hostapd

title: hostapd(8)

text:
# hostapd(8)

## NAME
hostapd - IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator

## SYNOPSIS
hostapd [-hdBKtv] [-P <PID file>] <configuration file(s)>

## DESCRIPTION
This manual page documents briefly the hostapd daemon.

hostapd is a user space daemon for access point and authentication servers. It implements IEEE 802.11 access point management, IEEE 802.1X/WPA/WPA2/EAP Authenticators and RADIUS authentication server. The current version supports Linux (Host AP, mac80211-based drivers) and FreeBSD (net80211).

hostapd is designed to be a "daemon" program that runs in the background and acts as the backend component controlling authentication. hostapd supports separate frontend programs and an example text-based frontend, hostapd_cli, is included with hostapd.

## OPTIONS
A summary of options is included below. For a complete description, run hostapd from the command line.

-h

Show usage.

-d

Show more debug messages.

-dd

Show even more debug messages.

-B

Run daemon in the background.

-P <PID file>

Path to PID file.

-K

Include key data in debug messages.

-t

Include timestamps in some debug messages.

-v

Show hostapd version.

## SEE ALSO
hostapd_cli(1).

## AUTHOR
hostapd was written by Jouni Malinen <j@w1.fi>.

This manual page was written by Faidon Liambotis <faidon@cube.gr>, for the Debian project (but may be used by others).


title: hping3(8)

text:
# hping3(8)

## NAME
hping3 - send (almost) arbitrary TCP/IP packets to network hosts

## SYNOPSIS
hping3 [ -hvnqVDzZ012WrfxykQbFSRPAUXYjJBuTG ] [ -c count ] [ -i wait ] [ --fast ] [ -I interface ] [ -9 signature ] [ -a host ] [ -t ttl ] [ -N ip id ] [ -H ip protocol ] [ -g fragoff ] [ -m mtu ] [ -o tos ] [ -C icmp type ] [ -K icmp code ] [ -s source port ] [ -p[+][+] dest port ] [ -w tcp window ] [ -O tcp offset ] [ -M tcp sequence number ] [ -L tcp ack ] [ -d data size ] [ -E filename ] [ -e signature ] [ --icmp-ipver version ] [ --icmp-iphlen length ] [ --icmp-iplen length ] [ --icmp-ipid id ] [ --icmp-ipproto protocol ] [ --icmp-cksum checksum ] [ --icmp-ts ] [ --icmp-addr ] [ --tcpexitcode ] [ --tcp-timestamp ] [ --tr-stop ] [ --tr-keep-ttl ] [ --tr-no-rtt ] [ --rand-dest ] [ --rand-source ] [ --beep ] hostname

## DESCRIPTION
hping3 is a network tool able to send custom TCP/IP packets and to display target replies like ping program does with ICMP replies. hping3 handle fragmentation, arbitrary packets body and size and can be used in order to transfer files encapsulated under supported protocols. Using hping3 you are able to perform at least the following stuff:

- Test firewall rules

- Advanced port scanning

- Test net performance using different protocols,

packet size, TOS (type of service) and fragmentation.

- Path MTU discovery

- Transferring files between even really fascist firewall

rules.

- Traceroute-like under different protocols.

- Firewalk-like usage.

- Remote OS fingerprinting.

- TCP/IP stack auditing.

- A lot of others.

It's also a good didactic tool to learn TCP/IP. hping3 is developed and maintained by antirez@invece.org and is licensed under GPL version 2. Development is open so you can send me patches, suggestion and affronts without inhibitions.

## HPING SITE
primary site at http://www.hping.org. You can found both the stable release and the instruction to download the latest source code at http://www.hping.org/download.html

## BASE OPTIONS
-h --help

Show an help screen on standard output, so you can pipe to less.

-v --version

Show version information and API used to access to data link layer, linux sock packet or libpcap.

-c --count count

Stop after sending (and receiving) count response packets. After last packet was send hping3 wait COUNTREACHED_TIMEOUT seconds target host replies. You are able to tune COUNTREACHED_TIMEOUT editing hping3.h

-i --interval

Wait the specified number of seconds or micro seconds between sending each packet. --interval X set wait to X seconds, --interval uX set wait to X micro seconds. The default is to wait one second between each packet. Using hping3 to transfer files tune this option is really important in order to increase transfer rate. Even using hping3 to perform idle/spoofing scanning you should tune this option, see HPING2-HOWTO for more information.

--fast

Alias for -i u10000. Hping will send 10 packets for second.

--faster

Alias for -i u1. Faster then --fast ;) (but not as fast as your computer can send packets due to the signal-driven design).

--flood

Sent packets as fast as possible, without taking care to show incoming replies. This is ways faster than to specify the -i u0 option.

-n --numeric

Numeric output only, No attempt will be made to lookup symbolic names for host addresses.

-q --quiet

Quiet output. Nothing is displayed except the summary lines at startup time and when finished.

-I --interface interface name

By default on linux and BSD systems hping3 uses default routing interface. In other systems or when there is no default route hping3 uses the first non-loopback interface. However you are able to force hping3 to use the interface you need using this option. Note: you don't need to specify the whole name, for example -I et will match eth0 ethernet0 myet1 et cetera. If no interfaces match hping3 will try to use lo.

-V --verbose

Enable verbose output. TCP replies will be shown as follows: len=46 ip=192.168.1.1 flags=RA DF seq=0 ttl=255 id=0 win=0 rtt=0.4 ms tos=0 iplen=40 seq=0 ack=1380893504 sum=2010 urp=0

-D --debug

Enable debug mode, it's useful when you experience some problem with hping3. When debug mode is enabled you will get more information about interface detection, data link layer access, interface settings, options parsing, fragmentation, HCMP protocol and other stuff.

-z --bind

Bind CTRL+Z to time to live (TTL) so you will able to increment/decrement ttl of outgoing packets pressing CTRL+Z once or twice.

-Z --unbind

Unbind CTRL+Z so you will able to stop hping3.

--beep

Beep for every matching received packet (but not for ICMP errors).

## PROTOCOL SELECTION
Default protocol is TCP, by default hping3 will send tcp headers to target host's port 0 with a winsize of 64 without any tcp flag on. Often this is the best way to do an 'hide ping', useful when target is behind a firewall that drop ICMP. Moreover a tcp null-flag to port 0 has a good probability of not being logged.

-0 --rawip

RAW IP mode, in this mode hping3 will send IP header with data appended with --signature and/or --file, see also --ipproto that allows you to set the ip protocol field.

-1 --icmp

ICMP mode, by default hping3 will send ICMP echo-request, you can set other ICMP type/code using --icmptype --icmpcode options.

-2 --udp

UDP mode, by default hping3 will send udp to target host's port 0. UDP header tunable options are the following: --baseport, --destport, --keep.

-8 --scan

Scan mode, the option expects an argument that describes groups of ports to scan. port groups are comma separated: a number describes just a single port, so 1,2,3 means port 1, 2 and 3. ranges are specified using a start-end notation, like 1-1000, that tell hping to scan ports between 1 and 1000 (included). the special word all is an alias for 0-65535, while the special word known includes all the ports listed in /etc/services.

Groups can be combined, so the following command line will scan ports between 1 and 1000 AND port 8888 AND ports listed in /etc/services: hping --scan 1-1000,8888,known -S target.host.com

Groups can be negated (subtracted) using a ! character as prefix, so the following command line will scan all the ports NOT listed in /etc/services in the range 1-1024: hping --scan '1-1024,!known' -S target.host.com

Keep in mind that while hping seems much more like a port scanner in this mode, most of the hping switches are still honored, so for example to perform a SYN scan you need to specify the -S option, you can change the TCP windows size, TTL, control the IP fragmentation as usually, and so on. The only real difference is that the standard hping behaviors are encapsulated into a scanning algorithm.

Tech note: The scan mode uses a two-processes design, with shared memory for synchronization. The scanning algorithm is still not optimal, but already quite fast.

Hint: unlike most scanners, hping shows some interesting info about received packets, the IP ID, TCP win, TTL, and so on, don't forget to look at this additional information when you perform a scan! Sometimes they shows interesting details.

-9 --listen signature

HPING3 listen mode, using this option hping3 waits for packet that contain signature and dump from signature end to packet's end. For example if hping3 --listen TEST reads a packet that contain 234-09sdflkjs45-TESThello_world it will display hello_world.

## IP RELATED OPTIONS
-a --spoof hostname

Use this option in order to set a fake IP source address, this option ensures that target will not gain your real address. However replies will be sent to spoofed address, so you will can't see them. In order to see how it's possible to perform spoofed/idle scanning see the HPING2-HOWTO.

--rand-source

This option enables the random source mode. hping will send packets with random source address. It is interesting to use this option to stress firewall state tables, and other per-ip basis dynamic tables inside the TCP/IP stacks and firewall software.

--rand-dest

This option enables the random destination mode. hping will send the packets to random addresses obtained following the rule you specify as the target host. You need to specify a numerical IP address as target host like 10.0.0.x. All the occurrences of x will be replaced with a random number in the range 0-255. So to obtain Internet IP addresses in the whole IPv4 space use something like hping x.x.x.x --rand-dest. If you are not sure about what kind of addresses your rule is generating try to use the --debug switch to display every new destination address generated. When this option is turned on, matching packets will be accept from all the destinations.

Warning: when this option is enabled hping can't detect the right outgoing interface for the packets, so you should use the --interface option to select the desired outgoing interface.

-t --ttl time to live

Using this option you can set TTL (time to live) of outgoing packets, it's likely that you will use this with --traceroute or --bind options. If in doubt try `hping3 some.host.com -t 1 --traceroute'.

-N --id

Set ip->id field. Default id is random but if fragmentation is turned on and id isn't specified it will be getpid() & 0xFF, to implement a better solution is in TODO list.

-H --ipproto

Set the ip protocol in RAW IP mode.

-W --winid

id from Windows* systems before Win2k has different byte ordering, if this option is enable hping3 will properly display id replies from those Windows.

-r --rel

Display id increments instead of id. See the HPING2-HOWTO for more information. Increments aren't computed as id[N]-id[N-1] but using packet loss compensation. See relid.c for more information.

-f --frag

Split packets in more fragments, this may be useful in order to test IP stacks fragmentation performance and to test if some packet filter is so weak that can be passed using tiny fragments (anachronistic). Default 'virtual mtu' is 16 bytes. see also --mtu option.

-x --morefrag

Set more fragments IP flag, use this option if you want that target host send an ICMP time-exceeded during reassembly.

-y --dontfrag

Set don't fragment IP flag, this can be used to perform MTU path discovery.

-g --fragoff fragment offset value

Set the fragment offset.

-m --mtu mtu value

Set different 'virtual mtu' than 16 when fragmentation is enabled. If packets size is greater that 'virtual mtu' fragmentation is automatically turned on.

-o --tos hex_tos

Set Type Of Service (TOS), for more information try --tos help.

-G --rroute

Record route. Includes the RECORD_ROUTE option in each packet sent and displays the route buffer of returned packets. Note that the IP header is only large enough for nine such routes. Many hosts ignore or discard this option. Also note that using hping you are able to use record route even if target host filter ICMP. Record route is an IP option, not an ICMP option, so you can use record route option even in TCP and UDP mode.

## ICMP RELATED OPTIONS
-C --icmptype type

Set icmp type, default is ICMP echo request (implies --icmp).

-K --icmpcode code

Set icmp code, default is 0 (implies --icmp).

--icmp-ipver

Set IP version of IP header contained into ICMP data, default is 4.

--icmp-iphlen

Set IP header length of IP header contained into ICMP data, default is 5 (5 words of 32 bits).

--icmp-iplen

Set IP packet length of IP header contained into ICMP data, default is the real length.

--icmp-ipid

Set IP id of IP header contained into ICMP data, default is random.

--icmp-ipproto

Set IP protocol of IP header contained into ICMP data, default is TCP.

--icmp-cksum

Set ICMP checksum, for default is the valid checksum.

--icmp-ts

Alias for --icmptype 13 (to send ICMP timestamp requests).

--icmp-addr

Alias for --icmptype 17 (to send ICMP address mask requests).

## TCP/UDP RELATED OPTIONS
-s --baseport source port

hping3 uses source port in order to guess replies sequence number. It starts with a base source port number, and increase this number for each packet sent. When packet is received sequence number can be computed as replies.dest.port - base.source.port. Default base source port is random, using this option you are able to set different number. If you need that source port not be increased for each sent packet use the -k --keep option.

-p --destport [+][+]dest port

Set destination port, default is 0. If '+' character precedes dest port number (i.e. +1024) destination port will be increased for each reply received. If double '+' precedes dest port number (i.e. ++1024), destination port will be increased for each packet sent. By default destination port can be modified interactively using CTRL+z.

--keep

keep still source port, see --baseport for more information.

-w --win

Set TCP window size. Default is 64.

-O --tcpoff

Set fake tcp data offset. Normal data offset is tcphdrlen / 4.

-M --tcpseq

Set the TCP sequence number.

-L --tcpack

Set the TCP ack.

-Q --seqnum

This option can be used in order to collect sequence numbers generated by target host. This can be useful when you need to analyze whether TCP sequence number is predictable. Output example: #hping3 win98 --seqnum -p 139 -S -i u1 -I eth0

```
HPING uaz (eth0 192.168.4.41): S set, 40 headers + 0 data bytes
2361294848 +2361294848
2411626496 +50331648
2545844224 +134217728
2713616384 +167772160
2881388544 +167772160
3049160704 +167772160
3216932864 +167772160
3384705024 +167772160
3552477184 +167772160
3720249344 +167772160
3888021504 +167772160
4055793664 +167772160
4223565824 +167772160
```

The first column reports the sequence number, the second difference between current and last sequence number. As you can see target host's sequence numbers are predictable.

-b --badcksum

Send packets with a bad UDP/TCP checksum.

--tcp-timestamp

Enable the TCP timestamp option, and try to guess the timestamp update frequency and the remote system uptime.

-F --fin

Set FIN tcp flag.

-S --syn

Set SYN tcp flag.

-R --rst

Set RST tcp flag.

-P --push

Set PUSH tcp flag.

-A --ack

Set ACK tcp flag.

-U --urg

Set URG tcp flag.

-X --xmas

Set Xmas tcp flag.

-Y --ymas

Set Ymas tcp flag.

## COMMON OPTIONS
-d --data data size

Set packet body size. Warning, using --data 40 hping3 will not generate 0 byte packets but protocol_header+40 bytes. hping3 will display packet size information as first line output, like this: HPING www.yahoo.com (ppp0 204.71.200.67): NO FLAGS are set, 40 headers + 40 data bytes

-E --file filename

Use filename contents to fill packet's data.

-e --sign signature

Fill first signature length bytes of data with signature. If the signature length is bigger than data size an error message will be displayed. If you don't specify the data size hping will use the signature size as data size. This option can be used safely with --file filename option, remainder data space will be filled using filename.

-j --dump

Dump received packets in hex.

-J --print

Dump received packets' printable characters.

-B --safe

Enable safe protocol, using this option lost packets in file transfers will be resent. For example in order to send file /etc/passwd from host A to host B you may use the following:

```
[host_a]
# hping3 host_b --udp -p 53 -d 100 --sign signature --safe --file /etc/passwd
[host_b]
# hping3 host_a --listen signature --safe --icmp
```

-u --end

If you are using --file filename option, tell you when EOF has been reached. Moreover prevent that other end accept more packets. Please, for more information see the HPING2-HOWTO.

-T --traceroute

Traceroute mode. Using this option hping3 will increase ttl for each ICMP time to live 0 during transit received. Try hping3 host --traceroute. This option implies --bind and --ttl 1. You can override the ttl of 1 using the --ttl option. Since 2.0.0 stable it prints RTT information.

--tr-keep-ttl

Keep the TTL fixed in traceroute mode, so you can monitor just one hop in the route. For example, to monitor how the 5th hop changes or how its RTT changes you can try hping3 host --traceroute --ttl 5 --tr-keep-ttl.

--tr-stop

If this option is specified hping will exit once the first packet that isn't an ICMP time exceeded is received. This better emulates the traceroute behavior.

--tr-no-rtt

Don't show RTT information in traceroute mode. The ICMP time exceeded RTT information aren't even calculated if this option is set.

--tcpexitcode

Exit with last received packet tcp->th_flag as exit code. Useful for scripts that need, for example, to known if the port 999 of some host reply with SYN/ACK or with RST in response to SYN, i.e. the service is up or down.

## TCP OUTPUT FORMAT
The standard TCP output format is the following:

len=46 ip=192.168.1.1 flags=RA DF seq=0 ttl=255 id=0 win=0 rtt=0.4 ms

len is the size, in bytes, of the data captured from the data link layer excluding the data link header size. This may not match the IP datagram size due to low level transport layer padding.

ip is the source ip address.

flags are the TCP flags, R for RESET, S for SYN, A for ACK, F for FIN, P for PUSH, U for URGENT, X for not standard 0x40, Y for not standard 0x80.

If the reply contains DF the IP header has the don't fragment bit set.

seq is the sequence number of the packet, obtained using the source port for TCP/UDP packets, the sequence field for ICMP packets.

id is the IP ID field.

win is the TCP window size.

rtt is the round trip time in milliseconds.

If you run hping using the -V command line switch it will display additional information about the packet, example:

len=46 ip=192.168.1.1 flags=RA DF seq=0 ttl=255 id=0 win=0 rtt=0.4 ms tos=0 iplen=40 seq=0 ack=1223672061 sum=e61d urp=0

tos is the type of service field of the IP header.

iplen is the IP total len field.

seq and ack are the sequence and acknowledge 32bit numbers in the TCP header.

sum is the TCP header checksum value.

urp is the TCP urgent pointer value.

## UDP OUTPUT FORMAT
The standard output format is:

len=46 ip=192.168.1.1 seq=0 ttl=64 id=0 rtt=6.0 ms

The field meaning is just the same as the TCP output meaning of the same fields.

## ICMP OUTPUT FORMAT
An example of ICMP output is:

ICMP Port Unreachable from ip=192.168.1.1 name=nano.marmoc.net

It is very simple to understand. It starts with the string "ICMP" followed by the description of the ICMP error, Port Unreachable in the example. The ip field is the IP source address of the IP datagram containing the ICMP error, the name field is just the numerical address resolved to a name (a dns PTR request) or UNKNOWN if the resolution failed.

The ICMP Time exceeded during transit or reassembly format is a bit different:

TTL 0 during transit from ip=192.168.1.1 name=nano.marmoc.net

TTL 0 during reassembly from ip=192.70.106.25 name=UNKNOWN

The only difference is the description of the error, it starts with TTL 0.

## AUTHOR
Salvatore Sanfilippo <antirez@invece.org>, with the help of the people mentioned in AUTHORS file and at http://www.hping.org/authors.html

## BUGS
Even using the --end and --safe options to transfer files the final packet will be padded with 0x00 bytes.

Data is read without care about alignment, but alignment is enforced in the data structures. This will not be a problem under i386 but, while usually the TCP/IP headers are naturally aligned, may create problems with different processors and bogus packets if there is some unaligned access around the code (hopefully none).

On solaris hping does not work on the loopback interface. This seems a solaris problem, as stated in the tcpdump-workers mailing list, so the libpcap can't do nothing to handle it properly.

## SEE ALSO
ping(8), traceroute(8), ifconfig(8), nmap(1)


hpsahba

package: hpsahba

title: hpsahba(8)

text:
# hpsahba(8)

## NAME
hpsahba - tool to enable/disable HBA mode on some HP Smart Array controllers.

## SYNOPSIS
•

hpsahba -h

•

hpsahba -v

•

hpsahba -i /dev/sgN

•

hpsahba -E /dev/sgN

•

hpsahba -d /dev/sgN

## DESCRIPTION
CAUTION: This tool will destroy your data and may damage your hardware!

hpsahba is able to enable or disable HBA mode on some HP Smart Array controllers on which regular tools, like `ssacli', reports HBA mode as not supported.

When enabling or disabling HBA mode, RAID controller changes its internal configuration immediately, without requiring reboot. Any existing data may be lost after changing the HBA mode, so be extremely careful.

Some servers may not be able to boot from disks attached to controller in HBA mode. Move the /boot partition and the bootloader out of disks attached to controller onto USB flash driver or SD card to circumvent this limitation.

When HBA mode is enabled, controller usually prints some diagnostic message during boot, like “Hardware RAID support is disabled via controller NVRAM configuration settings” (example from P410i). Attempts to configure RAID arrays in this mode are expected to fail.

### Options
•

hpsahba -h

Show help message and exit.

•

hpsahba -v

Show version and exit.

•

hpsahba -i DEVICE_PATH

Show some information about device. This Includes HBA mode support bit (supported/not supported) and current state of HBA mode (enabled/disabled). It is recommended to run this before trying to enable or disable HBA mode.

•

hpsahba -E DEVICE_PATH

Enable HBA mode.

•

hpsahba -d DEVICE_PATH

Disable HBA mode.

### Kernel driver support
hpsahba itself is able to work on any modern Linux system.

However, to get system actually see and use disks in HBA mode, few kernel patches required: <https://github.com/im-0/hpsahba/tree/master/kernel>.

This functionality is disabled by default. To enable, load module hpsa with parameter hpsa_use_nvram_hba_flag set to “1”. Or set it in the kernel command line: “hpsa.hpsa_use_nvram_hba_flag=1”.

Patchset changelog:

•

V1 -> V2:

•

Device visibility change properly detected if device is both updated and masked/unmasked in the same time.

This will never be upstreamed and officially supported (for P410), see the email from Don Brace: <https://lkml.org/lkml/2018/12/17/618>. So use at your own risk.

You can use DKMS package in <https://github.com/im-0/hpsahba/tree/master/contrib/dkms> to patch hpsa driver in a compiled kernel.

### Supported hardware
Tested on following hardware so far:

•

HP Smart Array P410i (PCI ID: 103c:3245, board ID: 0x3245103c, firmware: 6.64)

•

HP Smart Array P812 (PCI ID: 103c:3249, board ID: 0x3249103c, firmware: 6.64)

•

Hewlett-Packard Company Smart Array G6 controllers / P410 (PCI ID: 103c:323a, board ID: 0x3243103c, firmware: 6.64)

•

Hewlett-Packard Company Smart Array G6 controllers / P212 (PCI ID: 103c:323a, board ID: 0x3241103c, firmware: 6.64)

(open an issue or a pull request if you successfully used this tool on other controllers)

### Additional links
•

<https://support.hpe.com/hpsc/swd/public/detail?swItemId=MTX_0b76aec489764aea9802a6d27b>

Archive containing saupdate.efi - EFI binary for ia64 architecture which implements the same functionality for P410i. Seems not usable anywhere except of old HP Integrity servers.

## BUGS
See issues on GitHub: <https://github.com/im-0/hpsahba/issues>.

## AUTHOR
hpsahba was written by Ivan Mironov <mironov.ivan@gmail.com>