old-www/LDP/www.debian.org/doc/manuals/debian-reference/ch09.en.html

4221 lines
248 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 9. System tips</title>
<link rel="stylesheet" href="debian-reference.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.en.html" title="Debian Reference">
<link rel="up" href="index.en.html" title="Debian Reference">
<link rel="prev" href="ch08.en.html" title="Chapter 8. I18N and L10N">
<link rel="next" href="ch10.en.html" title="Chapter 10. Data management">
<link rel="preface" href="pr01.en.html" title="Preface">
<link rel="chapter" href="ch01.en.html" title="Chapter 1. GNU/Linux tutorials">
<link rel="chapter" href="ch02.en.html" title="Chapter 2. Debian package management">
<link rel="chapter" href="ch03.en.html" title="Chapter 3. The system initialization">
<link rel="chapter" href="ch04.en.html" title="Chapter 4. Authentication">
<link rel="chapter" href="ch05.en.html" title="Chapter 5. Network setup">
<link rel="chapter" href="ch06.en.html" title="Chapter 6. Network applications">
<link rel="chapter" href="ch07.en.html" title="Chapter 7. The X Window System">
<link rel="chapter" href="ch08.en.html" title="Chapter 8. I18N and L10N">
<link rel="chapter" href="ch09.en.html" title="Chapter 9. System tips">
<link rel="chapter" href="ch10.en.html" title="Chapter 10. Data management">
<link rel="chapter" href="ch11.en.html" title="Chapter 11. Data conversion">
<link rel="chapter" href="ch12.en.html" title="Chapter 12. Programming">
<link rel="appendix" href="apa.en.html" title="Appendix A. Appendix">
<link rel="section" href="ch09.en.html#_the_screen_program" title="9.1. The screen program">
<link rel="section" href="ch09.en.html#_data_recording_and_presentation" title="9.2. Data recording and presentation">
<link rel="section" href="ch09.en.html#_data_storage_tips" title="9.3. Data storage tips">
<link rel="section" href="ch09.en.html#_data_encryption_tips" title="9.4. Data encryption tips">
<link rel="section" href="ch09.en.html#_monitoring_controlling_and_starting_program_activities" title="9.5. Monitoring, controlling, and starting program activities">
<link rel="section" href="ch09.en.html#_system_maintenance_tips" title="9.6. System maintenance tips">
<link rel="section" href="ch09.en.html#_the_kernel" title="9.7. The kernel">
<link rel="section" href="ch09.en.html#_virtualized_system" title="9.8. Virtualized system">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Chapter 9. System tips</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="ch08.en.html"><img src="images/prev.gif" alt="Prev"></a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="ch10.en.html"><img src="images/next.gif" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="_system_tips"></a>Chapter 9. System tips</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="section"><a href="ch09.en.html#_the_screen_program">9.1. The screen program</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_the_use_scenario_for_screen_1">9.1.1. The use scenario for screen(1)</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_key_bindings_for_the_screen_command">9.1.2. Key bindings for the screen command</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_data_recording_and_presentation">9.2. Data recording and presentation</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_the_log_daemon">9.2.1. The log daemon</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_log_analyzer">9.2.2. Log analyzer</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_recording_the_shell_activities_cleanly">9.2.3. Recording the shell activities cleanly</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_customized_display_of_text_data">9.2.4. Customized display of text data</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_customized_display_of_time_and_date">9.2.5. Customized display of time and date</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_colorized_shell_echo">9.2.6. Colorized shell echo</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_colorized_commands">9.2.7. Colorized commands</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_recording_the_editor_activities_for_complex_repeats">9.2.8. Recording the editor activities for complex repeats</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_recording_the_graphic_image_of_an_x_application">9.2.9. Recording the graphic image of an X application</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_recording_changes_in_configuration_files">9.2.10. Recording changes in configuration files</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_data_storage_tips">9.3. Data storage tips</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_disk_space_usage">9.3.1. Disk space usage</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_disk_partition_configuration">9.3.2. Disk partition configuration</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_accessing_partition_using_uuid">9.3.3. Accessing partition using UUID</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_filesystem_configuration">9.3.4. Filesystem configuration</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_filesystem_creation_and_integrity_check">9.3.5. Filesystem creation and integrity check</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_optimization_of_filesystem_by_mount_options">9.3.6. Optimization of filesystem by mount options</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_optimization_of_filesystem_via_superblock">9.3.7. Optimization of filesystem via superblock</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_optimization_of_hard_disk">9.3.8. Optimization of hard disk</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_optimization_of_solid_state_drive">9.3.9. Optimization of solid state drive</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_using_smart_to_predict_hard_disk_failure">9.3.10. Using SMART to predict hard disk failure</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_expansion_of_usable_storage_space_via_lvm">9.3.11. Expansion of usable storage space via LVM</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_expansion_of_usable_storage_space_by_mounting_another_partition">9.3.12. Expansion of usable storage space by mounting another partition</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_expansion_of_usable_storage_space_by_bind_mounting_another_directory">9.3.13. Expansion of usable storage space by bind-mounting another directory</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_expansion_of_usable_storage_space_using_symlink">9.3.14. Expansion of usable storage space using symlink</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_expansion_of_usable_storage_space_using_aufs">9.3.15. Expansion of usable storage space using aufs</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_data_encryption_tips">9.4. Data encryption tips</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_removable_disk_encryption_with_dm_crypt_luks">9.4.1. Removable disk encryption with dm-crypt/LUKS</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_encrypted_swap_partition_with_dm_crypt">9.4.2. Encrypted swap partition with dm-crypt</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_automatically_encrypting_files_with_ecryptfs">9.4.3. Automatically encrypting files with eCryptfs</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_automatically_mounting_ecryptfs">9.4.4. Automatically mounting eCryptfs</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_monitoring_controlling_and_starting_program_activities">9.5. Monitoring, controlling, and starting program activities</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_timing_a_process">9.5.1. Timing a process</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_the_scheduling_priority">9.5.2. The scheduling priority</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_the_ps_command">9.5.3. The ps command</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_the_top_command">9.5.4. The top command</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_listing_files_opened_by_a_process">9.5.5. Listing files opened by a process</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_tracing_program_activities">9.5.6. Tracing program activities</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_identification_of_processes_using_files_or_sockets">9.5.7. Identification of processes using files or sockets</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_repeating_a_command_with_a_constant_interval">9.5.8. Repeating a command with a constant interval</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_repeating_a_command_looping_over_files">9.5.9. Repeating a command looping over files</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_starting_a_program_from_gui">9.5.10. Starting a program from GUI</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_customizing_program_to_be_started">9.5.11. Customizing program to be started</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_killing_a_process">9.5.12. Killing a process</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_scheduling_tasks_once">9.5.13. Scheduling tasks once</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_scheduling_tasks_regularly">9.5.14. Scheduling tasks regularly</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_alt_sysrq_key">9.5.15. Alt-SysRq key</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_system_maintenance_tips">9.6. System maintenance tips</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_who_is_on_the_system">9.6.1. Who is on the system?</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_warning_everyone">9.6.2. Warning everyone</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_hardware_identification">9.6.3. Hardware identification</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_hardware_configuration">9.6.4. Hardware configuration</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_system_and_hardware_time">9.6.5. System and hardware time</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_the_terminal_configuration">9.6.6. The terminal configuration</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_the_sound_infrastructure">9.6.7. The sound infrastructure</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_disabling_the_screen_saver">9.6.8. Disabling the screen saver</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_disabling_beep_sounds">9.6.9. Disabling beep sounds</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_memory_usage">9.6.10. Memory usage</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_system_security_and_integrity_check">9.6.11. System security and integrity check</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_the_kernel">9.7. The kernel</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_linux_kernel_2_6">9.7.1. Linux kernel 2.6</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_kernel_parameters">9.7.2. Kernel parameters</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_kernel_headers">9.7.3. Kernel headers</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_compiling_the_kernel_and_related_modules">9.7.4. Compiling the kernel and related modules</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_compiling_the_kernel_source_debian_kernel_team_recommendation">9.7.5. Compiling the kernel source: Debian Kernel Team recommendation</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_non_free_hardware_drivers">9.7.6. Non-free hardware drivers</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="ch09.en.html#_virtualized_system">9.8. Virtualized system</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="ch09.en.html#_virtualization_tools">9.8.1. Virtualization tools</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_virtualization_work_flow">9.8.2. Virtualization work flow</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_mounting_the_virtual_disk_image_file">9.8.3. Mounting the virtual disk image file</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_chroot_system">9.8.4. Chroot system</a></span></dt>
<dt><span class="section"><a href="ch09.en.html#_multiple_desktop_systems">9.8.5. Multiple desktop systems</a></span></dt>
</dl></dd>
</dl>
</div>
<p>Here, I describe basic tips to configure and manage systems, mostly from the console.</p>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_the_screen_program"></a>9.1. The screen program</h2></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> is a very useful tool for people to access remote sites via unreliable or intermittent connections since it support interrupted network connections.</p>
<div class="table">
<a name="listofprogramstotworkconnections"></a><p class="title"><b>Table 9.1. List of programs to support interrupted network connections</b></p>
<div class="table-contents"><table summary="List of programs to support interrupted network connections" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody><tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/screen" target="_top">
<code class="literal">screen</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=screen" target="_top">http://qa.debian.org/popcon.php?package=screen</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/screen.html" target="_top">952</a></td>
<td align="left">
terminal multiplexer with VT100/ANSI terminal emulation
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_use_scenario_for_screen_1"></a>9.1.1. The use scenario for screen(1)</h3></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> not only allows one terminal window to work with multiple processes, but also allows <span class="strong"><strong>remote shell process to survive interrupted connections</strong></span>. Here is a typical use scenario of <span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span>.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
You login to a remote machine.
</p></li>
<li class="listitem"><p>
You start <code class="literal">screen</code> on a single console.
</p></li>
<li class="listitem"><p>
You execute multiple programs in <code class="literal">screen</code> windows created with <code class="literal">^A c</code> ("Control-A" followed by "c").
</p></li>
<li class="listitem"><p>
You switch among the multiple <code class="literal">screen</code> windows by <code class="literal">^A n</code> ("Control-A" followed by "n").
</p></li>
<li class="listitem"><p>
Suddenly you need to leave your terminal, but you don't want to lose your active work by keeping the connection.
</p></li>
<li class="listitem">
<p>
You may <span class="strong"><strong>detach</strong></span> the <code class="literal">screen</code> session by any methods.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Brutally unplug your network connection
</p></li>
<li class="listitem"><p>
Type <code class="literal">^A d</code> ("Control-A" followed by "d") and manually logging out from the remote connection
</p></li>
<li class="listitem"><p>
Type <code class="literal">^A DD</code> ("Control-A" followed by "DD") to have <code class="literal">screen</code> detach and log you out
</p></li>
</ul></div>
</li>
<li class="listitem"><p>
You log in again to the same remote machine (even from a different terminal).
</p></li>
<li class="listitem"><p>
You start <code class="literal">screen</code> as "<code class="literal">screen -r</code>".
</p></li>
<li class="listitem"><p><code class="literal">screen</code> magically <span class="strong"><strong>reattaches</strong></span> all previous <code class="literal">screen</code> windows with all actively running programs.
</p></li>
</ol></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You can save connection fees with <code class="literal">screen</code> for metered network connections such as dial-up and packet ones, because you can leave a process active while disconnected, and then re-attach it later when you connect again.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_key_bindings_for_the_screen_command"></a>9.1.2. Key bindings for the screen command</h3></div></div></div>
<p>In a <code class="literal">screen</code> session, all keyboard inputs are sent to your current window except for the command keystroke. All <code class="literal">screen</code> command keystrokes are entered by typing <code class="literal">^A</code> ("Control-A") plus a single key [plus any parameters]. Here are important ones to remember.</p>
<div class="table">
<a name="listofkeybindingsforscreen"></a><p class="title"><b>Table 9.2. List of key bindings for screen</b></p>
<div class="table-contents"><table summary="List of key bindings for screen" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
key binding
</th>
<th align="left">
meaning
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">^A ?</code>
</td>
<td align="left">
show a help screen (display key bindings)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A c</code>
</td>
<td align="left">
create a new window and switch to it
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A n</code>
</td>
<td align="left">
go to next window
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A p</code>
</td>
<td align="left">
go to previous window
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A 0</code>
</td>
<td align="left">
go to window number 0
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A 1</code>
</td>
<td align="left">
go to window number 1
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A w</code>
</td>
<td align="left">
show a list of windows
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A a</code>
</td>
<td align="left">
send a Ctrl-A to current window as keyboard input
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A h</code>
</td>
<td align="left">
write a hardcopy of current window to file
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A H</code>
</td>
<td align="left">
begin/end logging current window to file
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A ^X</code>
</td>
<td align="left">
lock the terminal (password protected)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A d</code>
</td>
<td align="left">
detach screen session from the terminal
</td>
</tr>
<tr>
<td align="left">
<code class="literal">^A DD</code>
</td>
<td align="left">
detach screen session and log out
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>See <span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> for details.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_data_recording_and_presentation"></a>9.2. Data recording and presentation</h2></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_log_daemon"></a>9.2.1. The log daemon</h3></div></div></div>
<p>Many programs record their activities under the "<code class="literal">/var/log/</code>" directory.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The kernel log daemon: <span class="citerefentry"><span class="refentrytitle">klogd</span>(8)</span>
</p></li>
<li class="listitem"><p>
The system log daemon: <span class="citerefentry"><span class="refentrytitle">rsyslogd</span>(8)</span>
</p></li>
</ul></div>
<p>See <a class="xref" href="ch03.en.html#_the_system_message" title="3.5.9. The system message">Section 3.5.9, “The system message”</a> and <a class="xref" href="ch03.en.html#_the_kernel_message" title="3.5.10. The kernel message">Section 3.5.10, “The kernel message”</a>.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_log_analyzer"></a>9.2.2. Log analyzer</h3></div></div></div>
<p>Here are notable log analyzers ("<code class="literal">~Gsecurity::log-analyzer</code>" in <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>).</p>
<div class="table">
<a name="listofsystemloganalyzers"></a><p class="title"><b>Table 9.3. List of system log analyzers</b></p>
<div class="table-contents"><table summary="List of system log analyzers" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/logwatch" target="_top">
<code class="literal">logwatch</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=logwatch" target="_top">http://qa.debian.org/popcon.php?package=logwatch</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/logwatch.html" target="_top">2018</a></td>
<td align="left">
log analyzer with nice output written in Perl
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/fail2ban" target="_top">
<code class="literal">fail2ban</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=fail2ban" target="_top">http://qa.debian.org/popcon.php?package=fail2ban</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/f/fail2ban.html" target="_top">414</a></td>
<td align="left">
ban IPs that cause multiple authentication errors
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/analog" target="_top">
<code class="literal">analog</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=analog" target="_top">http://qa.debian.org/popcon.php?package=analog</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/analog.html" target="_top">3187</a></td>
<td align="left">
web server log analyzer
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/awstats" target="_top">
<code class="literal">awstats</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=awstats" target="_top">http://qa.debian.org/popcon.php?package=awstats</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/awstats.html" target="_top">3101</a></td>
<td align="left">
powerful and featureful web server log analyzer
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/sarg" target="_top">
<code class="literal">sarg</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=sarg" target="_top">http://qa.debian.org/popcon.php?package=sarg</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/sarg.html" target="_top">921</a></td>
<td align="left">
squid analysis report generator
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/pflogsumm" target="_top">
<code class="literal">pflogsumm</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=pflogsumm" target="_top">http://qa.debian.org/popcon.php?package=pflogsumm</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/pflogsumm.html" target="_top">133</a></td>
<td align="left">
Postfix log entry summarizer
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/syslog-summary" target="_top">
<code class="literal">syslog-summary</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=syslog-summary" target="_top">http://qa.debian.org/popcon.php?package=syslog-summary</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/syslog-summary.html" target="_top">84</a></td>
<td align="left">
summarize the contents of a syslog log file
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/lire" target="_top">
<code class="literal">lire</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=lire" target="_top">http://qa.debian.org/popcon.php?package=lire</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/lire.html" target="_top">5040</a></td>
<td align="left">
full-featured log analyzer and report generator
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/fwlogwatch" target="_top">
<code class="literal">fwlogwatch</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=fwlogwatch" target="_top">http://qa.debian.org/popcon.php?package=fwlogwatch</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/f/fwlogwatch.html" target="_top">440</a></td>
<td align="left">
firewall log analyzer
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/squidview" target="_top">
<code class="literal">squidview</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=squidview" target="_top">http://qa.debian.org/popcon.php?package=squidview</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/squidview.html" target="_top">193</a></td>
<td align="left">
monitor and analyze squid access.log files
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/visitors" target="_top">
<code class="literal">visitors</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=visitors" target="_top">http://qa.debian.org/popcon.php?package=visitors</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/v/visitors.html" target="_top">293</a></td>
<td align="left">
fast web server log analyzer
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/swatch" target="_top">
<code class="literal">swatch</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=swatch" target="_top">http://qa.debian.org/popcon.php?package=swatch</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/swatch.html" target="_top">112</a></td>
<td align="left">
log file viewer with regexp matching, highlighting, and hooks
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/crm114" target="_top">
<code class="literal">crm114</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=crm114" target="_top">http://qa.debian.org/popcon.php?package=crm114</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/crm114.html" target="_top">1065</a></td>
<td align="left">
Controllable Regex Mutilator and Spam Filter (CRM114)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/icmpinfo" target="_top">
<code class="literal">icmpinfo</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=icmpinfo" target="_top">http://qa.debian.org/popcon.php?package=icmpinfo</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/icmpinfo.html" target="_top">84</a></td>
<td align="left">
interpret ICMP messages
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p><a class="ulink" href="http://crm114.sourceforge.net/" target="_top">CRM114</a> provides language infrastructure to write <span class="strong"><strong>fuzzy</strong></span> filters with the <a class="ulink" href="http://www.laurikari.net/tre/" target="_top">TRE regex library</a>. Its popular use is spam mail filter but it can be used as log analyzer.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_recording_the_shell_activities_cleanly"></a>9.2.3. Recording the shell activities cleanly</h3></div></div></div>
<p>The simple use of <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span> (see <a class="xref" href="ch01.en.html#_recording_the_shell_activities" title="1.4.9. Recording the shell activities">Section 1.4.9, “Recording the shell activities”</a>) to record shell activity produces a file with control characters. This can be avoided by using <span class="citerefentry"><span class="refentrytitle">col</span>(1)</span> as the following.</p>
<pre class="screen">$ script
Script started, file is typescript</pre>
<p>Do whatever … and press <code class="literal">Ctrl-D</code> to exit <code class="literal">script</code>.</p>
<pre class="screen">$ col -bx &lt;typescript &gt;cleanedfile
$ vim cleanedfile</pre>
<p>If you don't have <code class="literal">script</code> (for example, during the boot process in the initramfs), you can use following instead.</p>
<pre class="screen">$ sh -i 2&gt;&amp;1 | tee typescript</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Some <code class="literal">x-terminal-emulator</code> such as <code class="literal">gnome-terminal</code> can record. You may wish to extend line buffer for scrollback.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You may use <span class="citerefentry"><span class="refentrytitle">screen</span>(1)</span> with "<code class="literal">^A H</code>" (see <a class="xref" href="ch09.en.html#_key_bindings_for_the_screen_command" title="9.1.2. Key bindings for the screen command">Section 9.1.2, “Key bindings for the screen command”</a>) to perform recording of console.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You may use <span class="citerefentry"><span class="refentrytitle">emacs</span>(1)</span> with "<code class="literal">M-x shell</code>", "<code class="literal">M-x eshell</code>", or "<code class="literal">M-x term</code>" to perform recording of console. You may later use "<code class="literal">C-x C-w</code>" to write the buffer to a file.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_customized_display_of_text_data"></a>9.2.4. Customized display of text data</h3></div></div></div>
<p>Although pager tools such as <span class="citerefentry"><span class="refentrytitle">more</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span> (see <a class="xref" href="ch01.en.html#_the_pager" title="1.4.5. The pager">Section 1.4.5, “The pager”</a>) and custom tools for highlighting and formatting (see <a class="xref" href="ch11.en.html#_highlighting_and_formatting_plain_text_data" title="11.1.8. Highlighting and formatting plain text data">Section 11.1.8, “Highlighting and formatting plain text data”</a>) can display text data nicely, general purpose editors (see <a class="xref" href="ch01.en.html#_the_text_editor" title="1.4.6. The text editor">Section 1.4.6, “The text editor”</a>) are most versatile and customizable.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>For <span class="citerefentry"><span class="refentrytitle">vim</span>(1)</span> and its pager mode alias <span class="citerefentry"><span class="refentrytitle">view</span>(1)</span>, "<code class="literal">:set hls</code>" enables highlighted search.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_customized_display_of_time_and_date"></a>9.2.5. Customized display of time and date</h3></div></div></div>
<p>The default display format of time and date by the "<code class="literal">ls -l</code>" command depends on the <span class="strong"><strong>locale</strong></span> (see <a class="xref" href="ch01.en.html#_timestamps" title="1.2.6. Timestamps">Section 1.2.6, “Timestamps”</a> for value). The "<code class="literal">$LANG</code>" variable is referred first and it can be overridden by the "<code class="literal">$LC_TIME</code>" variable.</p>
<p>The actual default display format for each locale depends on the version of the standard C library (the <code class="literal">libc6</code> package) used. I.e., different releases of Debian had different defaults.</p>
<p>If you really wish to customize this display format of time and date beyond the <span class="strong"><strong>locale</strong></span>, you should set the <span class="strong"><strong>time style value</strong></span> by the "<code class="literal">--time-style</code>" argument or by the "<code class="literal">$TIME_STYLE</code>" value (see <span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">date</span>(1)</span>, "<code class="literal">info coreutils 'ls invocation'</code>").</p>
<div class="table">
<a name="displayexamplesolcommandforlenny"></a><p class="title"><b>Table 9.4. Display examples of time and date for the "<code class="literal">ls -l</code>" command for <code class="literal">lenny</code></b></p>
<div class="table-contents"><table summary='Display examples of time and date for the "ls -l" command for lenny' border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
time style value
</th>
<th align="left">
locale
</th>
<th align="left">
display of time and date
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">iso</code>
</td>
<td align="left">
<span class="emphasis"><em>any</em></span>
</td>
<td align="left">
<code class="literal">01-19 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">long-iso</code>
</td>
<td align="left">
<span class="emphasis"><em>any</em></span>
</td>
<td align="left">
<code class="literal">2009-01-19 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">full-iso</code>
</td>
<td align="left">
<span class="emphasis"><em>any</em></span>
</td>
<td align="left">
<code class="literal">2009-01-19 00:15:16.000000000 +0900</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">locale</code>
</td>
<td align="left">
<code class="literal">C</code>
</td>
<td align="left">
<code class="literal">Jan 19 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">locale</code>
</td>
<td align="left">
<code class="literal">en_US.UTF-8</code>
</td>
<td align="left">
<code class="literal">2009-01-19 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">locale</code>
</td>
<td align="left">
<code class="literal">es_ES.UTF-8</code>
</td>
<td align="left">
<code class="literal">ene 19 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">+%d.%m.%y %H:%M</code>
</td>
<td align="left">
<span class="emphasis"><em>any</em></span>
</td>
<td align="left">
<code class="literal">19.01.09 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">+%d.%b.%y %H:%M</code>
</td>
<td align="left">
<code class="literal">C</code> or <code class="literal">en_US.UTF-8</code>
</td>
<td align="left">
<code class="literal">19.Jan.09 00:15</code>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">+%d.%b.%y %H:%M</code>
</td>
<td align="left">
<code class="literal">es_ES.UTF-8</code>
</td>
<td align="left">
<code class="literal">19.ene.09 00:15</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You can eliminate typing long option on commandline using command alias, e.g. "<code class="literal">alias ls='ls --time-style=+%d.%m.%y\ %H:%M'</code>" (see <a class="xref" href="ch01.en.html#_command_alias" title="1.5.9. Command alias">Section 1.5.9, “Command alias”</a>).</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><a class="ulink" href="http://en.wikipedia.org/wiki/ISO_8601" target="_top">ISO 8601</a> is followed for these iso-formats.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_colorized_shell_echo"></a>9.2.6. Colorized shell echo</h3></div></div></div>
<p>Shell echo to most modern terminals can be colorized using <a class="ulink" href="http://en.wikipedia.org/wiki/ANSI_escape_code" target="_top">ANSI escape code</a> (see "<code class="literal">/usr/share/doc/xterm/ctlseqs.txt.gz</code>").</p>
<p>For example, try the following</p>
<pre class="screen">$ RED=$(printf "\x1b[31m")
$ NORMAL=$(printf "\x1b[0m")
$ REVERSE=$(printf "\x1b[7m")
$ echo "${RED}RED-TEXT${NORMAL} ${REVERSE}REVERSE-TEXT${NORMAL}"</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_colorized_commands"></a>9.2.7. Colorized commands</h3></div></div></div>
<p>Colorized commands are handy for inspecting their output in the interactive environment. I include the following in my "<code class="literal">~/.bashrc</code>".</p>
<pre class="screen">if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=always'
alias ll='ls --color=always -l'
alias la='ls --color=always -A'
alias less='less -R'
alias ls='ls --color=always'
alias grep='grep --color=always'
alias egrep='egrep --color=always'
alias fgrep='fgrep --color=always'
alias zgrep='zgrep --color=always'
else
alias ll='ls -l'
alias la='ls -A'
fi</pre>
<p>The use of alias limits color effects to the interactive command usage. It has advantage over exporting environment variable "<code class="literal">export GREP_OPTIONS='--color=auto'</code>" since color can be seen under pager programs such as <span class="citerefentry"><span class="refentrytitle">less</span>(1)</span>. If you wish to suppress color when piping to other programs, use "<code class="literal">--color=auto</code>" instead in the above example for "<code class="literal">~/.bashrc</code>".</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You can turn off these colorizing aliases in the interactive environment by invoking shell with "<code class="literal">TERM=dumb bash</code>".</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_recording_the_editor_activities_for_complex_repeats"></a>9.2.8. Recording the editor activities for complex repeats</h3></div></div></div>
<p>You can record the editor activities for complex repeats.</p>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Vim_(text_editor)" target="_top">Vim</a>, as follows.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">qa</code>": start recording typed characters into named register "<code class="literal">a</code>".
</p></li>
<li class="listitem"><p>
… editor activities
</p></li>
<li class="listitem"><p>
"<code class="literal">q</code>": end recording typed characters.
</p></li>
<li class="listitem"><p>
"<code class="literal">@a</code>": execute the contents of register "<code class="literal">a</code>".
</p></li>
</ul></div>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Emacs" target="_top">Emacs</a>, as follows.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">C-x (</code>": start defining a keyboard macro.
</p></li>
<li class="listitem"><p>
… editor activities
</p></li>
<li class="listitem"><p>
"<code class="literal">C-x )</code>": end defining a keyboard macro.
</p></li>
<li class="listitem"><p>
"<code class="literal">C-x e</code>": execute a keyboard macro.
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_recording_the_graphic_image_of_an_x_application"></a>9.2.9. Recording the graphic image of an X application</h3></div></div></div>
<p>There are few ways to record the graphic image of an X application, including an <code class="literal">xterm</code> display.</p>
<div class="table">
<a name="listofgraphicimaanipulationtools"></a><p class="title"><b>Table 9.5. List of graphic image manipulation tools</b></p>
<div class="table-contents"><table summary="List of graphic image manipulation tools" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
command
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/xbase-clients" target="_top">
<code class="literal">xbase-clients</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=xbase-clients" target="_top">http://qa.debian.org/popcon.php?package=xbase-clients</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/x/xbase-clients.html" target="_top">61</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">xwd</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/gimp" target="_top">
<code class="literal">gimp</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=gimp" target="_top">http://qa.debian.org/popcon.php?package=gimp</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/g/gimp.html" target="_top">15168</a></td>
<td align="left">
GUI menu
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/imagemagick" target="_top">
<code class="literal">imagemagick</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=imagemagick" target="_top">http://qa.debian.org/popcon.php?package=imagemagick</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/imagemagick.html" target="_top">207</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">import</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/scrot" target="_top">
<code class="literal">scrot</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=scrot" target="_top">http://qa.debian.org/popcon.php?package=scrot</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/scrot.html" target="_top">80</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">scrot</span>(1)</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_recording_changes_in_configuration_files"></a>9.2.10. Recording changes in configuration files</h3></div></div></div>
<p>There are specialized tools to record changes in configuration files with help of DVCS system.</p>
<div class="table">
<a name="listofpackagestotionhistoryinvcs"></a><p class="title"><b>Table 9.6. List of packages to record configuration history in VCS</b></p>
<div class="table-contents"><table summary="List of packages to record configuration history in VCS" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/etckeeper" target="_top">
<code class="literal">etckeeper</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=etckeeper" target="_top">http://qa.debian.org/popcon.php?package=etckeeper</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/e/etckeeper.html" target="_top">242</a></td>
<td align="left">
store configuration files and their metadata with <a class="ulink" href="http://en.wikipedia.org/wiki/Git_(software)" target="_top">Git</a> (default), <a class="ulink" href="http://en.wikipedia.org/wiki/Mercurial_(software)" target="_top">Mercurial</a>, or <a class="ulink" href="http://en.wikipedia.org/wiki/Bazaar_(software)" target="_top">Bazaar</a> (new)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/changetrack" target="_top">
<code class="literal">changetrack</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=changetrack" target="_top">http://qa.debian.org/popcon.php?package=changetrack</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/changetrack.html" target="_top">148</a></td>
<td align="left">
store configuration files with <a class="ulink" href="http://en.wikipedia.org/wiki/Revision_Control_System" target="_top">RCS</a> (old)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>I recommend to use the <code class="literal">etckeeper</code> package with <span class="citerefentry"><span class="refentrytitle">git</span>(1)</span> which put entire "<code class="literal">/etc</code>" under VCS control. Its installation guide and tutorial are found in "<code class="literal">/usr/share/doc/etckeeper/README.gz</code>".</p>
<p>Essentially, running "<code class="literal">sudo etckeeper init</code>" initializes the git repository for "<code class="literal">/etc</code>" just like the process explained in <a class="xref" href="ch10.en.html#_git_for_recording_configuration_history" title="10.9.5. Git for recording configuration history">Section 10.9.5, “Git for recording configuration history”</a> but with special hook scripts for more thorough setups.</p>
<p>As you change your configuration, you can use <span class="citerefentry"><span class="refentrytitle">git</span>(1)</span> normally to record them. It automatically records changes nicely every time you run package management commands, too.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You can browse the change history of "<code class="literal">/etc</code>" by executing "<code class="literal">sudo GIT_DIR=/etc/.git gitk</code>" with clear view for new installed packages, removed packages, and version changes of packages.</p></td></tr>
</table></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_data_storage_tips"></a>9.3. Data storage tips</h2></div></div></div>
<p>Booting your system with Linux <a class="ulink" href="http://en.wikipedia.org/wiki/Live_CD" target="_top">live CDs</a> or <a class="ulink" href="http://www.debian.org/releases/stable/debian-installer/" target="_top">debian-installer CDs</a> in rescue mode make it easy for you to reconfigure data storage on your boot device. See also <a class="xref" href="ch10.en.html#_the_binary_data" title="10.3. The binary data">Section 10.3, “The binary data”</a>.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_disk_space_usage"></a>9.3.1. Disk space usage</h3></div></div></div>
<p>The disk space usage can be evaluated by programs provided by the <code class="literal">mount</code>, <code class="literal">coreutils</code>, and <code class="literal">xdu</code> packages:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> reports all mounted filesystems (= disks).
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">df</span>(1)</span> reports the disk space usage for the file system.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">du</span>(1)</span> reports the disk space usage for the directory tree.
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You can feed the output of <span class="citerefentry"><span class="refentrytitle">du</span>(8)</span> to <span class="citerefentry"><span class="refentrytitle">xdu</span>(1x)</span> to produce its graphical and interactive presentation with "<code class="literal">du -k . |xdu</code>", "<code class="literal">sudo du -k -x / |xdu</code>", etc.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_disk_partition_configuration"></a>9.3.2. Disk partition configuration</h3></div></div></div>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Disk_partitioning" target="_top">disk partition</a> configuration, although <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span> has been considered standard, <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> deserves some attention. "Disk partitioning data", "partition table", "partition map", and "disk label" are all synonyms.</p>
<p>Most PCs use the classic <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record" target="_top">Master Boot Record (MBR)</a> scheme to hold <a class="ulink" href="http://en.wikipedia.org/wiki/Disk_partitioning" target="_top">disk partitioning</a> data in the first sector, i.e., <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_block_addressing" target="_top">LBA</a> sector 0 (512 bytes).</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Some new PCs with <a class="ulink" href="http://en.wikipedia.org/wiki/Extensible_Firmware_Interface" target="_top">Extensible Firmware Interface (EFI)</a>, including Intel-based Macs, use <a class="ulink" href="http://en.wikipedia.org/wiki/GUID_Partition_Table" target="_top">GUID Partition Table (GPT)</a> scheme to hold <a class="ulink" href="http://en.wikipedia.org/wiki/Disk_partitioning" target="_top">disk partitioning</a> data not in the first sector.</p></td></tr>
</table></div>
<p>Although <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span> has been standard for the disk partitioning tool, <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> is replacing it.</p>
<div class="table">
<a name="listofdiskpartitnagementpackages"></a><p class="title"><b>Table 9.7. List of disk partition management packages</b></p>
<div class="table-contents"><table summary="List of disk partition management packages" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
GPT
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/util-linux" target="_top">
<code class="literal">util-linux</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=util-linux" target="_top">http://qa.debian.org/popcon.php?package=util-linux</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/u/util-linux.html" target="_top">1593</a></td>
<td align="left">
Not supported
</td>
<td align="left">
miscellaneous system utilities including <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">cfdisk</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/parted" target="_top">
<code class="literal">parted</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=parted" target="_top">http://qa.debian.org/popcon.php?package=parted</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/parted.html" target="_top">262</a></td>
<td align="left">
Supported
</td>
<td align="left">
GNU Parted disk partition resizing program
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/gparted" target="_top">
<code class="literal">gparted</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=gparted" target="_top">http://qa.debian.org/popcon.php?package=gparted</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/g/gparted.html" target="_top">5074</a></td>
<td align="left">
Supported
</td>
<td align="left">
GNOME partition editor based on <code class="literal">libparted</code>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/gnu-fdisk" target="_top">
<code class="literal">gnu-fdisk</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=gnu-fdisk" target="_top">http://qa.debian.org/popcon.php?package=gnu-fdisk</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/g/gnu-fdisk.html" target="_top">215</a></td>
<td align="left">
Supported
</td>
<td align="left">
GNU replacements of console <span class="citerefentry"><span class="refentrytitle">fdisk</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">cfdisk</span>(8)</span>, etc.
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/gdisk" target="_top">
<code class="literal">gdisk</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=gdisk" target="_top">http://qa.debian.org/popcon.php?package=gdisk</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/g/gdisk.html" target="_top">636</a></td>
<td align="left">
Supported
</td>
<td align="left">
partition editor for the GPT disk
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/gptsync" target="_top">
<code class="literal">gptsync</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=gptsync" target="_top">http://qa.debian.org/popcon.php?package=gptsync</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/g/gptsync.html" target="_top">72</a></td>
<td align="left">
Supported
</td>
<td align="left">
synchronize classic MBR partition table with the GPT one
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/kpartx" target="_top">
<code class="literal">kpartx</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=kpartx" target="_top">http://qa.debian.org/popcon.php?package=kpartx</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/k/kpartx.html" target="_top">104</a></td>
<td align="left">
Supported
</td>
<td align="left">
program to create device mappings for partitions
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Although <span class="citerefentry"><span class="refentrytitle">parted</span>(8)</span> claims to create and to resize filesystem too, it is safer to do such things using best maintained specialized tools such as <span class="citerefentry"><span class="refentrytitle">mkfs</span>(8)</span> (<span class="citerefentry"><span class="refentrytitle">mkfs.msdos</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkfs.ext2</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkfs.ext3</span>(8)</span>, …) and <span class="citerefentry"><span class="refentrytitle">resize2fs</span>(8)</span>.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>In order to switch between <a class="ulink" href="http://en.wikipedia.org/wiki/GUID_Partition_Table" target="_top">GPT</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record" target="_top">MBR</a>, you need to erase first few blocks of disk contents directly (see <a class="xref" href="ch10.en.html#_clearing_file_contents" title="10.3.6. Clearing file contents">Section 10.3.6, “Clearing file contents”</a>) and use "<code class="literal">parted /dev/sdx mklabel gpt</code>" or "<code class="literal">parted /dev/sdx mklabel msdos</code>" to set it. Please note "<code class="literal">msdos</code>" is use here for <a class="ulink" href="http://en.wikipedia.org/wiki/Master_boot_record" target="_top">MBR</a>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_accessing_partition_using_uuid"></a>9.3.3. Accessing partition using UUID</h3></div></div></div>
<p>Although reconfiguration of your partition or activation order of removable storage media may yield different names for partitions, you can access them consistently. This is also helpful if you have multiple disks and your BIOS doesn't give them consistent device names.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> with "<code class="literal">-U</code>" option can mount a block device using <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier" target="_top">UUID</a>, instead of using its file name such as "<code class="literal">/dev/sda3</code>".
</p></li>
<li class="listitem"><p>
"<code class="literal">/etc/fstab</code>" (see <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span>) can use <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier" target="_top">UUID</a>.
</p></li>
<li class="listitem"><p>
Boot loaders (<a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.3. Stage 2: the boot loader">Section 3.3, “Stage 2: the boot loader”</a>) may use <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier" target="_top">UUID</a> too.
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You can probe <a class="ulink" href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier" target="_top">UUID</a> of a block special device with <span class="citerefentry"><span class="refentrytitle">blkid</span>(8)</span>.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Device nodes of devices such as removable storage media can be made static by using <a class="ulink" href="http://www.reactivated.net/writing_udev_rules.html" target="_top">udev rules</a>, if needed. See <a class="xref" href="ch03.en.html#_the_udev_system" title="3.5.11. The udev system">Section 3.5.11, “The udev system”</a>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_filesystem_configuration"></a>9.3.4. Filesystem configuration</h3></div></div></div>
<p>For <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> filesystem, the <code class="literal">e2fsprogs</code> package provides the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">mkfs.ext3</span>(8)</span> to create new <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> filesystem
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">fsck.ext3</span>(8)</span> to check and to repair existing <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> filesystem
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">tune2fs</span>(8)</span> to configure superblock of <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> filesystem
</p></li>
</ul></div>
<p>The <span class="citerefentry"><span class="refentrytitle">mkfs</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> commands are provided by the <code class="literal">e2fsprogs</code> package as front-ends to various filesystem dependent programs (<code class="literal">mkfs.fstype</code> and <code class="literal">fsck.fstype</code>). For <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> filesystem, they are <span class="citerefentry"><span class="refentrytitle">mkfs.ext3</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">fsck.ext3</span>(8)</span> (they are hardlinked to <span class="citerefentry"><span class="refentrytitle">mke2fs</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">e2fsck</span>(8)</span>).</p>
<p>Similar commands are available for each filesystem supported by Linux.</p>
<div class="table">
<a name="listoffilesystemnagementpackages"></a><p class="title"><b>Table 9.8. List of filesystem management packages</b></p>
<div class="table-contents"><table summary="List of filesystem management packages" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/e2fsprogs" target="_top">
<code class="literal">e2fsprogs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=e2fsprogs" target="_top">http://qa.debian.org/popcon.php?package=e2fsprogs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/e/e2fsprogs.html" target="_top">2233</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext2" target="_top">ext2</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Ext4" target="_top">ext4</a> filesystems
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/reiserfsprogs" target="_top">
<code class="literal">reiserfsprogs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=reiserfsprogs" target="_top">http://qa.debian.org/popcon.php?package=reiserfsprogs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/r/reiserfsprogs.html" target="_top">1200</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Reiserfs" target="_top">Reiserfs</a> filesystem
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/dosfstools" target="_top">
<code class="literal">dosfstools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=dosfstools" target="_top">http://qa.debian.org/popcon.php?package=dosfstools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/dosfstools.html" target="_top">162</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/File_Allocation_Table" target="_top">FAT</a> filesystem. (Microsoft: MS-DOS, Windows)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/xfsprogs" target="_top">
<code class="literal">xfsprogs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=xfsprogs" target="_top">http://qa.debian.org/popcon.php?package=xfsprogs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/x/xfsprogs.html" target="_top">3135</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/XFS" target="_top">XFS</a> filesystem. (SGI: IRIX)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ntfsprogs" target="_top">
<code class="literal">ntfsprogs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ntfsprogs" target="_top">http://qa.debian.org/popcon.php?package=ntfsprogs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/n/ntfsprogs.html" target="_top">41</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/NTFS" target="_top">NTFS</a> filesystem. (Microsoft: Windows NT, …)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/jfsutils" target="_top">
<code class="literal">jfsutils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=jfsutils" target="_top">http://qa.debian.org/popcon.php?package=jfsutils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/j/jfsutils.html" target="_top">1024</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/JFS_(file_system)" target="_top">JFS</a> filesystem. (IBM: AIX, OS/2)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/reiser4progs" target="_top">
<code class="literal">reiser4progs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=reiser4progs" target="_top">http://qa.debian.org/popcon.php?package=reiser4progs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/r/reiser4progs.html" target="_top">1296</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Reiser4" target="_top">Reiser4</a> filesystem
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/hfsprogs" target="_top">
<code class="literal">hfsprogs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=hfsprogs" target="_top">http://qa.debian.org/popcon.php?package=hfsprogs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/h/hfsprogs.html" target="_top">317</a></td>
<td align="left">
utilities for <a class="ulink" href="http://en.wikipedia.org/wiki/Hierarchical_File_System" target="_top">HFS</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/HFS_Plus" target="_top">HFS Plus</a> filesystem. (Apple: Mac OS)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/btrfs-tools" target="_top">
<code class="literal">btrfs-tools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=btrfs-tools" target="_top">http://qa.debian.org/popcon.php?package=btrfs-tools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/btrfs-tools.html" target="_top">2061</a></td>
<td align="left">
utilities for the <a class="ulink" href="http://en.wikipedia.org/wiki/Btrfs" target="_top">Btrfs</a> filesystem
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/zerofree" target="_top">
<code class="literal">zerofree</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=zerofree" target="_top">http://qa.debian.org/popcon.php?package=zerofree</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/z/zerofree.html" target="_top">47</a></td>
<td align="left">
program to zero free blocks from ext2/3 filesystems
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><a class="ulink" href="http://en.wikipedia.org/wiki/Ext4" target="_top">Ext4</a> filesystem is the default filesystem for the Linux system and strongly recommended to use it unless you have some specific reasons not to.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><a class="ulink" href="http://en.wikipedia.org/wiki/Btrfs" target="_top">Btrfs</a> filesystem is available in Linux kernel 3.2 (Debian <code class="literal">wheezy</code>). It is expected to be the next default filesystem after the ext4 filesystem.</p></td></tr>
</table></div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>You should not use the Btrfs filesystem for your critical data yet before it aquires the live kernel space <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> feature and the boot loader support.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Some tools allow access to filesystem without Linux kernel support (see <a class="xref" href="ch10.en.html#_manipulating_files_without_mounting_disk" title="10.3.2. Manipulating files without mounting disk">Section 10.3.2, “Manipulating files without mounting disk”</a>).</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_filesystem_creation_and_integrity_check"></a>9.3.5. Filesystem creation and integrity check</h3></div></div></div>
<p>The <span class="citerefentry"><span class="refentrytitle">mkfs</span>(8)</span> command creates the filesystem on a Linux system. The <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> command provides the filesystem integrity check and repair on a Linux system.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>It is generally not safe to run <code class="literal">fsck</code> on <span class="strong"><strong>mounted filesystems</strong></span>.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Check files in "<code class="literal">/var/log/fsck/</code>" for the result of the <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> command run from the boot script.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Use "<code class="literal">shutdown -F -r now</code>" to force to run the <span class="citerefentry"><span class="refentrytitle">fsck</span>(8)</span> command safely on all filesystems including root filesystem on reboot. See the <span class="citerefentry"><span class="refentrytitle">shutdown</span>(8)</span> manpage for more.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_optimization_of_filesystem_by_mount_options"></a>9.3.6. Optimization of filesystem by mount options</h3></div></div></div>
<p>Performance and characteristics of a filesystem can be optimized by mount options used on it (see <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span> and <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span>). Notable ones are the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
"<code class="literal">defaults</code>" option implies default options: "<code class="literal">rw,suid,dev,exec,auto,nouser,async</code>". (general)
</p></li>
<li class="listitem"><p>
"<code class="literal">noatime</code>" or "<code class="literal">relatime</code>" option is very effective for speeding up the read access. (general)
</p></li>
<li class="listitem"><p>
"<code class="literal">user</code>" option allows an ordinary user to mount the filesystem. This option implies "<code class="literal">noexec,nosuid,nodev</code>" option combination. (general, used for CD and floppy)
</p></li>
<li class="listitem"><p>
"<code class="literal">noexec,nodev,nosuid</code>" option combination is used to enhance security. (general)
</p></li>
<li class="listitem"><p>
"<code class="literal">noauto</code>" option limits mounting by explicit operation only. (general)
</p></li>
<li class="listitem"><p>
"<code class="literal">data=journal</code>" option for ext3fs can enhance data integrity against power failure with some loss of write speed.
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You need to provide kernel boot parameter (see <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.3. Stage 2: the boot loader">Section 3.3, “Stage 2: the boot loader”</a>), e.g. "<code class="literal">rootflags=data=journal</code>" to deploy a non-default journaling mode for the root filesystem. For <code class="literal">lenny</code>, the default jounaling mode is "<code class="literal">rootflags=data=ordered</code>". For <code class="literal">squeeze</code>, it is "<code class="literal">rootflags=data=writeback</code>".</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_optimization_of_filesystem_via_superblock"></a>9.3.7. Optimization of filesystem via superblock</h3></div></div></div>
<p>Characteristics of a filesystem can be optimized via its superblock using the <span class="citerefentry"><span class="refentrytitle">tune2fs</span>(8)</span> command.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Execution of "<code class="literal">sudo tune2fs -l /dev/hda1</code>" displays the contents of the filesystem superblock on "<code class="literal">/dev/hda1</code>".
</p></li>
<li class="listitem"><p>
Execution of "<code class="literal">sudo tune2fs -c 50 /dev/hda1</code>" changes frequency of filesystem checks (<code class="literal">fsck</code> execution during boot-up) to every 50 boots on "<code class="literal">/dev/hda1</code>".
</p></li>
<li class="listitem"><p>
Execution of "<code class="literal">sudo tune2fs -j /dev/hda1</code>" adds journaling capability to the filesystem, i.e. filesystem conversion from <a class="ulink" href="http://en.wikipedia.org/wiki/Ext2" target="_top">ext2</a> to <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> on "<code class="literal">/dev/hda1</code>". (Do this on the unmounted filesystem.)
</p></li>
<li class="listitem"><p>
Execution of "<code class="literal">sudo tune2fs -O extents,uninit_bg,dir_index /dev/hda1 &amp;&amp; fsck -pf /dev/hda1</code>" converts it from <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> to <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4" target="_top">ext4</a> on "<code class="literal">/dev/hda1</code>". (Do this on the unmounted filesystem.)
</p></li>
</ul></div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Filesystem conversion for the boot device to the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4" target="_top">ext4</a> filesystem should be avoided until <a class="ulink" href="http://bugs.debian.org/511121" target="_top">GRUB boot loader supports the ext4 filesystem well</a> and installed Linux Kernel version is newer than 2.6.30.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Despite its name, <span class="citerefentry"><span class="refentrytitle">tune2fs</span>(8)</span> works not only on the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext2" target="_top">ext2</a> filesystem but also on the <a class="ulink" href="http://en.wikipedia.org/wiki/Ext3" target="_top">ext3</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Ext4" target="_top">ext4</a> filesystems.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_optimization_of_hard_disk"></a>9.3.8. Optimization of hard disk</h3></div></div></div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Please check your hardware and read manpage of <span class="citerefentry"><span class="refentrytitle">hdparam</span>(8)</span> before playing with hard disk configuration because this may be quite dangerous for the data integrity.</p></td></tr>
</table></div>
<p>You can test disk access speed of a hard disk, e.g. "<code class="literal">/dev/hda</code>", by "<code class="literal">hdparm -tT /dev/hda</code>". For some hard disk connected with (E)IDE, you can speed it up with "<code class="literal">hdparm -q -c3 -d1 -u1 -m16 /dev/hda</code>" by enabling the "(E)IDE 32-bit I/O support", enabling the "using_dma flag", setting "interrupt-unmask flag", and setting the "multiple 16 sector I/O" (dangerous!).</p>
<p>You can test write cache feature of a hard disk, e.g. "<code class="literal">/dev/sda</code>", by "<code class="literal">hdparm -W /dev/sda</code>". You can disable its write cache feature with "<code class="literal">hdparm -W 0 /dev/sda</code>".</p>
<p>You may be able to read badly pressed CDROMs on modern high speed CD-ROM drive by slowing it down with "<code class="literal">setcd -x 2</code>".</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_optimization_of_solid_state_drive"></a>9.3.9. Optimization of solid state drive</h3></div></div></div>
<p>Performance and disk wear of the <a class="ulink" href="http://en.wikipedia.org/wiki/Solid-state_drive" target="_top">solid state drive (SSD)</a> can be optimized as follows.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Use the latest Linux kernel. (&gt;= 3.2)
</p></li>
<li class="listitem">
<p>
Reduce disk writes for read disk accesses.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Set "<code class="literal">noatime</code>" or "<code class="literal">relatime</code>" mount option in <code class="literal">/etc/fstab</code>.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
Enable the <a class="ulink" href="http://en.wikipedia.org/wiki/TRIM" target="_top">TRIM</a> command.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
Set "<code class="literal">discard</code>" mount option in <code class="literal">/etc/fstab</code> for the ext4 filesystem, swap partition, Btrfs, etc. See <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span>.
</p></li>
<li class="listitem"><p>
Set "<code class="literal">discard</code>" option in <code class="literal">/etc/lvm/lvm.conf</code> for <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)" target="_top">LVM</a>. See <span class="citerefentry"><span class="refentrytitle">lvm.conf</span>(5)</span>.
</p></li>
<li class="listitem"><p>
Set "<code class="literal">discard</code>" option in <code class="literal">/etc/crypttab</code> for <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a>. See <span class="citerefentry"><span class="refentrytitle">crypttab</span>(5)</span>.
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Enable the SSD optimized disk space allocation scheme.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Set "<code class="literal">ssd</code>" mount option in <code class="literal">/etc/fstab</code> for the Btrfs.
</p></li></ul></div>
</li>
<li class="listitem">
<p>
Make system flush data to the disk every 10 minutes for laptop PCs.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
Set "<code class="literal">commit=600</code>" mount option in <code class="literal">/etc/fstab</code>. See <span class="citerefentry"><span class="refentrytitle">fstab</span>(5)</span>.
</p></li>
<li class="listitem"><p>
Set pm-utils to use laptop-mode even under AC operation. See <a class="ulink" href="http://bugs.debian.org/659260" target="_top">Debian BTS #659260</a>.
</p></li>
</ul></div>
</li>
</ul></div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Changing flushing interval from normal 5 seconds to 10 minutes makes your data venerable to the power failure.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_using_smart_to_predict_hard_disk_failure"></a>9.3.10. Using SMART to predict hard disk failure</h3></div></div></div>
<p>You can monitor and log your hard disk which is compliant to <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T." target="_top">SMART</a> with the <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Enable <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T." target="_top">SMART</a> feature in <a class="ulink" href="http://en.wikipedia.org/wiki/BIOS" target="_top">BIOS</a>.
</p></li>
<li class="listitem"><p>
Install the <code class="literal">smartmontools</code> package.
</p></li>
<li class="listitem">
<p>
Identify your hard disk drives by listing them with <span class="citerefentry"><span class="refentrytitle">df</span>(1)</span>.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Let's assume a hard disk drive to be monitored as "<code class="literal">/dev/hda</code>".
</p></li></ul></div>
</li>
<li class="listitem">
<p>
Check the output of "<code class="literal">smartctl -a /dev/hda</code>" to see if <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T." target="_top">SMART</a> feature is actually enabled.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
If not, enable it by "<code class="literal">smartctl -s on -a /dev/hda</code>".
</p></li></ul></div>
</li>
<li class="listitem">
<p>
Enable <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon to run by the following.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
uncomment "<code class="literal">start_smartd=yes</code>" in the "<code class="literal">/etc/default/smartmontools</code>" file.
</p></li>
<li class="listitem"><p>
restart the <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon by "<code class="literal">sudo /etc/init.d/smartmontools restart</code>".
</p></li>
</ul></div>
</li>
</ol></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The <span class="citerefentry"><span class="refentrytitle">smartd</span>(8)</span> daemon can be customized with the <code class="literal">/etc/smartd.conf</code> file including how to be notified of warnings.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_expansion_of_usable_storage_space_via_lvm"></a>9.3.11. Expansion of usable storage space via LVM</h3></div></div></div>
<p>For partitions created on <a class="ulink" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)" target="_top">Logical Volume Manager (LVM)</a> (Linux feature) at install time, they can be resized easily by concatenating extents onto them or truncating extents from them over multiple storage devices without major system reconfiguration.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Deployment of the current LVM system may degrade guarantee against filesystem corruption offered by journaled filesystems such as ext3fs unless their system performance is sacrificed by disabling write cache of hard disk.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_expansion_of_usable_storage_space_by_mounting_another_partition"></a>9.3.12. Expansion of usable storage space by mounting another partition</h3></div></div></div>
<p>If you have an empty partition (e.g., "<code class="literal">/dev/sdx</code>"), you can format it with <span class="citerefentry"><span class="refentrytitle">mkfs.ext3</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> it to a directory where you need more space. (You need to copy original data contents.)</p>
<pre class="screen">$ sudo mv work-dir old-dir
$ sudo mkfs.ext3 /dev/sdx
$ sudo mount -t ext3 /dev/sdx work-dir
$ sudo cp -a old-dir/* work-dir
$ sudo rm -rf old-dir</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You may alternatively mount an empty disk image file (see <a class="xref" href="ch10.en.html#_making_the_empty_disk_image_file" title="10.2.5. Making the empty disk image file">Section 10.2.5, “Making the empty disk image file”</a>) as a loop device (see <a class="xref" href="ch10.en.html#_mounting_the_disk_image_file" title="10.2.3. Mounting the disk image file">Section 10.2.3, “Mounting the disk image file”</a>). The actual disk usage grows with the actual data stored.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_expansion_of_usable_storage_space_by_bind_mounting_another_directory"></a>9.3.13. Expansion of usable storage space by bind-mounting another directory</h3></div></div></div>
<p>If you have an empty directory (e.g., "<code class="literal">/path/to/emp-dir</code>") on another partition with usable space, you can mount(8) it with "<code class="literal">--bind</code>" option to a directory (e.g., "<code class="literal">work-dir</code>") where you need more space.</p>
<pre class="screen">$ sudo mount --bind /path/to/emp-dir work-dir</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_expansion_of_usable_storage_space_using_symlink"></a>9.3.14. Expansion of usable storage space using symlink</h3></div></div></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>This is a deprecated method. Use <a class="xref" href="ch09.en.html#_expansion_of_usable_storage_space_by_bind_mounting_another_directory" title="9.3.13. Expansion of usable storage space by bind-mounting another directory">Section 9.3.13, “Expansion of usable storage space by bind-mounting another directory”</a> instead, if possible.</p></td></tr>
</table></div>
<p>If you have an empty directory (e.g., "<code class="literal">/path/to/emp-dir</code>") in another partition with usable space, you can create a symlink to the directory with <span class="citerefentry"><span class="refentrytitle">ln</span>(8)</span>.</p>
<pre class="screen">$ sudo mv work-dir old-dir
$ sudo mkdir -p /path/to/emp-dir
$ sudo ln -sf /path/to/emp-dir work-dir
$ sudo cp -a old-dir/* work-dir
$ sudo rm -rf old-dir</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Do not use "symlink to a directory" for directories managed by the system such as "<code class="literal">/opt</code>". Such a symlink may be overwritten when the system is upgraded.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Some software may not function well with "symlink to a directory".</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_expansion_of_usable_storage_space_using_aufs"></a>9.3.15. Expansion of usable storage space using aufs</h3></div></div></div>
<p>If you have usable space in another partition (e.g., "<code class="literal">/path/to/</code>"), you can create a directory in it and stack that on to a directory where you need space with <a class="ulink" href="http://en.wikipedia.org/wiki/Aufs" target="_top">aufs</a>.</p>
<pre class="screen">$ sudo mv work-dir old-dir
$ sudo mkdir work-dir
$ sudo mkdir -p /path/to/emp-dir
$ sudo mount -t aufs -o br:/path/to/emp-dir:old-dir none work-dir</pre>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Use of <a class="ulink" href="http://en.wikipedia.org/wiki/Aufs" target="_top">aufs</a> for long term data storage is not good idea since it is under development and its design change may introduce issues.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>In order to use <a class="ulink" href="http://en.wikipedia.org/wiki/Aufs" target="_top">aufs</a>, its utility package <code class="literal">aufs-tools</code> and kernel module package for <a class="ulink" href="http://en.wikipedia.org/wiki/Aufs" target="_top">aufs</a> such as <code class="literal">aufs-modules-2.6-amd64</code> need to be installed.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><a class="ulink" href="http://en.wikipedia.org/wiki/Aufs" target="_top">aufs</a> is used to provide writable root filesystem by many modern <a class="ulink" href="http://en.wikipedia.org/wiki/Live_CD" target="_top">live CD</a> projects.</p></td></tr>
</table></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_data_encryption_tips"></a>9.4. Data encryption tips</h2></div></div></div>
<p>With physical access to your PC, anyone can easily gain root privilege and access all the files on your PC (see <a class="xref" href="ch04.en.html#_securing_the_root_password" title="4.7.4. Securing the root password">Section 4.7.4, “Securing the root password”</a>). This means that login password system can not secure your private and sensitive data against possible theft of your PC. You must deploy data encryption technology to do it. Although <a class="ulink" href="http://en.wikipedia.org/wiki/GNU_Privacy_Guard" target="_top">GNU privacy guard</a> (see <a class="xref" href="ch10.en.html#_data_security_infrastructure" title="10.4. Data security infrastructure">Section 10.4, “Data security infrastructure”</a>) can encrypt files, it takes some user efforts.</p>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a> and <a class="ulink" href="http://ecryptfs.sourceforge.net/" target="_top">eCryptfs</a> facilitates automatic data encryption natively via Linux kernel modules with minimal user efforts.</p>
<div class="table">
<a name="listofdataencryptionutilities"></a><p class="title"><b>Table 9.9. List of data encryption utilities</b></p>
<div class="table-contents"><table summary="List of data encryption utilities" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/cryptsetup" target="_top">
<code class="literal">cryptsetup</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=cryptsetup" target="_top">http://qa.debian.org/popcon.php?package=cryptsetup</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/cryptsetup.html" target="_top">648</a></td>
<td align="left">
utilities for encrypted block device (<a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a> / <a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup" target="_top">LUKS</a>)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/cryptmount" target="_top">
<code class="literal">cryptmount</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=cryptmount" target="_top">http://qa.debian.org/popcon.php?package=cryptmount</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/cryptmount.html" target="_top">341</a></td>
<td align="left">
utilities for encrypted block device (<a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a> / <a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup" target="_top">LUKS</a>) with focus on mount/unmount by normal users
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ecryptfs-utils" target="_top">
<code class="literal">ecryptfs-utils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ecryptfs-utils" target="_top">http://qa.debian.org/popcon.php?package=ecryptfs-utils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/e/ecryptfs-utils.html" target="_top">368</a></td>
<td align="left">
utilities for encrypted stacked filesystem (<a class="ulink" href="http://ecryptfs.sourceforge.net/" target="_top">eCryptfs</a>)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p><a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">Dm-crypt</a> is a cryptographic filesystem using <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper" target="_top">device-mapper</a>. <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper" target="_top">Device-mapper</a> maps one block device to another.</p>
<p><a class="ulink" href="http://ecryptfs.sourceforge.net/" target="_top">eCryptfs</a> is another cryptographic filesystem using stacked filesystem. Stacked filesystem stacks itself on top of an existing directory of a mounted filesystem.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Data encryption costs CPU time etc. Please weigh its benefits and costs.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Entire Debian system can be installed on a encrypted disk by the <a class="ulink" href="http://en.wikipedia.org/wiki/Debian-Installer" target="_top">debian-installer</a> (lenny or newer) using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup" target="_top">LUKS</a> and initramfs.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>See <a class="xref" href="ch10.en.html#_data_security_infrastructure" title="10.4. Data security infrastructure">Section 10.4, “Data security infrastructure”</a> for user space encryption utility: <a class="ulink" href="http://en.wikipedia.org/wiki/GNU_Privacy_Guard" target="_top">GNU Privacy Guard</a>.</p></td></tr>
</table></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_removable_disk_encryption_with_dm_crypt_luks"></a>9.4.1. Removable disk encryption with dm-crypt/LUKS</h3></div></div></div>
<p>You can encrypt contents of removable mass devices, e.g. USB memory stick on "<code class="literal">/dev/sdx</code>", using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a>/<a class="ulink" href="http://en.wikipedia.org/wiki/Linux_Unified_Key_Setup" target="_top">LUKS</a>. You simply formatting it as the following.</p>
<pre class="screen"># badblocks -c 1024 -s -w -t random -v /dev/sdx
# fdisk /dev/sdx
... "n" "p" "1" "return" "return" "w"
# cryptsetup luksFormat /dev/sdx1
...
# cryptsetup luksOpen /dev/sdx1 sdx1
...
# ls -l /dev/mapper/
total 0
crw-rw---- 1 root root 10, 60 2008-10-04 18:44 control
brw-rw---- 1 root disk 254, 0 2008-10-04 23:55 sdx1
# mkfs.vfat /dev/mapper/sdx1
...
# cryptsetup luksClose sdx1</pre>
<p>Then, it can be mounted just like normal one on to "<code class="literal">/media/&lt;disk_label&gt;</code>", except for asking password (see <a class="xref" href="ch10.en.html#_removable_storage_device" title="10.1.10. Removable storage device">Section 10.1.10, “Removable storage device”</a>) under modern desktop environment, such as GNOME using <span class="citerefentry"><span class="refentrytitle">gnome-mount</span>(1)</span>. The difference is that every data written to it is encrypted. You may alternatively format media in different file format, e.g., ext3 with "<code class="literal">mkfs.ext3 /dev/sdx1</code>".</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>If you are really paranoid for the security of data, you may need to overwrite multiple times in the above example. This operation is very time consuming though.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_encrypted_swap_partition_with_dm_crypt"></a>9.4.2. Encrypted swap partition with dm-crypt</h3></div></div></div>
<p>Let's assume that your original "<code class="literal">/etc/fstab</code>" contains the following.</p>
<pre class="screen">/dev/sda7 swap sw 0 0</pre>
<p>You can enable encrypted swap partition using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a> by as the following.</p>
<pre class="screen"># aptitude install cryptsetup
# swapoff -a
# echo "cswap /dev/sda7 /dev/urandom swap" &gt;&gt; /etc/crypttab
# perl -i -p -e "s/\/dev\/sda7/\/dev\/mapper\/cswap/" /etc/fstab
# /etc/init.d/cryptdisks restart
...
# swapon -a</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_automatically_encrypting_files_with_ecryptfs"></a>9.4.3. Automatically encrypting files with eCryptfs</h3></div></div></div>
<p>You can encrypt files written under "<code class="literal">~/Private/</code>" automatically using <a class="ulink" href="http://ecryptfs.sourceforge.net/" target="_top">eCryptfs</a> and the <code class="literal">ecryptfs-utils</code> package.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Run <span class="citerefentry"><span class="refentrytitle">ecryptfs-setup-private</span>(1)</span> and set up "<code class="literal">~/Private/</code>" by following prompts.
</p></li>
<li class="listitem"><p>
Activate "<code class="literal">~/Private/</code>" by running <span class="citerefentry"><span class="refentrytitle">ecryptfs-mount-private</span>(1)</span>.
</p></li>
<li class="listitem">
<p>
Move sensitive data files to "<code class="literal">~/Private/</code>" and make symlinks as needed.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Candidates: "<code class="literal">~/.fetchmailrc</code>", "<code class="literal">~/.ssh/identity</code>", "<code class="literal">~/.ssh/id_rsa</code>", "<code class="literal">~/.ssh/id_dsa</code>" and other files with "<code class="literal">go-rwx</code>"
</p></li></ul></div>
</li>
<li class="listitem">
<p>
Move sensitive data directories to a subdirectory in "<code class="literal">~/Private/</code>" and make symlinks as needed.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem"><p>
Candidates: "<code class="literal">~/.gnupg</code>" and other directories with "<code class="literal">go-rwx</code>"
</p></li></ul></div>
</li>
<li class="listitem"><p>
Create symlink from "<code class="literal">~/Desktop/Private/</code>" to "<code class="literal">~/Private/</code>" for easier desktop operations.
</p></li>
<li class="listitem"><p>
Deactivate "<code class="literal">~/Private/</code>" by running <span class="citerefentry"><span class="refentrytitle">ecryptfs-umount-private</span>(1)</span>.
</p></li>
<li class="listitem"><p>
Activate "<code class="literal">~/Private/</code>" by issuing "<code class="literal">ecryptfs-mount-private</code>" as you need encrypted data.
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Since <a class="ulink" href="http://ecryptfs.sourceforge.net/" target="_top">eCryptfs</a> selectively encrypt only the sensitive files, its system cost is much less than using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt" target="_top">dm-crypt</a> on the entire root or "<code class="literal">/home</code>" device. It does not require any special on-disk storage allocation effort but cannot keep all filesystem metadata confidential.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_automatically_mounting_ecryptfs"></a>9.4.4. Automatically mounting eCryptfs</h3></div></div></div>
<p>If you use your login password for wrapping encryption keys, you can automate mounting eCryptfs via
<a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules" target="_top">PAM (Pluggable Authentication Modules)</a>.</p>
<p>Insert the following line just before "<code class="literal">pam_permit.so</code>" in "<code class="literal">/etc/pam.d/common-auth</code>".</p>
<pre class="screen">auth required pam_ecryptfs.so unwrap</pre>
<p>Insert the following line just at the last line in "<code class="literal">/etc/pam.d/common-session</code>".</p>
<pre class="screen">session optional pam_ecryptfs.so unwrap</pre>
<p>Insert the following line at first active line in "<code class="literal">/etc/pam.d/common-password</code>".</p>
<pre class="screen">password required pam_ecryptfs.so</pre>
<p>This is quite convenient.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Configuration errors of <a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules" target="_top">PAM</a> may lock you out of your own system. See <a class="xref" href="ch04.en.html" title="Chapter 4. Authentication">Chapter 4, <i>Authentication</i></a>.</p></td></tr>
</table></div>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>If you use your login password for wrapping encryption keys, your encrypted data are as secure as your user login password (see <a class="xref" href="ch04.en.html#_good_password" title="4.3. Good password">Section 4.3, “Good password”</a>). Unless you are careful to set up a <a class="ulink" href="http://en.wikipedia.org/wiki/Password_strength" target="_top">strong password</a>, your data is at risk when someone runs <a class="ulink" href="http://en.wikipedia.org/wiki/Password_cracking" target="_top">password cracking</a> software after stealing your laptop (see <a class="xref" href="ch04.en.html#_securing_the_root_password" title="4.7.4. Securing the root password">Section 4.7.4, “Securing the root password”</a>).</p></td></tr>
</table></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_monitoring_controlling_and_starting_program_activities"></a>9.5. Monitoring, controlling, and starting program activities</h2></div></div></div>
<p>Program activities can be monitored and controlled using specialized tools.</p>
<div class="table">
<a name="listoftoolsformorogramactivities"></a><p class="title"><b>Table 9.10. List of tools for monitoring and controlling program activities</b></p>
<div class="table-contents"><table summary="List of tools for monitoring and controlling program activities" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/coreutils" target="_top">
<code class="literal">coreutils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=coreutils" target="_top">http://qa.debian.org/popcon.php?package=coreutils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/coreutils.html" target="_top">14088</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">nice</span>(1)</span>: run a program with modified scheduling priority
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/bsdutils" target="_top">
<code class="literal">bsdutils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=bsdutils" target="_top">http://qa.debian.org/popcon.php?package=bsdutils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/bsdutils.html" target="_top">187</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">renice</span>(1)</span>: modify the scheduling priority of a running process
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/procps" target="_top">
<code class="literal">procps</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=procps" target="_top">http://qa.debian.org/popcon.php?package=procps</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/procps.html" target="_top">593</a></td>
<td align="left">
"<code class="literal">/proc</code>" filesystem utilities: <span class="citerefentry"><span class="refentrytitle">ps</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">top</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">kill</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">watch</span>(1)</span>, …
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/psmisc" target="_top">
<code class="literal">psmisc</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=psmisc" target="_top">http://qa.debian.org/popcon.php?package=psmisc</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/psmisc.html" target="_top">602</a></td>
<td align="left">
"<code class="literal">/proc</code>" filesystem utilities: <span class="citerefentry"><span class="refentrytitle">killall</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">fuser</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">peekfd</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">pstree</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/time" target="_top">
<code class="literal">time</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=time" target="_top">http://qa.debian.org/popcon.php?package=time</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/t/time.html" target="_top">152</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">time</span>(1)</span>: run a program to report system resource usages with respect to time
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/sysstat" target="_top">
<code class="literal">sysstat</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=sysstat" target="_top">http://qa.debian.org/popcon.php?package=sysstat</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/sysstat.html" target="_top">962</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">sar</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">iostat</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">mpstat</span>(1)</span>, …: system performance tools for Linux
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/isag" target="_top">
<code class="literal">isag</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=isag" target="_top">http://qa.debian.org/popcon.php?package=isag</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/isag.html" target="_top">126</a></td>
<td align="left">
Interactive System Activity Grapher for sysstat
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/lsof" target="_top">
<code class="literal">lsof</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=lsof" target="_top">http://qa.debian.org/popcon.php?package=lsof</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/lsof.html" target="_top">420</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">lsof</span>(8)</span>: list open files by a running process using "<code class="literal">-p</code>" option
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/strace" target="_top">
<code class="literal">strace</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=strace" target="_top">http://qa.debian.org/popcon.php?package=strace</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/strace.html" target="_top">404</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">strace</span>(1)</span>: trace system calls and signals
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/ltrace" target="_top">
<code class="literal">ltrace</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=ltrace" target="_top">http://qa.debian.org/popcon.php?package=ltrace</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/ltrace.html" target="_top">188</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">ltrace</span>(1)</span>: trace library calls
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/xtrace" target="_top">
<code class="literal">xtrace</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=xtrace" target="_top">http://qa.debian.org/popcon.php?package=xtrace</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/x/xtrace.html" target="_top">336</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">xtrace</span>(1)</span>: trace communication between X11 client and server
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/powertop" target="_top">
<code class="literal">powertop</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=powertop" target="_top">http://qa.debian.org/popcon.php?package=powertop</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/powertop.html" target="_top">380</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">powertop</span>(1)</span>: information about system power use on Intel-based laptops
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/cron" target="_top">
<code class="literal">cron</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=cron" target="_top">http://qa.debian.org/popcon.php?package=cron</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/cron.html" target="_top">195</a></td>
<td align="left">
run processes according to a schedule in background from <span class="citerefentry"><span class="refentrytitle">cron</span>(8)</span> daemon
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/anacron" target="_top">
<code class="literal">anacron</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=anacron" target="_top">http://qa.debian.org/popcon.php?package=anacron</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/anacron.html" target="_top">159</a></td>
<td align="left">
cron-like command scheduler for systems that don't run 24 hours a day
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/at" target="_top">
<code class="literal">at</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=at" target="_top">http://qa.debian.org/popcon.php?package=at</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/at.html" target="_top">140</a></td>
<td align="left">
<span class="citerefentry"><span class="refentrytitle">at</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">batch</span>(1)</span>: run a job at a specified time or below certain load level
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The <code class="literal">procps</code> packages provide very basics of monitoring, controlling, and starting program activities. You should learn all of them.</p></td></tr>
</table></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_timing_a_process"></a>9.5.1. Timing a process</h3></div></div></div>
<p>Display time used by the process invoked by the command.</p>
<pre class="screen"># time some_command &gt;/dev/null
real 0m0.035s # time on wall clock (elapsed real time)
user 0m0.000s # time in user mode
sys 0m0.020s # time in kernel mode</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_scheduling_priority"></a>9.5.2. The scheduling priority</h3></div></div></div>
<p>A nice value is used to control the scheduling priority for the process.</p>
<div class="table">
<a name="listofnicevalueshedulingpriority"></a><p class="title"><b>Table 9.11. List of nice values for the scheduling priority</b></p>
<div class="table-contents"><table summary="List of nice values for the scheduling priority" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
nice value
</th>
<th align="left">
scheduling priority
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
19
</td>
<td align="left">
lowest priority process (nice)
</td>
</tr>
<tr>
<td align="left">
0
</td>
<td align="left">
very high priority process for user
</td>
</tr>
<tr>
<td align="left">
-20
</td>
<td align="left">
very high priority process for root (not-nice)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><pre class="screen"># nice -19 top # very nice
# nice --20 wodim -v -eject speed=2 dev=0,0 disk.img # very fast</pre>
<p>Sometimes an extreme nice value does more harm than good to the system. Use this command carefully.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_ps_command"></a>9.5.3. The ps command</h3></div></div></div>
<p>The <span class="citerefentry"><span class="refentrytitle">ps</span>(1)</span> command on the Debian support both BSD and SystemV features and helps to identify the process activity statically.</p>
<div class="table">
<a name="listofpscommandstyles"></a><p class="title"><b>Table 9.12. List of ps command styles</b></p>
<div class="table-contents"><table summary="List of ps command styles" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
style
</th>
<th align="left">
typical command
</th>
<th align="left">
feature
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
BSD
</td>
<td align="left">
<code class="literal">ps aux</code>
</td>
<td align="left">
display %CPU %MEM
</td>
</tr>
<tr>
<td align="left">
System V
</td>
<td align="left">
<code class="literal">ps -efH</code>
</td>
<td align="left">
display PPID
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>For the zombie (defunct) children process, you can kill them by the parent process ID identified in the "<code class="literal">PPID</code>" field.</p>
<p>The <span class="citerefentry"><span class="refentrytitle">pstree</span>(1)</span> command display a tree of processes.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_top_command"></a>9.5.4. The top command</h3></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">top</span>(1)</span> on the Debian has rich features and helps to identify what process is acting funny dynamically.</p>
<div class="table">
<a name="listofcommandsfortop"></a><p class="title"><b>Table 9.13. List of commands for top</b></p>
<div class="table-contents"><table summary="List of commands for top" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
command key
</th>
<th align="left">
description of response
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">h</code> or <code class="literal">?</code>
</td>
<td align="left">
show help
</td>
</tr>
<tr>
<td align="left">
<code class="literal">f</code>
</td>
<td align="left">
set/reset display field
</td>
</tr>
<tr>
<td align="left">
<code class="literal">o</code>
</td>
<td align="left">
reorder display field
</td>
</tr>
<tr>
<td align="left">
<code class="literal">F</code>
</td>
<td align="left">
set sort key field
</td>
</tr>
<tr>
<td align="left">
<code class="literal">k</code>
</td>
<td align="left">
kill a process
</td>
</tr>
<tr>
<td align="left">
<code class="literal">r</code>
</td>
<td align="left">
renice a process
</td>
</tr>
<tr>
<td align="left">
<code class="literal">q</code>
</td>
<td align="left">
quit the <code class="literal">top</code> command
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_listing_files_opened_by_a_process"></a>9.5.5. Listing files opened by a process</h3></div></div></div>
<p>You can list all files opened by a process with a process ID (PID), e.g. 1, by the following.</p>
<pre class="screen">$ sudo lsof -p 1</pre>
<p>PID=1 is usually <code class="literal">init</code> program.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_tracing_program_activities"></a>9.5.6. Tracing program activities</h3></div></div></div>
<p>You can trace program activity with <span class="citerefentry"><span class="refentrytitle">strace</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">ltrace</span>(1)</span>, or <span class="citerefentry"><span class="refentrytitle">xtrace</span>(1)</span> for system calls and signals, library calls, or communication between X11 client and server.</p>
<p>You can trace system calls of the <code class="literal">ls</code> command as the following.</p>
<pre class="screen">$ sudo strace ls</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_identification_of_processes_using_files_or_sockets"></a>9.5.7. Identification of processes using files or sockets</h3></div></div></div>
<p>You can also identify processes using files by <span class="citerefentry"><span class="refentrytitle">fuser</span>(1)</span>, e.g. for "<code class="literal">/var/log/mail.log</code>" by the following.</p>
<pre class="screen">$ sudo fuser -v /var/log/mail.log
USER PID ACCESS COMMAND
/var/log/mail.log: root 2946 F.... rsyslogd</pre>
<p>You see that file "<code class="literal">/var/log/mail.log</code>" is open for writing by the <span class="citerefentry"><span class="refentrytitle">rsyslogd</span>(8)</span> command.</p>
<p>You can also identify processes using sockets by <span class="citerefentry"><span class="refentrytitle">fuser</span>(1)</span>, e.g. for "<code class="literal">smtp/tcp</code>" by the following.</p>
<pre class="screen">$ sudo fuser -v smtp/tcp
USER PID ACCESS COMMAND
smtp/tcp: Debian-exim 3379 F.... exim4</pre>
<p>Now you know your system runs <span class="citerefentry"><span class="refentrytitle">exim4</span>(8)</span> to handle <a class="ulink" href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol" target="_top">TCP</a> connections to <a class="ulink" href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol" target="_top">SMTP</a> port (25).</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_repeating_a_command_with_a_constant_interval"></a>9.5.8. Repeating a command with a constant interval</h3></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">watch</span>(1)</span> executes a program repeatedly with a constant interval while showing its output in fullscreen.</p>
<pre class="screen">$ watch w</pre>
<p>This displays who is logged on to the system updated every 2 seconds.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_repeating_a_command_looping_over_files"></a>9.5.9. Repeating a command looping over files</h3></div></div></div>
<p>There are several ways to repeat a command looping over files matching some condition, e.g. matching glob pattern "<code class="literal">*.ext</code>".</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
Shell for-loop method (see <a class="xref" href="ch12.en.html#_shell_loops" title="12.1.4. Shell loops">Section 12.1.4, “Shell loops”</a>):
</p></li></ul></div>
<pre class="screen">for x in *.ext; do if [ -f "$x"]; then command "$x" ; fi; done</pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">xargs</span>(1)</span> combination:
</p></li></ul></div>
<pre class="screen">find . -type f -maxdepth 1 -name '*.ext' -print0 | xargs -0 -n 1 command</pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> with "<code class="literal">-exec</code>" option with a command:
</p></li></ul></div>
<pre class="screen">find . -type f -maxdepth 1 -name '*.ext' -exec command '{}' \;</pre>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">find</span>(1)</span> with "<code class="literal">-exec</code>" option with a short shell script:
</p></li></ul></div>
<pre class="screen">find . -type f -maxdepth 1 -name '*.ext' -exec sh -c "command '{}' &amp;&amp; echo 'successful'" \;</pre>
<p>The above examples are written to ensure proper handling of funny file names such as ones containing spaces. See <a class="xref" href="ch10.en.html#_idioms_for_the_selection_of_files" title="10.1.5. Idioms for the selection of files">Section 10.1.5, “Idioms for the selection of files”</a> for more advance uses of <span class="citerefentry"><span class="refentrytitle">find</span>(1)</span>.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_starting_a_program_from_gui"></a>9.5.10. Starting a program from GUI</h3></div></div></div>
<p>You can set up to start a process from <a class="ulink" href="http://en.wikipedia.org/wiki/Graphical_user_interface" target="_top">graphical user interface (GUI)</a>.</p>
<p>Under GNOME desktop environment, a program can be started with proper argument by <span class="strong"><strong>double-clicking</strong></span> the launcher icon, by <span class="strong"><strong>drag-and-drop</strong></span> of a file icon to the launcher icon, or by "<span class="strong"><strong>Open with …</strong></span>" menu via right clicking a file icon. KDE can do the equivalent, too.</p>
<p>Here is an example under GNOME to create a launcher icon for <span class="citerefentry"><span class="refentrytitle">mc</span>(1)</span> started in <span class="citerefentry"><span class="refentrytitle">gnome-terminal</span>(1)</span>.</p>
<p>Create an executable program "<code class="literal">mc-term</code>" by the following.</p>
<pre class="screen"># cat &gt;/usr/local/bin/mc-term &lt;&lt;EOF
#!/bin/sh
gnome-terminal -e "mc \$1"
EOF
# chmod 755 /usr/local/bin/mc-term</pre>
<p>Create a desktop launcher as the following.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Right click desktop space to select "<code class="literal">Create Launcher …</code>".
</p></li>
<li class="listitem"><p>
Set "Type" to "<code class="literal">Application</code>".
</p></li>
<li class="listitem"><p>
Set "Name" to "<code class="literal">mc</code>".
</p></li>
<li class="listitem"><p>
Set "Command" to "<code class="literal">mc-term %f</code>".
</p></li>
<li class="listitem"><p>
Click "OK".
</p></li>
</ol></div>
<p>Create an open-with association as as the following.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Right click folder to select "<code class="literal">Open with Other Application …</code>".
</p></li>
<li class="listitem"><p>
Click open "Use a custom command" dialog and enter "<code class="literal">mc-term %f</code>".
</p></li>
<li class="listitem"><p>
Click "Open".
</p></li>
</ol></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Launcher is a file at "<code class="literal">~/Desktop</code>" with "<code class="literal">.desktop</code>" as its extension.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_customizing_program_to_be_started"></a>9.5.11. Customizing program to be started</h3></div></div></div>
<p>Some programs start another program automatically. Here are check points for customizing this process.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
Application configuration menu:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
GNOME desktop: "System" → "Preferences" → "Preferred Application"
</p></li>
<li class="listitem"><p>
KDE desktop: "K" → "Control Center" → "KDE Components" → "Component Chooser"
</p></li>
<li class="listitem"><p>
Iceweasle browser: "Edit" → "Preferences" → "Applications"
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">mc</span>(1)</span>: "<code class="literal">/etc/mc/mc.ext</code>"
</p></li>
</ul></div>
</li>
<li class="listitem"><p>
Environment variables such as "<code class="literal">$BROWSER</code>", "<code class="literal">$EDITOR</code>", "<code class="literal">$VISUAL</code>", and "<code class="literal">$PAGER</code>" (see <span class="citerefentry"><span class="refentrytitle">eviron</span>(7)</span>)
</p></li>
<li class="listitem"><p>
The <span class="citerefentry"><span class="refentrytitle">update-alternatives</span>(8)</span> system for programs such as "<code class="literal">editor</code>", "<code class="literal">view</code>", "<code class="literal">x-www-browser</code>", "<code class="literal">gnome-www-browser</code>", and "<code class="literal">www-browser</code>" (see <a class="xref" href="ch01.en.html#_setting_a_default_text_editor" title="1.4.7. Setting a default text editor">Section 1.4.7, “Setting a default text editor”</a>)
</p></li>
<li class="listitem"><p>
the "<code class="literal">~/.mailcap</code>" and "<code class="literal">/etc/mailcap</code>" file contents which associate <a class="ulink" href="http://en.wikipedia.org/wiki/MIME" target="_top">MIME</a> type with program (see <span class="citerefentry"><span class="refentrytitle">mailcap</span>(5)</span>)
</p></li>
<li class="listitem"><p>
The "<code class="literal">~/.mime.types</code>" and "<code class="literal">/etc/mime.types</code>" file contents which associate file name extension with <a class="ulink" href="http://en.wikipedia.org/wiki/MIME" target="_top">MIME</a> type (see <span class="citerefentry"><span class="refentrytitle">run-mailcap</span>(1)</span>)
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><span class="citerefentry"><span class="refentrytitle">update-mime</span>(8)</span> updates the "<code class="literal">/etc/mailcap</code>" file using "<code class="literal">/etc/mailcap.order</code>" file (see <span class="citerefentry"><span class="refentrytitle">mailcap.order</span>(5)</span>).</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The <code class="literal">debianutils</code> package provides <span class="citerefentry"><span class="refentrytitle">sensible-browser</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">sensible-editor</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">sensible-pager</span>(1)</span> which make sensible decisions on which editor, pager, and web browser to call, respectively. I recommend you to read these shell scripts.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>In order to run a console application such as <code class="literal">mutt</code> under X as your preferred application, you should create an X application as following and set "<code class="literal">/usr/local/bin/mutt-term</code>" as your preferred application to be started as described.</p></td></tr>
</table></div>
<pre class="screen"># cat /usr/local/bin/mutt-term &lt;&lt;EOF
#!/bin/sh
gnome-terminal -e "mutt \$@"
EOF
chmod 755 /usr/local/bin/mutt-term</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_killing_a_process"></a>9.5.12. Killing a process</h3></div></div></div>
<p>Use <span class="citerefentry"><span class="refentrytitle">kill</span>(1)</span> to kill (or send a signal to) a process by the process ID.</p>
<p>Use <span class="citerefentry"><span class="refentrytitle">killall</span>(1)</span> or <span class="citerefentry"><span class="refentrytitle">pkill</span>(1)</span> to do the same by the process command name and other attributes.</p>
<div class="table">
<a name="listoffrequentlylsforkillcommand"></a><p class="title"><b>Table 9.14. List of frequently used signals for kill command</b></p>
<div class="table-contents"><table summary="List of frequently used signals for kill command" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
signal value
</th>
<th align="left">
signal name
</th>
<th align="left">
function
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
1
</td>
<td align="left">
HUP
</td>
<td align="left">
restart daemon
</td>
</tr>
<tr>
<td align="left">
15
</td>
<td align="left">
TERM
</td>
<td align="left">
normal kill
</td>
</tr>
<tr>
<td align="left">
9
</td>
<td align="left">
KILL
</td>
<td align="left">
kill hard
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_scheduling_tasks_once"></a>9.5.13. Scheduling tasks once</h3></div></div></div>
<p>Run the <span class="citerefentry"><span class="refentrytitle">at</span>(1)</span> command to schedule a one-time job by the following.</p>
<pre class="screen">$ echo 'command -args'| at 3:40 monday</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_scheduling_tasks_regularly"></a>9.5.14. Scheduling tasks regularly</h3></div></div></div>
<p>Use <span class="citerefentry"><span class="refentrytitle">cron</span>(8)</span> to schedule tasks regularly. See <span class="citerefentry"><span class="refentrytitle">crontab</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span>.</p>
<p>You can schedule to run processes as a normal user, e.g. <code class="literal">foo</code> by creating a <span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span> file as "<code class="literal">/var/spool/cron/crontabs/foo</code>" with "<code class="literal">crontab -e</code>" command.</p>
<p>Here is an example of a <span class="citerefentry"><span class="refentrytitle">crontab</span>(5)</span> file.</p>
<pre class="screen"># use /bin/sh to run commands, no matter what /etc/passwd says
SHELL=/bin/sh
# mail any output to paul, no matter whose crontab this is
MAILTO=paul
# Min Hour DayOfMonth Month DayOfWeek command (Day... are OR'ed)
# run at 00:05, every day
5 0 * * * $HOME/bin/daily.job &gt;&gt; $HOME/tmp/out 2&gt;&amp;1
# run at 14:15 on the first of every month -- output mailed to paul
15 14 1 * * $HOME/bin/monthly
# run at 22:00 on weekdays(1-5), annoy Joe. % for newline, last % for cc:
0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%.%%
23 */2 1 2 * echo "run 23 minutes after 0am, 2am, 4am ..., on Feb 1"
5 4 * * sun echo "run at 04:05 every Sunday"
# run at 03:40 on the first Monday of each month
40 3 1-7 * * [ "$(date +%a)" == "Mon" ] &amp;&amp; command -args</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>For the system not running continuously, install the <code class="literal">anacron</code> package to schedule periodic commands at the specified intervals as closely as machine-uptime permits. See <span class="citerefentry"><span class="refentrytitle">anacron</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">anacrontab</span>(5)</span>.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>For scheduled system maintenance scripts, you can run them periodically from root account by placing such scripts in "<code class="literal">/etc/cron.hourly/</code>", "<code class="literal">/etc/cron.daily/</code>", "<code class="literal">/etc/cron.weekly/</code>", or "<code class="literal">/etc/cron.monthly/</code>". Execution timings of these scripts can be customized by "<code class="literal">/etc/crontab</code>" and "<code class="literal">/etc/anacrontab</code>".</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_alt_sysrq_key"></a>9.5.15. Alt-SysRq key</h3></div></div></div>
<p>Insurance against system malfunction is provided by the kernel compile option "Magic SysRq key" (<a class="ulink" href="http://en.wikipedia.org/wiki/Secure_attention_key" target="_top">SAK</a> key) which is now the default for the Debian kernel. Pressing Alt-SysRq followed by one of the following keys does the magic of rescuing control of the system.</p>
<div class="table">
<a name="listofsakcommandkeys"></a><p class="title"><b>Table 9.15. List of SAK command keys</b></p>
<div class="table-contents"><table summary="List of SAK command keys" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
key following Alt-SysRq
</th>
<th align="left">
description of action
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
<code class="literal">r</code>
</td>
<td align="left">
restore the keyboard from <span class="strong"><strong>r</strong></span>aw mode after X crashes
</td>
</tr>
<tr>
<td align="left">
<code class="literal">0</code>
</td>
<td align="left">
change the console loglevel to <span class="strong"><strong>0</strong></span> to reduce error messages
</td>
</tr>
<tr>
<td align="left">
<code class="literal">k</code>
</td>
<td align="left">
<span class="strong"><strong>k</strong></span>ill all processes on the <span class="strong"><strong>current virtual console</strong></span>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">e</code>
</td>
<td align="left">
send a SIGT<span class="strong"><strong>E</strong></span>RM to all processes, except for <span class="citerefentry"><span class="refentrytitle">init</span>(8)</span>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">i</code>
</td>
<td align="left">
send a SIGK<span class="strong"><strong>I</strong></span>LL to all processes, except for <span class="citerefentry"><span class="refentrytitle">init</span>(8)</span>
</td>
</tr>
<tr>
<td align="left">
<code class="literal">s</code>
</td>
<td align="left">
<span class="strong"><strong>s</strong></span>ync all mounted filesystems
</td>
</tr>
<tr>
<td align="left">
<code class="literal">u</code>
</td>
<td align="left">
remount all mounted filesystems read-only (<span class="strong"><strong>u</strong></span>mount)
</td>
</tr>
<tr>
<td align="left">
<code class="literal">b</code>
</td>
<td align="left">
re<span class="strong"><strong>b</strong></span>oot the system without syncing or unmounting
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>The combination of "Alt-SysRq s", "Alt-SysRq u", and "Alt-SysRq r" is good for getting out of really bad situations.</p>
<p>See "<code class="literal">/usr/share/doc/linux-doc-2.6.*/Documentation/sysrq.txt.gz</code>".</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>The Alt-SysRq feature may be considered a security risk by allowing users access to root-privileged functions. Placing "<code class="literal">echo 0 &gt;/proc/sys/kernel/sysrq</code>" in "<code class="literal">/etc/rc.local</code>" or "<code class="literal">kernel.sysrq = 0</code>" in "<code class="literal">/etc/sysctl.conf</code>" disables the Alt-SysRq feature.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>From SSH terminal etc., you can use the Alt-SysRq feature by writing to the "<code class="literal">/proc/sysrq-trigger</code>". For example, "<code class="literal">echo s &gt; /proc/sysrq-trigger; echo u &gt; /proc/sysrq-trigger</code>" from the root shell prompt <span class="strong"><strong>s</strong></span>yncs and <span class="strong"><strong>u</strong></span>mounts all mounted filesystems.</p></td></tr>
</table></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_system_maintenance_tips"></a>9.6. System maintenance tips</h2></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_who_is_on_the_system"></a>9.6.1. Who is on the system?</h3></div></div></div>
<p>You can check who is on the system by the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">who</span>(1)</span> shows who is logged on.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">w</span>(1)</span> shows who is logged on and what they are doing.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">last</span>(1)</span> shows listing of last logged in user.
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">lastb</span>(1)</span> shows listing of last bad logged in users.
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>"<code class="literal">/var/run/utmp</code>", "<code class="literal">/var/log/wtmp</code>", and "<code class="literal">/var/run/utmp</code>" hold such user information. See <span class="citerefentry"><span class="refentrytitle">login</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">utmp</span>(5)</span>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_warning_everyone"></a>9.6.2. Warning everyone</h3></div></div></div>
<p>You can send message to everyone who is logged on to the system with <span class="citerefentry"><span class="refentrytitle">wall</span>(1)</span> by the following.</p>
<pre class="screen">$ echo "We are shutting down in 1 hour" | wall</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_hardware_identification"></a>9.6.3. Hardware identification</h3></div></div></div>
<p>For the <a class="ulink" href="http://en.wikipedia.org/wiki/Peripheral_Component_Interconnect" target="_top">PCI</a>-like devices (<a class="ulink" href="http://en.wikipedia.org/wiki/Accelerated_Graphics_Port" target="_top">AGP</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/PCI_Express" target="_top">PCI-Express</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/PC_Card#CardBus" target="_top">CardBus</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/ExpressCard" target="_top">ExpressCard</a>, etc.), <span class="citerefentry"><span class="refentrytitle">lspci</span>(8)</span> (probably with "<code class="literal">-nn</code>" option) is a good start for the hardware identification</p>
<p>Alternatively, you can identify the hardware by reading contents of "<code class="literal">/proc/bus/pci/devices</code>" or browsing directory tree under "<code class="literal">/sys/bus/pci</code>" (see <a class="xref" href="ch01.en.html#_procfs_and_sysfs" title="1.2.12. procfs and sysfs">Section 1.2.12, “procfs and sysfs”</a>).</p>
<div class="table">
<a name="listofhardwareidntificationtools"></a><p class="title"><b>Table 9.16. List of hardware identification tools</b></p>
<div class="table-contents"><table summary="List of hardware identification tools" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/pciutils" target="_top">
<code class="literal">pciutils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=pciutils" target="_top">http://qa.debian.org/popcon.php?package=pciutils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/pciutils.html" target="_top">921</a></td>
<td align="left">
Linux PCI Utilities: <span class="citerefentry"><span class="refentrytitle">lspci</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/usbutils" target="_top">
<code class="literal">usbutils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=usbutils" target="_top">http://qa.debian.org/popcon.php?package=usbutils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/u/usbutils.html" target="_top">630</a></td>
<td align="left">
Linux USB utilities: <span class="citerefentry"><span class="refentrytitle">lsusb</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/pcmciautils" target="_top">
<code class="literal">pcmciautils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=pcmciautils" target="_top">http://qa.debian.org/popcon.php?package=pcmciautils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/pcmciautils.html" target="_top">115</a></td>
<td align="left">
PCMCIA utilities for Linux 2.6: <span class="citerefentry"><span class="refentrytitle">pccardctl</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/scsitools" target="_top">
<code class="literal">scsitools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=scsitools" target="_top">http://qa.debian.org/popcon.php?package=scsitools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/scsitools.html" target="_top">316</a></td>
<td align="left">
collection of tools for SCSI hardware management: <span class="citerefentry"><span class="refentrytitle">lsscsi</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/pnputils" target="_top">
<code class="literal">pnputils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=pnputils" target="_top">http://qa.debian.org/popcon.php?package=pnputils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/pnputils.html" target="_top">108</a></td>
<td align="left">
Plug and Play BIOS utilities: <span class="citerefentry"><span class="refentrytitle">lspnp</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/procinfo" target="_top">
<code class="literal">procinfo</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=procinfo" target="_top">http://qa.debian.org/popcon.php?package=procinfo</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/procinfo.html" target="_top">164</a></td>
<td align="left">
system information obtained from "<code class="literal">/proc</code>": <span class="citerefentry"><span class="refentrytitle">lsdev</span>(8)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/lshw" target="_top">
<code class="literal">lshw</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=lshw" target="_top">http://qa.debian.org/popcon.php?package=lshw</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/lshw.html" target="_top">712</a></td>
<td align="left">
information about hardware configuration: <span class="citerefentry"><span class="refentrytitle">lshw</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/discover" target="_top">
<code class="literal">discover</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=discover" target="_top">http://qa.debian.org/popcon.php?package=discover</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/discover.html" target="_top">66</a></td>
<td align="left">
hardware identification system: <span class="citerefentry"><span class="refentrytitle">discover</span>(8)</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_hardware_configuration"></a>9.6.4. Hardware configuration</h3></div></div></div>
<p>Although most of the hardware configuration on modern GUI desktop systems such as GNOME and KDE can be managed through accompanying GUI configuration tools, it is a good idea to know some basics methods to configure them.</p>
<div class="table">
<a name="listofhardwareconfigurationtools"></a><p class="title"><b>Table 9.17. List of hardware configuration tools</b></p>
<div class="table-contents"><table summary="List of hardware configuration tools" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/hal" target="_top">
<code class="literal">hal</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=hal" target="_top">http://qa.debian.org/popcon.php?package=hal</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/h/hal.html" target="_top">1495</a></td>
<td align="left">
Hardware Abstraction Layer: <span class="citerefentry"><span class="refentrytitle">lshal</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/console-tools" target="_top">
<code class="literal">console-tools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=console-tools" target="_top">http://qa.debian.org/popcon.php?package=console-tools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/console-tools.html" target="_top">956</a></td>
<td align="left">
Linux console font and keytable utilities
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/x11-xserver-utils" target="_top">
<code class="literal">x11-xserver-utils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=x11-xserver-utils" target="_top">http://qa.debian.org/popcon.php?package=x11-xserver-utils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/x/x11-xserver-utils.html" target="_top">485</a></td>
<td align="left">
X server utilities: <span class="citerefentry"><span class="refentrytitle">xset</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">xmodmap</span>(1)</span>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/acpid" target="_top">
<code class="literal">acpid</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=acpid" target="_top">http://qa.debian.org/popcon.php?package=acpid</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/acpid.html" target="_top">187</a></td>
<td align="left">
daemon to manage events delivered by the Advanced Configuration and Power Interface (ACPI)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/acpi" target="_top">
<code class="literal">acpi</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=acpi" target="_top">http://qa.debian.org/popcon.php?package=acpi</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/acpi.html" target="_top">70</a></td>
<td align="left">
utility to display information on ACPI devices
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/apmd" target="_top">
<code class="literal">apmd</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=apmd" target="_top">http://qa.debian.org/popcon.php?package=apmd</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/apmd.html" target="_top">252</a></td>
<td align="left">
daemon to manage events delivered by the Advanced Power Management (APM)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/noflushd" target="_top">
<code class="literal">noflushd</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=noflushd" target="_top">http://qa.debian.org/popcon.php?package=noflushd</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/n/noflushd.html" target="_top">248</a></td>
<td align="left">
daemon to allow idle hard disks to spin down
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/sleepd" target="_top">
<code class="literal">sleepd</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=sleepd" target="_top">http://qa.debian.org/popcon.php?package=sleepd</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/sleepd.html" target="_top">148</a></td>
<td align="left">
daemon to put a laptop to sleep during inactivity
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/hdparm" target="_top">
<code class="literal">hdparm</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=hdparm" target="_top">http://qa.debian.org/popcon.php?package=hdparm</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/h/hdparm.html" target="_top">284</a></td>
<td align="left">
hard disk access optimization (see <a class="xref" href="ch09.en.html#_optimization_of_hard_disk" title="9.3.8. Optimization of hard disk">Section 9.3.8, “Optimization of hard disk”</a>)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/smartmontools" target="_top">
<code class="literal">smartmontools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=smartmontools" target="_top">http://qa.debian.org/popcon.php?package=smartmontools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/smartmontools.html" target="_top">1149</a></td>
<td align="left">
control and monitor storage systems using <a class="ulink" href="http://en.wikipedia.org/wiki/S.M.A.R.T." target="_top">S.M.A.R.T.</a>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/setserial" target="_top">
<code class="literal">setserial</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=setserial" target="_top">http://qa.debian.org/popcon.php?package=setserial</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/setserial.html" target="_top">147</a></td>
<td align="left">
collection of tools for serial port management
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/memtest86+" target="_top">
<code class="literal">memtest86+</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=memtest86+" target="_top">http://qa.debian.org/popcon.php?package=memtest86+</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/m/memtest86+.html" target="_top">2342</a></td>
<td align="left">
collection of tools for memory hardware management
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/scsitools" target="_top">
<code class="literal">scsitools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=scsitools" target="_top">http://qa.debian.org/popcon.php?package=scsitools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/scsitools.html" target="_top">316</a></td>
<td align="left">
collection of tools for <a class="ulink" href="http://en.wikipedia.org/wiki/SCSI" target="_top">SCSI</a> hardware management
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/tpconfig" target="_top">
<code class="literal">tpconfig</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=tpconfig" target="_top">http://qa.debian.org/popcon.php?package=tpconfig</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/t/tpconfig.html" target="_top">164</a></td>
<td align="left">
utility to configure touchpad devices
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/setcd" target="_top">
<code class="literal">setcd</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=setcd" target="_top">http://qa.debian.org/popcon.php?package=setcd</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/setcd.html" target="_top">28</a></td>
<td align="left">
compact disc drive access optimization
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/big-cursor" target="_top">
<code class="literal">big-cursor</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=big-cursor" target="_top">http://qa.debian.org/popcon.php?package=big-cursor</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/big-cursor.html" target="_top">68</a></td>
<td align="left">
larger mouse cursors for X
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>Here, <a class="ulink" href="http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface" target="_top">ACPI</a> is a newer framework for the power management system than <a class="ulink" href="http://en.wikipedia.org/wiki/Advanced_Power_Management" target="_top">APM</a>.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>CPU frequency scaling on modern system is governed by kernel modules such as <code class="literal">acpi_cpufreq</code>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_system_and_hardware_time"></a>9.6.5. System and hardware time</h3></div></div></div>
<p>The following sets system and hardware time to MM/DD hh:mm, CCYY.</p>
<pre class="screen"># date MMDDhhmmCCYY
# hwclock --utc --systohc
# hwclock --show</pre>
<p>Times are normally displayed in the local time on the Debian system but the hardware and system time usually use <a class="ulink" href="http://en.wikipedia.org/wiki/Universal_Time" target="_top">UT(GMT)</a>.</p>
<p>If the hardware (BIOS) time is set to UT, change the setting to "<code class="literal">UTC=yes</code>" in the "<code class="literal">/etc/default/rcS</code>".</p>
<p>If you wish to update system time via network, consider to use the <a class="ulink" href="http://en.wikipedia.org/wiki/Network_Time_Protocol" target="_top">NTP</a> service with the packages such as <code class="literal">ntp</code>, <code class="literal">ntpdate</code>, and <code class="literal">chrony</code>.</p>
<p>See the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
<a class="ulink" href="http://www.tldp.org/HOWTO/TimePrecision-HOWTO/index.html" target="_top">Managing Accurate Date and Time HOWTO</a>
</p></li>
<li class="listitem"><p>
<a class="ulink" href="http://www.ntp.org/" target="_top">NTP Public Services Project</a>
</p></li>
<li class="listitem"><p>
The <code class="literal">ntp-doc</code> package
</p></li>
</ul></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p><span class="citerefentry"><span class="refentrytitle">ntptrace</span>(8)</span> in the <code class="literal">ntp</code> package can trace a chain of NTP servers back to the primary source.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_terminal_configuration"></a>9.6.6. The terminal configuration</h3></div></div></div>
<p>There are several components to configure character console and <span class="citerefentry"><span class="refentrytitle">ncurses</span>(3)</span> system features.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The "<code class="literal">/etc/terminfo/*/*</code>" file (<span class="citerefentry"><span class="refentrytitle">terminfo</span>(5)</span>)
</p></li>
<li class="listitem"><p>
The "<code class="literal">$TERM</code>" environment variable (<span class="citerefentry"><span class="refentrytitle">term</span>(7)</span>)
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">setterm</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">stty</span>(1)</span>, <span class="citerefentry"><span class="refentrytitle">tic</span>(1)</span>, and <span class="citerefentry"><span class="refentrytitle">toe</span>(1)</span>
</p></li>
</ul></div>
<p>If the <code class="literal">terminfo</code> entry for <code class="literal">xterm</code> doesn't work with a non-Debian <code class="literal">xterm</code>, change your terminal type, "<code class="literal">$TERM</code>", from "<code class="literal">xterm</code>" to one of the feature-limited versions such as "<code class="literal">xterm-r6</code>" when you log in to a Debian system remotely. See "<code class="literal">/usr/share/doc/libncurses5/FAQ</code>" for more. "<code class="literal">dumb</code>" is the lowest common denominator for "<code class="literal">$TERM</code>".</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_the_sound_infrastructure"></a>9.6.7. The sound infrastructure</h3></div></div></div>
<p>Device drivers for sound cards for current Linux 2.6 are provided by <a class="ulink" href="http://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture" target="_top">Advanced Linux Sound Architecture (ALSA)</a>. ALSA provides emulation mode for previous <a class="ulink" href="http://en.wikipedia.org/wiki/Open_Sound_System" target="_top">Open Sound System (OSS)</a> for compatibility.</p>
<p>Run "<code class="literal">dpkg-reconfigure linux-sound-base</code>" to select the sound system to use ALSA via blacklisting of kernel modules. Unless you have very new sound hardware, udev infrastructure should configure your sound system.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Use "<code class="literal">cat /dev/urandom &gt; /dev/audio</code>" or <span class="citerefentry"><span class="refentrytitle">speaker-test</span>(1)</span> to test speaker. (^C to stop)</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>If you can not get sound, your speaker may be connected to a muted output. Modern sound system has many outputs. <span class="citerefentry"><span class="refentrytitle">alsamixer</span>(1)</span> in the <code class="literal">alsa-utils</code> package is useful to configure volume and mute settings.</p></td></tr>
</table></div>
<p>Application softwares may be configured not only to access sound devices directly but also to access them via some standardized sound server system.</p>
<div class="table">
<a name="listofsoundpackages"></a><p class="title"><b>Table 9.18. List of sound packages</b></p>
<div class="table-contents"><table summary="List of sound packages" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/linux-sound-base" target="_top">
<code class="literal">linux-sound-base</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=linux-sound-base" target="_top">http://qa.debian.org/popcon.php?package=linux-sound-base</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/linux-sound-base.html" target="_top">128</a></td>
<td align="left">
base package for ALSA and OSS sound systems
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/alsa-base" target="_top">
<code class="literal">alsa-base</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=alsa-base" target="_top">http://qa.debian.org/popcon.php?package=alsa-base</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/alsa-base.html" target="_top">123
504</a></td>
<td align="left">
ALSA driver configuration files
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/alsa-utils" target="_top">
<code class="literal">alsa-utils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=alsa-utils" target="_top">http://qa.debian.org/popcon.php?package=alsa-utils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/alsa-utils.html" target="_top">1998</a></td>
<td align="left">
utilities for configuring and using ALSA
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/oss-compat" target="_top">
<code class="literal">oss-compat</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=oss-compat" target="_top">http://qa.debian.org/popcon.php?package=oss-compat</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/o/oss-compat.html" target="_top">53</a></td>
<td align="left">
OSS compatibility under ALSA preventing "<code class="literal">/dev/dsp not found</code>" errors
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/jackd" target="_top">
<code class="literal">jackd</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=jackd" target="_top">http://qa.debian.org/popcon.php?package=jackd</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/j/jackd.html" target="_top">32</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/JACK_Audio_Connection_Kit" target="_top">JACK Audio Connection Kit. (JACK)</a> server (low latency)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libjack0" target="_top">
<code class="literal">libjack0</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libjack0" target="_top">http://qa.debian.org/popcon.php?package=libjack0</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libj/libjack0.html" target="_top">137</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/JACK_Audio_Connection_Kit" target="_top">JACK Audio Connection Kit. (JACK)</a> library (low latency)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/nas" target="_top">
<code class="literal">nas</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=nas" target="_top">http://qa.debian.org/popcon.php?package=nas</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/n/nas.html" target="_top">267</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Network_Audio_System" target="_top">Network Audio System (NAS)</a> server
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libaudio2" target="_top">
<code class="literal">libaudio2</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libaudio2" target="_top">http://qa.debian.org/popcon.php?package=libaudio2</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/liba/libaudio2.html" target="_top">179</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Network_Audio_System" target="_top">Network Audio System (NAS)</a> library
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/pulseaudio" target="_top">
<code class="literal">pulseaudio</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=pulseaudio" target="_top">http://qa.debian.org/popcon.php?package=pulseaudio</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/pulseaudio.html" target="_top">4722</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/PulseAudio" target="_top">PulseAudio</a> server, replacement for ESD
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libpulse0" target="_top">
<code class="literal">libpulse0</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libpulse0" target="_top">http://qa.debian.org/popcon.php?package=libpulse0</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libp/libpulse0.html" target="_top">802</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/PulseAudio" target="_top">PulseAudio</a> client library, replacement for ESD
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libgstreamer0.10-0" target="_top">
<code class="literal">libgstreamer0.10-0</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libgstreamer0.10-0" target="_top">http://qa.debian.org/popcon.php?package=libgstreamer0.10-0</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libg/libgstreamer0.10-0.html" target="_top">3919</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/GStreamer" target="_top">GStreamer</a>: GNOME sound engine
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libxine1" target="_top">
<code class="literal">libxine1</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libxine1" target="_top">http://qa.debian.org/popcon.php?package=libxine1</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libx/libxine1.html" target="_top">29</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Xine" target="_top">xine</a>: KDE older sound engine
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libphonon4" target="_top">
<code class="literal">libphonon4</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libphonon4" target="_top">http://qa.debian.org/popcon.php?package=libphonon4</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libp/libphonon4.html" target="_top">574</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Phonon_(KDE)" target="_top">Phonon</a>: KDE sound engine
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>There is usually a common sound engine for each popular desktop environment. Each sound engine used by the application can choose to connect to different sound servers.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_disabling_the_screen_saver"></a>9.6.8. Disabling the screen saver</h3></div></div></div>
<p>For disabling the screen saver, use following commands.</p>
<div class="table">
<a name="listofcommandsfongthescreensaver"></a><p class="title"><b>Table 9.19. List of commands for disabling the screen saver</b></p>
<div class="table-contents"><table summary="List of commands for disabling the screen saver" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
environment
</th>
<th align="left">
command
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
The Linux console
</td>
<td align="left">
<code class="literal">setterm -powersave off</code>
</td>
</tr>
<tr>
<td align="left">
The X Window (turning off screensaver)
</td>
<td align="left">
<code class="literal">xset s off</code>
</td>
</tr>
<tr>
<td align="left">
The X Window (disabling dpms)
</td>
<td align="left">
<code class="literal">xset -dpms</code>
</td>
</tr>
<tr>
<td align="left">
The X Window (GUI configuration of screen saver)
</td>
<td align="left">
<code class="literal">xscreensaver-command -prefs</code>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_disabling_beep_sounds"></a>9.6.9. Disabling beep sounds</h3></div></div></div>
<p>One can always unplug the PC speaker to disable beep sounds. Removing <code class="literal">pcspkr</code> kernel module does this for you.</p>
<p>The following prevents the <span class="citerefentry"><span class="refentrytitle">readline</span>(3)</span> program used by <span class="citerefentry"><span class="refentrytitle">bash</span>(1)</span> to beep when encountering "<code class="literal">\a</code>" (ASCII=7).</p>
<pre class="screen">$ echo "set bell-style none"&gt;&gt; ~/.inputrc</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_memory_usage"></a>9.6.10. Memory usage</h3></div></div></div>
<p>The kernel boot message in the "<code class="literal">/var/log/dmesg</code>" contains the total exact size of available memory.</p>
<p><span class="citerefentry"><span class="refentrytitle">free</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">top</span>(1)</span> display information on memory resources on the running system.</p>
<pre class="screen"># grep '\] Memory' /var/log/dmesg
[ 0.004000] Memory: 990528k/1016784k available (1975k kernel code, 25868k reserved, 931k data, 296k init)
$ free -k
total used free shared buffers cached
Mem: 997184 976928 20256 0 129592 171932
-/+ buffers/cache: 675404 321780
Swap: 4545576 4 4545572</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Do not worry about the large size of "<code class="literal">used</code>" and the small size of "<code class="literal">free</code>" in the "<code class="literal">Mem:</code>" line, but read the one under them (675404 and 321780 in the example below) and relax.</p></td></tr>
</table></div>
<p>For my MacBook with 1GB=1048576k DRAM (video system steals some of this), I see the following.</p>
<div class="table">
<a name="listofmemorysizesreported"></a><p class="title"><b>Table 9.20. List of memory sizes reported</b></p>
<div class="table-contents"><table summary="List of memory sizes reported" border="1">
<colgroup>
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
report
</th>
<th align="left">
size
</th>
</tr></thead>
<tbody>
<tr>
<td align="left">
Total size in dmesg
</td>
<td align="left">
1016784k = 1GB - 31792k
</td>
</tr>
<tr>
<td align="left">
Free in dmesg
</td>
<td align="left">
990528k
</td>
</tr>
<tr>
<td align="left">
Total under shell
</td>
<td align="left">
997184k
</td>
</tr>
<tr>
<td align="left">
Free under shell
</td>
<td align="left">
20256k (but effectively 321780k)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_system_security_and_integrity_check"></a>9.6.11. System security and integrity check</h3></div></div></div>
<p>Poor system maintenance may expose your system to external exploitation.</p>
<p>For system security and integrity check, you should start with the following.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The <code class="literal">debsums</code> package, See <span class="citerefentry"><span class="refentrytitle">debsums</span>(1)</span> and <a class="xref" href="ch02.en.html#_top_level_release_file_and_authenticity" title='2.5.2. Top level "Release" file and authenticity'>Section 2.5.2, “Top level "Release" file and authenticity”</a>.
</p></li>
<li class="listitem"><p>
The <code class="literal">chkrootkit</code> package, See <span class="citerefentry"><span class="refentrytitle">chkrootkit</span>(1)</span>.
</p></li>
<li class="listitem"><p>
The <code class="literal">clamav</code> package family, See <span class="citerefentry"><span class="refentrytitle">clamscan</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">freahclam</span>(1)</span>.
</p></li>
<li class="listitem"><p><a class="ulink" href="http://www.debian.org/security/faq" target="_top">Debian security FAQ</a>.
</p></li>
<li class="listitem"><p><a class="ulink" href="http://www.debian.org/doc/manuals/securing-debian-howto/" target="_top">Securing Debian Manual</a>.
</p></li>
</ul></div>
<div class="table">
<a name="listoftoolsforsyndintegritycheck"></a><p class="title"><b>Table 9.21. List of tools for system security and integrity check</b></p>
<div class="table-contents"><table summary="List of tools for system security and integrity check" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/logcheck" target="_top">
<code class="literal">logcheck</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=logcheck" target="_top">http://qa.debian.org/popcon.php?package=logcheck</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/logcheck.html" target="_top">284</a></td>
<td align="left">
daemon to mail anomalies in the system logfiles to the administrator
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/debsums" target="_top">
<code class="literal">debsums</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=debsums" target="_top">http://qa.debian.org/popcon.php?package=debsums</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/debsums.html" target="_top">224</a></td>
<td align="left">
utility to verify installed package files against MD5 checksums
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/chkrootkit" target="_top">
<code class="literal">chkrootkit</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=chkrootkit" target="_top">http://qa.debian.org/popcon.php?package=chkrootkit</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/chkrootkit.html" target="_top">920</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Rootkit" target="_top">rootkit</a> detector
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/clamav" target="_top">
<code class="literal">clamav</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=clamav" target="_top">http://qa.debian.org/popcon.php?package=clamav</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/clamav.html" target="_top">584</a></td>
<td align="left">
anti-virus utility for Unix - command-line interface
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/tiger" target="_top">
<code class="literal">tiger</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=tiger" target="_top">http://qa.debian.org/popcon.php?package=tiger</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/t/tiger.html" target="_top">2374</a></td>
<td align="left">
report system security vulnerabilities
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/tripwire" target="_top">
<code class="literal">tripwire</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=tripwire" target="_top">http://qa.debian.org/popcon.php?package=tripwire</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/t/tripwire.html" target="_top">9029</a></td>
<td align="left">
file and directory integrity checker
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/john" target="_top">
<code class="literal">john</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=john" target="_top">http://qa.debian.org/popcon.php?package=john</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/j/john.html" target="_top">472</a></td>
<td align="left">
active password cracking tool
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/aide" target="_top">
<code class="literal">aide</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=aide" target="_top">http://qa.debian.org/popcon.php?package=aide</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/a/aide.html" target="_top">1320</a></td>
<td align="left">
Advanced Intrusion Detection Environment - static binary
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/bastille" target="_top">
<code class="literal">bastille</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=bastille" target="_top">http://qa.debian.org/popcon.php?package=bastille</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/bastille.html" target="_top">1960</a></td>
<td align="left">
security hardening tool
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/integrit" target="_top">
<code class="literal">integrit</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=integrit" target="_top">http://qa.debian.org/popcon.php?package=integrit</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/integrit.html" target="_top">440</a></td>
<td align="left">
file integrity verification program
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/crack" target="_top">
<code class="literal">crack</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=crack" target="_top">http://qa.debian.org/popcon.php?package=crack</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/crack.html" target="_top">160</a></td>
<td align="left">
password guessing program
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>Here is a simple script to check for typical world writable incorrect file permissions.</p>
<pre class="screen"># find / -perm 777 -a \! -type s -a \! -type l -a \! \( -type d -a -perm 1777 \)</pre>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Since the <code class="literal">debsums</code> package uses <a class="ulink" href="http://en.wikipedia.org/wiki/MD5" target="_top">MD5</a> checksums stored locally, it can not be fully trusted as the system security audit tool against malicious attacks.</p></td></tr>
</table></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_the_kernel"></a>9.7. The kernel</h2></div></div></div>
<p>Debian distributes modularized <a class="ulink" href="http://en.wikipedia.org/wiki/Linux_kernel" target="_top">Linux kernel</a> as packages for supported architectures.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_linux_kernel_2_6"></a>9.7.1. Linux kernel 2.6</h3></div></div></div>
<p>There are few notable features on Linux kernel 2.6 compared to 2.4.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Devices are created by the udev system (see <a class="xref" href="ch03.en.html#_the_udev_system" title="3.5.11. The udev system">Section 3.5.11, “The udev system”</a>).
</p></li>
<li class="listitem"><p>
Read/write accesses to IDE CD/DVD devices do not use the <code class="literal">ide-scsi</code> module.
</p></li>
<li class="listitem"><p>
Network packet filtering functions use <code class="literal">iptable</code> kernel modules.
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_kernel_parameters"></a>9.7.2. Kernel parameters</h3></div></div></div>
<p>Many Linux features are configurable via kernel parameters as follows.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Kernel parameters initialized by the bootloader (see <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.3. Stage 2: the boot loader">Section 3.3, “Stage 2: the boot loader”</a>)
</p></li>
<li class="listitem"><p>
Kernel parameters changed by <span class="citerefentry"><span class="refentrytitle">sysctl</span>(8)</span> at runtime for ones accessible via sysfs (see <a class="xref" href="ch01.en.html#_procfs_and_sysfs" title="1.2.12. procfs and sysfs">Section 1.2.12, “procfs and sysfs”</a>)
</p></li>
<li class="listitem"><p>
Module parameters set by arguments of <span class="citerefentry"><span class="refentrytitle">modprobe</span>(8)</span> when a module is activated (see <a class="xref" href="ch10.en.html#_mounting_the_disk_image_file" title="10.2.3. Mounting the disk image file">Section 10.2.3, “Mounting the disk image file”</a>)
</p></li>
</ul></div>
<p>See "<code class="literal">kernel-parameters.txt(.gz)</code>" and other related documents in the Linux kernel documentation ("<code class="literal">/usr/share/doc/linux-doc-2.6.*/Documentation/filesystems/*</code>") provided by the <code class="literal">linux-doc-2.6.*</code> package.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_kernel_headers"></a>9.7.3. Kernel headers</h3></div></div></div>
<p>Most <span class="strong"><strong>normal programs</strong></span> don't need kernel headers and in fact may break if you use them directly for compiling. They should be compiled against the headers in "<code class="literal">/usr/include/linux</code>" and "<code class="literal">/usr/include/asm</code>" provided by the <code class="literal">libc6-dev</code> package (created from the <code class="literal">glibc</code> source package) on the Debian system.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>For compiling some kernel-specific programs such as the kernel modules from the external source and the automounter daemon (<code class="literal">amd</code>), you must include path to the corresponding kernel headers, e.g. "<code class="literal">-I/usr/src/linux-particular-version/include/</code>", to your command line. <span class="citerefentry"><span class="refentrytitle">module-assistant</span>(8)</span> (or its short form <code class="literal">m-a</code>) helps users to build and install module package(s) easily for one or more custom kernels.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_compiling_the_kernel_and_related_modules"></a>9.7.4. Compiling the kernel and related modules</h3></div></div></div>
<p>Debian has its own method of compiling the kernel and related modules.</p>
<div class="table">
<a name="listofkeypackagenthedebiansystem"></a><p class="title"><b>Table 9.22. List of key packages to be installed for the kernel recompilation on the Debian system</b></p>
<div class="table-contents"><table summary="List of key packages to be installed for the kernel recompilation on the Debian system" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/build-essential" target="_top">
<code class="literal">build-essential</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=build-essential" target="_top">http://qa.debian.org/popcon.php?package=build-essential</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/build-essential.html" target="_top">48</a></td>
<td align="left">
essential packages for building Debian packages: <code class="literal">make</code>, <code class="literal">gcc</code>, …
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/bzip2" target="_top">
<code class="literal">bzip2</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=bzip2" target="_top">http://qa.debian.org/popcon.php?package=bzip2</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/bzip2.html" target="_top">86</a></td>
<td align="left">
compress and decompress utilities for bz2 files
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libncurses5-dev" target="_top">
<code class="literal">libncurses5-dev</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libncurses5-dev" target="_top">http://qa.debian.org/popcon.php?package=libncurses5-dev</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libn/libncurses5-dev.html" target="_top">1007</a></td>
<td align="left">
developer's libraries and docs for ncurses
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/git" target="_top">
<code class="literal">git</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=git" target="_top">http://qa.debian.org/popcon.php?package=git</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/g/git.html" target="_top">13073</a></td>
<td align="left">
git: distributed revision control system used by the Linux kernel
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/fakeroot" target="_top">
<code class="literal">fakeroot</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=fakeroot" target="_top">http://qa.debian.org/popcon.php?package=fakeroot</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/f/fakeroot.html" target="_top">316</a></td>
<td align="left">
provide fakeroot environment for building package as non-root
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/initramfs-tools" target="_top">
<code class="literal">initramfs-tools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=initramfs-tools" target="_top">http://qa.debian.org/popcon.php?package=initramfs-tools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/i/initramfs-tools.html" target="_top">321</a></td>
<td align="left">
tool to build an initramfs (Debian specific)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/dkms" target="_top">
<code class="literal">dkms</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=dkms" target="_top">http://qa.debian.org/popcon.php?package=dkms</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/dkms.html" target="_top">338</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support" target="_top">dynamic kernel module support (DKMS)</a> (generic)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/devscripts" target="_top">
<code class="literal">devscripts</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=devscripts" target="_top">http://qa.debian.org/popcon.php?package=devscripts</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/devscripts.html" target="_top">1506</a></td>
<td align="left">
helper scripts for a Debian Package maintainer (Debian specific)
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>If you use <code class="literal">initrd</code> in <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.3. Stage 2: the boot loader">Section 3.3, “Stage 2: the boot loader”</a>, make sure to read the related information in <span class="citerefentry"><span class="refentrytitle">initramfs-tools</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">update-initramfs</span>(8)</span>, <span class="citerefentry"><span class="refentrytitle">mkinitramfs</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">initramfs.conf</span>(5)</span>.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>Do not put symlinks to the directories in the source tree (e.g. "<code class="literal">/usr/src/linux*</code>") from "<code class="literal">/usr/include/linux</code>" and "<code class="literal">/usr/include/asm</code>" when compiling the Linux kernel source. (Some outdated documents suggest this.)</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>When compiling the latest Linux kernel on the Debian <code class="literal">stable</code> system, the use of backported latest tools from the Debian <code class="literal">unstable</code> may be needed.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support" target="_top">dynamic kernel module support (DKMS)</a> is a new distribution independent framework designed to allow individual kernel modules to be upgraded without changing the whole kernel. This will be endorsed for the maintenance of out-of-tree modules for <code class="literal">squeeze</code>. This also makes it very easy to rebuild modules as you upgrade kernels.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_compiling_the_kernel_source_debian_kernel_team_recommendation"></a>9.7.5. Compiling the kernel source: Debian Kernel Team recommendation</h3></div></div></div>
<p>For building custom kernel binary packages from the upstream kernel source, you should use the "<code class="literal">deb-pkg</code>" target provided by it.</p>
<pre class="screen">$ sudo apt-get build-dep linux-2.6
$ cd /usr/src
$ wget http://www.kernel.org/pub/linux/kernel/v3.2/linux-&lt;version&gt;.tar.bz2
$ tar -xjvf linux-&lt;version&gt;.tar.bz2
$ cd linux-&lt;version&gt;
$ cp /boot/config-&lt;version&gt; .config
$ make menuconfig
...
$ make deb-pkg</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The linux-source-&lt;version&gt; package provides the Linux kernel source with Debian patches as "<code class="literal">/usr/src/linux-&lt;version&gt;.tar.bz2</code>".</p></td></tr>
</table></div>
<p>For building specific binary packages from the Debian kernel source package, you should use the "<code class="literal">binary-arch_&lt;architecture&gt;<span class="emphasis"><em>&lt;featureset&gt;</em></span>&lt;flavour&gt;</code>" targets in "<code class="literal">debian/rules.gen</code>".</p>
<pre class="screen">$ sudo apt-get build-dep linux-2.6
$ apt-get source linux-2.6
$ cd linux-2.6-*
$ fakeroot make -f debian/rules.gen binary-arch_i386_none_686</pre>
<p>See further information:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
Debian Wiki: <a class="ulink" href="http://wiki.debian.org/KernelFAQ" target="_top">KernelFAQ</a>
</p></li>
<li class="listitem"><p>
Debian Wiki: <a class="ulink" href="http://wiki.debian.org/DebianKernel" target="_top">DebianKernel</a>
</p></li>
<li class="listitem"><p>
Debian Linux Kernel Handbook: <a class="ulink" href="http://kernel-handbook.alioth.debian.org" target="_top">http://kernel-handbook.alioth.debian.org</a>
</p></li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_non_free_hardware_drivers"></a>9.7.6. Non-free hardware drivers</h3></div></div></div>
<p>Although most of hardware drivers are available as free software and as a part of the Debian system, you may need to load some non-free external drivers to support some hardwares, such as Winmodem, on your system.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Check available firmware packages with "<code class="literal">aptitude search ^firmware</code>" while enabling the non-free repository.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The <a class="ulink" href="http://en.wikipedia.org/wiki/NDISwrapper" target="_top">NDISwrapper</a> can use Windows XP network drivers natively on Linux. Check "<code class="literal">aptitude search ^ndis</code>".</p></td></tr>
</table></div>
<p>Check pertinent resources.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
<a class="ulink" href="http://wiki.debian.org/KernelFirmwareLicensing" target="_top">http://wiki.debian.org/KernelFirmwareLicensing</a>
</p></li>
<li class="listitem"><p>
<a class="ulink" href="http://en.wikipedia.org/wiki/Comparison_of_open_source_wireless_drivers" target="_top">http://en.wikipedia.org/wiki/Comparison_of_open_source_wireless_drivers</a>
</p></li>
<li class="listitem"><p>
<a class="ulink" href="http://en.wikipedia.org/wiki/Softmodem" target="_top">http://en.wikipedia.org/wiki/Softmodem</a>
</p></li>
</ul></div>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="_virtualized_system"></a>9.8. Virtualized system</h2></div></div></div>
<p>Use of virtualized system enables us to run multiple instances of system simultaneously on a single hardware.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>See <a class="ulink" href="http://wiki.debian.org/SystemVirtualization" target="_top">http://wiki.debian.org/SystemVirtualization</a> .</p></td></tr>
</table></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_virtualization_tools"></a>9.8.1. Virtualization tools</h3></div></div></div>
<p>There are several system <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization" target="_top">virtualization</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Emulator" target="_top">emulation</a> related packages in Debian beyond simple <a class="ulink" href="http://en.wikipedia.org/wiki/Chroot" target="_top">chroot</a>. Some packages also help you to setup such system.</p>
<div class="table">
<a name="listofvirtualizationtools"></a><p class="title"><b>Table 9.23. List of virtualization tools</b></p>
<div class="table-contents"><table summary="List of virtualization tools" border="1">
<colgroup>
<col align="left">
<col align="left">
<col align="left">
<col align="left">
</colgroup>
<thead><tr>
<th align="left">
package
</th>
<th align="left">
popcon
</th>
<th align="left">
size
</th>
<th align="left">
description
</th>
</tr></thead>
<tbody>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/schroot" target="_top">
<code class="literal">schroot</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=schroot" target="_top">http://qa.debian.org/popcon.php?package=schroot</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/schroot.html" target="_top">2293</a></td>
<td align="left">
specialized tool for executing Debian binary packages in chroot
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/sbuild" target="_top">
<code class="literal">sbuild</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=sbuild" target="_top">http://qa.debian.org/popcon.php?package=sbuild</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/s/sbuild.html" target="_top">465</a></td>
<td align="left">
tool for building Debian binary packages from Debian sources
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/pbuilder" target="_top">
<code class="literal">pbuilder</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=pbuilder" target="_top">http://qa.debian.org/popcon.php?package=pbuilder</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/p/pbuilder.html" target="_top">992</a></td>
<td align="left">
personal package builder for Debian packages
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/debootstrap" target="_top">
<code class="literal">debootstrap</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=debootstrap" target="_top">http://qa.debian.org/popcon.php?package=debootstrap</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/debootstrap.html" target="_top">225</a></td>
<td align="left">
bootstrap a basic Debian system (written in sh)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/cdebootstrap" target="_top">
<code class="literal">cdebootstrap</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=cdebootstrap" target="_top">http://qa.debian.org/popcon.php?package=cdebootstrap</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/c/cdebootstrap.html" target="_top">71</a></td>
<td align="left">
bootstrap a Debian system (written in C)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/rootstrap" target="_top">
<code class="literal">rootstrap</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=rootstrap" target="_top">http://qa.debian.org/popcon.php?package=rootstrap</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/r/rootstrap.html" target="_top">97</a></td>
<td align="left">
tool for building complete Linux filesystem images
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/virt-manager" target="_top">
<code class="literal">virt-manager</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=virt-manager" target="_top">http://qa.debian.org/popcon.php?package=virt-manager</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/v/virt-manager.html" target="_top">5372</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Virtual_Machine_Manager" target="_top">Virtual Machine Manager</a>: desktop application for managing virtual machines
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/libvirt-bin" target="_top">
<code class="literal">libvirt-bin</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=libvirt-bin" target="_top">http://qa.debian.org/popcon.php?package=libvirt-bin</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/libv/libvirt-bin.html" target="_top">4595</a></td>
<td align="left">
programs for the <a class="ulink" href="http://en.wikipedia.org/wiki/Libvirt" target="_top">libvirt</a> library
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/user-mode-linux" target="_top">
<code class="literal">user-mode-linux</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=user-mode-linux" target="_top">http://qa.debian.org/popcon.php?package=user-mode-linux</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/u/user-mode-linux.html" target="_top">24015</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/User-mode_Linux" target="_top">User-mode Linux</a> (kernel)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/bochs" target="_top">
<code class="literal">bochs</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=bochs" target="_top">http://qa.debian.org/popcon.php?package=bochs</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/b/bochs.html" target="_top">3018</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Bochs" target="_top">Bochs</a>: IA-32 PC emulator
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/qemu" target="_top">
<code class="literal">qemu</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu" target="_top">http://qa.debian.org/popcon.php?package=qemu</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/q/qemu.html" target="_top">358</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>: fast generic processor emulator
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/qemu-system" target="_top">
<code class="literal">qemu-system</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-system" target="_top">http://qa.debian.org/popcon.php?package=qemu-system</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/q/qemu-system.html" target="_top">76945</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>: full system emulation binaries
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/qemu-user" target="_top">
<code class="literal">qemu-user</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-user" target="_top">http://qa.debian.org/popcon.php?package=qemu-user</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/q/qemu-user.html" target="_top">44931</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>: user mode emulation binaries
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/qemu-utils" target="_top">
<code class="literal">qemu-utils</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-utils" target="_top">http://qa.debian.org/popcon.php?package=qemu-utils</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/q/qemu-utils.html" target="_top">1374</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>: utilities
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/qemu-kvm" target="_top">
<code class="literal">qemu-kvm</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=qemu-kvm" target="_top">http://qa.debian.org/popcon.php?package=qemu-kvm</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/q/qemu-kvm.html" target="_top">4722</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine" target="_top">KVM</a>: full virtualization on x86 hardware with the <a class="ulink" href="http://en.wikipedia.org/wiki/Hardware-assisted_virtualization" target="_top">hardware-assisted virtualization</a>
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/virtualbox-ose" target="_top">
<code class="literal">virtualbox-ose</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=virtualbox-ose" target="_top">http://qa.debian.org/popcon.php?package=virtualbox-ose</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/v/virtualbox-ose.html" target="_top">118</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox" target="_top">VirtualBox</a>: x86 virtualization solution on i386 and amd64
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/xen-tools" target="_top">
<code class="literal">xen-tools</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=xen-tools" target="_top">http://qa.debian.org/popcon.php?package=xen-tools</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/x/xen-tools.html" target="_top">1228</a></td>
<td align="left">
tools to manage debian <a class="ulink" href="http://en.wikipedia.org/wiki/Xen" target="_top">XEN</a> virtual server
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/wine" target="_top">
<code class="literal">wine</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=wine" target="_top">http://qa.debian.org/popcon.php?package=wine</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/w/wine.html" target="_top">41</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/Wine_(software)" target="_top">Wine</a>: Windows API Implementation (standard suite)
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/dosbox" target="_top">
<code class="literal">dosbox</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=dosbox" target="_top">http://qa.debian.org/popcon.php?package=dosbox</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/dosbox.html" target="_top">2526</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/DOSBox" target="_top">DOSBox</a>: x86 emulator with Tandy/Herc/CGA/EGA/VGA/SVGA graphics, sound and DOS
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/dosemu" target="_top">
<code class="literal">dosemu</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=dosemu" target="_top">http://qa.debian.org/popcon.php?package=dosemu</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/d/dosemu.html" target="_top">5944</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/DOSEMU" target="_top">DOSEMU</a>: The Linux DOS Emulator
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/vzctl" target="_top">
<code class="literal">vzctl</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=vzctl" target="_top">http://qa.debian.org/popcon.php?package=vzctl</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/v/vzctl.html" target="_top">660</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/OpenVZ" target="_top">OpenVZ</a> server virtualization solution - control tools
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/vzquota" target="_top">
<code class="literal">vzquota</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=vzquota" target="_top">http://qa.debian.org/popcon.php?package=vzquota</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/v/vzquota.html" target="_top">204</a></td>
<td align="left">
<a class="ulink" href="http://en.wikipedia.org/wiki/OpenVZ" target="_top">OpenVZ</a> server virtualization solution - quota tools
</td>
</tr>
<tr>
<td align="left"><a class="ulink" href="http://packages.debian.org/sid/lxc" target="_top">
<code class="literal">lxc</code>
</a></td>
<td align="left"><a class="ulink" href="http://qa.debian.org/popcon.php?package=lxc" target="_top">http://qa.debian.org/popcon.php?package=lxc</a></td>
<td align="left"><a class="ulink" href="http://packages.qa.debian.org/l/lxc.html" target="_top">692</a></td>
<td align="left">
<a class="ulink" href="http://lxc.sourceforge.net/" target="_top">Linux containers</a> user space tools
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>See Wikipedia article <a class="ulink" href="http://en.wikipedia.org/wiki/Comparison_of_platform_virtual_machines" target="_top">Comparison of platform virtual machines</a> for detail comparison of different platform virtualization solutions.</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_virtualization_work_flow"></a>9.8.2. Virtualization work flow</h3></div></div></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Some functionalities described here are only available in <code class="literal">squeeze</code>.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Default Debian kernels support <a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine" target="_top">KVM</a> since <code class="literal">lenny</code>.</p></td></tr>
</table></div>
<p>Typical work flow for <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization" target="_top">virtualization</a> involves several steps.</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
Create an empty filesystem (a file tree or a disk image).
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
The file tree can be created by "<code class="literal">mkdir -p /path/to/chroot</code>".
</p></li>
<li class="listitem"><p>
The raw disk image file can be created with <span class="citerefentry"><span class="refentrytitle">dd</span>(1)</span> (see <a class="xref" href="ch10.en.html#_making_the_disk_image_file" title="10.2.1. Making the disk image file">Section 10.2.1, “Making the disk image file”</a> and <a class="xref" href="ch10.en.html#_making_the_empty_disk_image_file" title="10.2.5. Making the empty disk image file">Section 10.2.5, “Making the empty disk image file”</a>).
</p></li>
<li class="listitem"><p><span class="citerefentry"><span class="refentrytitle">qemu-img</span>(1)</span> can be used to create and convert disk image files supported by <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>.
</p></li>
<li class="listitem"><p>
The raw and <a class="ulink" href="http://en.wikipedia.org/wiki/VMDK" target="_top">VMDK</a> file format can be used as common format among virtualization tools.
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Mount the disk image with <span class="citerefentry"><span class="refentrytitle">mount</span>(8)</span> to the filesystem (optional).
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
For the raw disk image file, mount it as <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device" target="_top">loop device</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/Device_mapper" target="_top">device mapper</a> devices (see <a class="xref" href="ch10.en.html#_mounting_the_disk_image_file" title="10.2.3. Mounting the disk image file">Section 10.2.3, “Mounting the disk image file”</a>).
</p></li>
<li class="listitem"><p>
For disk images supported by <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>, mount them as <a class="ulink" href="http://en.wikipedia.org/wiki/Network_block_device" target="_top">network block device</a> (see <a class="xref" href="ch09.en.html#_mounting_the_virtual_disk_image_file" title="9.8.3. Mounting the virtual disk image file">Section 9.8.3, “Mounting the virtual disk image file”</a>).
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Populate the target filesystem with required system data.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p>
Use programs such as <code class="literal">debootstrap</code> and <code class="literal">cdebootstrap</code> help this process (see <a class="xref" href="ch09.en.html#_chroot_system" title="9.8.4. Chroot system">Section 9.8.4, “Chroot system”</a>).
</p></li>
<li class="listitem"><p>
Use installers of OSs under the full system emulation.
</p></li>
</ul></div>
</li>
<li class="listitem">
<p>
Run a program under a virtualized environment.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem"><p><a class="ulink" href="http://en.wikipedia.org/wiki/Chroot" target="_top">chroot</a> provides basic virtualized environment enough to compile programs, run console applications, and run daemons in it.
</p></li>
<li class="listitem"><p><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a> provides cross-platform CPU emulation.
</p></li>
<li class="listitem"><p><a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a> with <a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine" target="_top">KVM</a> provides full system emulation by the <a class="ulink" href="http://en.wikipedia.org/wiki/Hardware-assisted_virtualization" target="_top">hardware-assisted virtualization</a>.
</p></li>
<li class="listitem"><p><a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox" target="_top">VirtualBox</a> provides full system emulation on i386 and amd64 with or without the <a class="ulink" href="http://en.wikipedia.org/wiki/Hardware-assisted_virtualization" target="_top">hardware-assisted virtualization</a>.
</p></li>
</ul></div>
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_mounting_the_virtual_disk_image_file"></a>9.8.3. Mounting the virtual disk image file</h3></div></div></div>
<p>For the raw disk image file, see <a class="xref" href="ch10.en.html#_the_disk_image" title="10.2. The disk image">Section 10.2, “The disk image”</a>.</p>
<p>For other virtual disk image files, you can use <span class="citerefentry"><span class="refentrytitle">qemu-nbd</span>(8)</span> to export them using <a class="ulink" href="http://en.wikipedia.org/wiki/Network_block_device" target="_top">network block device</a> protocol and mount them using the <code class="literal">nbd</code> kernel module.</p>
<p><span class="citerefentry"><span class="refentrytitle">qemu-nbd</span>(8)</span> supports disk formats supported by <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a>: <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a> supports following disk formats: raw, <a class="ulink" href="http://en.wikipedia.org/wiki/Qcow" target="_top">qcow2, qcow</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/VMDK" target="_top">vmdk</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox#Virtual_Desktop_Image" target="_top">vdi</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Bochs" target="_top">bochs</a>, cow (user-mode Linux copy-on-write), <a class="ulink" href="http://en.wikipedia.org/wiki/Parallels_Workstation" target="_top">parallels</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Apple_Disk_Image" target="_top">dmg</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Cloop" target="_top">cloop</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/VHD_(file_format)" target="_top">vpc</a>, vvfat (virtual VFAT), and host_device.</p>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Network_block_device" target="_top">network block device</a> can support partitions in the same way as the <a class="ulink" href="http://en.wikipedia.org/wiki/Loop_device" target="_top">loop device</a> (see <a class="xref" href="ch10.en.html#_mounting_the_disk_image_file" title="10.2.3. Mounting the disk image file">Section 10.2.3, “Mounting the disk image file”</a>). You can mount the first partition of "<code class="literal">disk.img</code>" as follows.</p>
<pre class="screen"># modprobe nbd max_part=16
# qemu-nbd -v -c /dev/nbd0 disk.img
...
# mkdir /mnt/part1
# mount /dev/nbd0p1 /mnt/part1</pre>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>You may export only the first partition of "<code class="literal">disk.img</code>" using "<code class="literal">-P 1</code>" option to <span class="citerefentry"><span class="refentrytitle">qemu-nbd</span>(8)</span>.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_chroot_system"></a>9.8.4. Chroot system</h3></div></div></div>
<p><span class="citerefentry"><span class="refentrytitle">chroot</span>(8)</span> offers most basic way to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting.</p>
<div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>Examples below assumes both parent system and chroot system share the same CPU architecture.</p></td></tr>
</table></div>
<p>You can learn how to setup and use <span class="citerefentry"><span class="refentrytitle">chroot</span>(8)</span> by running <span class="citerefentry"><span class="refentrytitle">pbuilder</span>(8)</span> program under <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span> as follows.</p>
<pre class="screen">$ sudo mkdir /sid-root
$ sudo pbuilder --create --no-targz --debug --buildplace /sid-root</pre>
<p>You see how <span class="citerefentry"><span class="refentrytitle">debootstrap</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">cdebootstrap</span>(1)</span> populate system data for <code class="literal">sid</code> environment under "<code class="literal">/sid-root</code>".</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>These <span class="citerefentry"><span class="refentrytitle">debootstrap</span>(8)</span> or <span class="citerefentry"><span class="refentrytitle">cdebootstrap</span>(1)</span> are used to <a class="ulink" href="http://www.debian.org/releases/stable/installmanual" target="_top">install Debian</a> by the Debian Installer. These can also be used to install Debian to a system without using a Debian install disk, but instead from another GNU/Linux distribution.</p></td></tr>
</table></div>
<pre class="screen">$ sudo pbuilder --login --no-targz --debug --buildplace /sid-root</pre>
<p>You see how a system shell running under <code class="literal">sid</code> environment is created as the following.</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>
Copy local configuration (<code class="literal">"/etc/hosts</code>", <code class="literal">"/etc/hostname</code>", <code class="literal">"/etc/resolv.conf</code>")
</p></li>
<li class="listitem"><p>
Mount "<code class="literal">/proc</code>" filesystem
</p></li>
<li class="listitem"><p>
Mount "<code class="literal">/dev/pts</code>" filesystem
</p></li>
<li class="listitem"><p>
Create "<code class="literal">/usr/sbin/policy-rc.d</code>" which always exits with 101
</p></li>
<li class="listitem"><p>
Run "<code class="literal">chroot /sid-root bin/bash -c 'exec -a -bash bin/bash'</code>"
</p></li>
</ol></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Some programs under chroot may require access to more files from the parent system to function than <code class="literal">pbuilder</code> provides. For example, "<code class="literal">/sys</code>", "<code class="literal">/etc/passwd</code>", "<code class="literal">/etc/group</code>", "<code class="literal">/var/run/utmp</code>", "<code class="literal">/var/log/wtmp</code>", etc. may need to be bind-mounted or copied.</p></td></tr>
</table></div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>The "<code class="literal">/usr/sbin/policy-rc.d</code>" file prevents daemon programs to be started automatically on Debian system. See "<code class="literal">/usr/share/doc/sysv-rc/README.policy-rc.d.gz</code>".</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>The original purpose of the specialized chroot package, <code class="literal">pbuilder</code> is to construct a chroot system and builds a package inside the chroot. It is an ideal system to use to check that a package's build-dependencies are correct, and to be sure that unnecessary and wrong build dependencies do not exist in the resulting package.</p></td></tr>
</table></div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Similar <code class="literal">schroot</code> package may give you an idea to run <code class="literal">i386</code> chroot system under <code class="literal">amd64</code> parent system.</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="_multiple_desktop_systems"></a>9.8.5. Multiple desktop systems</h3></div></div></div>
<p>I recommend you to use <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox" target="_top">VirtualBox</a> on a Debian <code class="literal">stable</code> system to run multiple desktop systems safely using <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization" target="_top">virtualization</a>. These enable you to run desktop applications of Debian <code class="literal">unstable</code> and <code class="literal">testing</code> without usual risks associated with them.</p>
<p>Since pure <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a> is very slow, it is recommended to accelerate it with <a class="ulink" href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine" target="_top">KVM</a> when the host system support it.</p>
<p>The virtual disk image "<code class="literal">virtdisk.qcow2</code>" containing Debian system for <a class="ulink" href="http://en.wikipedia.org/wiki/QEMU" target="_top">QEMU</a> can be created using <a class="ulink" href="http://www.debian.org/distrib/netinst" target="_top">debian-installer: Small CDs</a> as follows.</p>
<pre class="screen">$ wget http://cdimage.debian.org/debian-cd/5.0.3/amd64/iso-cd/debian-503-amd64-netinst.iso
$ qemu-img create -f qcow2 virtdisk.qcow2 5G
$ qemu -hda virtdisk.qcow2 -cdrom debian-503-amd64-netinst.iso -boot d -m 256
...</pre>
<p>See more tips at <a class="ulink" href="http://wiki.debian.org/QEMU" target="_top">Debian wiki: QEMU</a>.</p>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/VirtualBox" target="_top">VirtualBox</a> comes with <a class="ulink" href="http://en.wikipedia.org/wiki/Qt_(toolkit)" target="_top">Qt</a> GUI tools and quite intuitive. Its GUI and command line tools are explained in <a class="ulink" href="http://www.virtualbox.org/manual/UserManual.html" target="_top">VirtualBox User Manual</a> and <a class="ulink" href="http://download.virtualbox.org/virtualbox/UserManual.pdf" target="_top">VirtualBox User Manual (PDF)</a>.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>Running other GNU/Linux distributions such as <a class="ulink" href="http://www.ubuntu.com/" target="_top">Ubuntu</a> and <a class="ulink" href="http://fedoraproject.org/" target="_top">Fedra</a> under <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization" target="_top">virtualization</a> is a great way to learn configuration tips. Other proprietary OSs may be run nicely under this GNU/Linux <a class="ulink" href="http://en.wikipedia.org/wiki/Virtualization" target="_top">virtualization</a>, too.</p></td></tr>
</table></div>
</div>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="ch08.en.html"><img src="images/prev.gif" alt="Prev"></a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="ch10.en.html"><img src="images/next.gif" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 8. I18N and L10N </td>
<td width="20%" align="center"><a accesskey="h" href="index.en.html"><img src="images/home.gif" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Chapter 10. Data management</td>
</tr>
</table>
</div>
</body>
</html>