Backup with dump and restore on Linux mini-HOWTO <!--O <author> FUKUSHIMA Osamu, (福島於修), <<tt/fuku@amorph.net/> --> <author> FUKUSHIMA Osamu, <<tt/fuku@amorph.net/> <date> 2.0, 16 Aug. 2000 <!-- $Id --> <abstract> <!--O この文書は BSD 由来のツール dump(8) および restore(8) の利用方法と テープドライブのオペレーションに関することを解説するものです。 バックアップ作業全般に関する注意点にも触れています。 --> This document describes how to backup and restore your filesystems with the dump(8) and restore(8) utilities of BSD origin. Also covered is the basic operation of magnetic tapes with the mt(1) command to complement the simple yet powerful suite. </abstract> <toc> <sect>Introduction <p> <!--O dump(8) と restore(8) は、 BSD 系 UNIX で伝統的に使われてきた、 ファイルシステムのバックアップ・レストアのためのプログラムです。 <p> --> The <it>dump</it>(8) and <it>restore</it>(8) commands have traditionally been used on the BSD systems to backup and restore filesystems. <!--O dump はファイルシステムをバックアップし、 restore はバックアップされたアーカイヴ(書庫)からファイルを復元します。 アーカイヴは普通のファイルとして、 通常のファイルシステムに作成することができますが、 一般的にはバックアップ専用の外部デバイス (テープデバイスなど) に 保存することが多く、dump コマンドにはそのための利便も用意されています。 --> Dump backups a filesystem as a whole into an ``archive'', and restore retrieves files from it. Although the archive may be created as a regular file on a regular filesystem, it is usually stored on an external backup device such as a magnetic tape. Some features are implemented in dump to support such devices. <!--O <sect1>他のアーカイヴソフトとの比較 --> <sect1>Dump: Smart Archiver for Filesystems, not Files <p> <!--O アーカイヴを作成するソフトウェアとしては、他に cpio, tar, afio といったもの があります。これらのソフトウェアはファイル単位でアーカイヴのターゲットを認識 します。したがって特定のファイルやディレクトリをアーカイヴする対象から除外し たり、複数のファイルシステムにまたがって単一のアーカイヴを作成することもでき ます。 --> There are other popular tools to manage backup archives such as <it>cpio</it>, <it>tar</it> and <it>afio</it>. These utilities handle files as the target to be archived and they are capable of excluding specific files and/or directories from the target. They can even create a single archive that contains files from multiple filesystems. <p> <!--O 一方 dump は物理的なファイルシステム単位でターゲットを認識します。そして、個々 のファイルは i-node の単位で処理されます。特定のファイルをアーカイヴの対象か ら除外するような機能は用意されていません。(これに関しては、別の方法で同じよ うな効果を得ることもできます。詳しくは後述する <ref id="exclude" name="バックアップしないファイルを除外する"> を参照してください。) <p> そのかわり、dump はインクリメンタルアーカイヴ(前回のアーカイヴ時点から更 新されたファイルだけを選び出してアーカイヴする)の機能に関しては、たいへん すぐれた機構を提供しています。また、インクリメンタルアーカイヴに要する時間 も、他の方法にくらべて非常に高速です。 <p> restore は dump を使ってしたアーカイヴファイルを元に、その dump 作業を行っ た時の状態にファイルシステムを復元しようとします。 <p> 例えば前回のアーカイヴ時に存在した foo というファイルが、その後不要になっ て削除されたとします。次のインクリメンタルアーカイヴの時点では foo は存在 しないので、dump は「foo というファイルがあったけど、これは削除されています」 という情報をインクリメンタルのアーカイヴファイルに残します。 --> In contrast, dump handles a physical filesystem as an archiving target and the restore command usually uses the archive to restore the filesystem as it was dump'ed. Each file is managed by the i-node number and, basically, dump cannot exclude specific files from the archive <!--todo--> (actually, you may do so in a different manner. See Section <ref id="exclude" name="Excludes specific files from backup">). <p> Dump is indeed a simplistic and primitive tool, but it does come with a brilliant feature for incremental archiving. It identifies newly created or modified files after the previous backup and efficiently stores them to an archive very fast. <p> For example, suppose a file `foo' was backed up during the last archiving and removed afterwards. On the next incremental archiving, dump puts the record in the archive as `there used to be a file foo, but it was removed'. <!--O tar を使ってインクリメンタルバックアップを続けていて、ある日全てをフルレスト アしてみたら、はるか昔に消したはずのファイルがいっぱいで、ファイルシステムが 溢れてしまった、という事態には決してなりません。 --> If you use <it>tar</it> for your regular incremental backup tasks and attempt a full restoration one day, you may run out of the disk space by trying to restore a large number of files that had already been removed. With dump, you will never face such a problem. <p> <!--O 以上のことをまとめると、 --> In summary, it would be fair to say <itemize> <item> <!--O 特定のディレクトリやファイルをアーカイヴするには、 cpio, tar, afio などが向いている --> Cpio, tar or afio is suitable for archiving specific files or directories. <item> <!--O ファイルシステムのアーカイヴには、dump が向いている --> Dump is suitable for archiving whole filesystems. </itemize> <!--O といえます。目的に応じて、これらのツールを使い分けるとよいでしょう。この文書 は dump/restore に関する物なので、以下に記述されているのは、ファイルシステム のバックアップに関することであると考えてください。 --> Just pick a right tool for you job. This documentation is on the dump and restore suite, and the following discussion focuses on the backup of filesystems, not files. <!--O <sect1>他のバックアップソフトとの比較 --> <sect1>Simple is Not Just Beautiful for Restoration <p> <!--O dump は tar と同様にファイルをアーカイヴする機能がありますが、それ自体がバッ クアップソフトでもあります。ところで、Linux のバイナリディストリビューション にはバックアップ専用のユーティリティーが付属していることがあります。さまざま な種類のユーティリティーがありますが、外部のアーカイヴツールのフロントエンド として動作するものが多いようです。すべてを実際に使ってみたわけではありません が、メニュー形式でセットアップができるものもあり、なかなか便利に思えます。 --> Dump is not only an archiver (like tar), but also is a backup utility. Your Linux distribution might include a user-friendly backup utility, most likely a front-end to external archiving tools. I tried some of such utilities and found the nice-looking menu-driven backup configuration tools are indeed nice and handy. <p> <!--O これまで、私も何度かそういうユーティリティーを使ってみようかと考えましたが、 結局使わないまま今日にいたっています。ひとつには、すでに dump/restore に慣れ てしまっているので、新しいソフトウェアの使用方法を覚えるのが面倒に感じられる、 ということがあります。しかし、結局のところは「単純なものの方が信頼できる」と いう一点につきるようです。dump で保存したバックアップが必要になる状況は、い わは緊急事態といえます。システムそのものが起動しない状況さえも想定しておかな ければなりません。そう考えると、あまりきちんと整った環境でなくても動作するこ とが期待できるツールの方が何かと都合がいいと思うのです。 --> In fact, I even considered switching to such utilities several times in the past, but I still use dump and restore today. One reason is, of course, that I am already familiar with dump and restore, and don't want to learn new software. However, the main reason comes from my belief that "the simpler, the more reliable". The backup archives are often needed in a somewhat emergency situation and you may not even assume that the system itself shall boot. So, I believe a simple and less-demanding backup system suits better for the restoration tasks. <p> <!--O 私は initrd を利用した緊急起動用のフロッピーディスクを一枚つくって用意してい ます。こういうディスクを実際に作ってみるとわかるのですが、たとえ initrd を利 用しても容量は実に限られています。私の作ったディスクには、周囲にある数台のマ シンをカバーする、いわゆるジェネリックなカーネルと、いくつかのデバイスドライ バのモジュール、そして fdisk, fsck, ed, tar などの基本的な修復のための ツールとともに mt や restore が入っています。まだ実際に役に立ったことはありませんが、このディ スクから起動したシステムでローカルあるいはリモート接続のテープドライブが駆動 できることを確認してあります。正直いって、このフロッピーディスクを作る作業は あまり楽しいものとは言えませんでした。しかし、このフロッピー一枚だけで、必要 とあらばファイルシステムの再構築ができることが確認できたとき、大きな安心感が 得られました。 --> I made an emergency floppy disk with initrd myself. If you try to build one, you will soon realize that the disk space is fairly limited even with initrd. My diskette contains a generic kernel, which supports several machines around me, some driver modules, usual commands for system recovery (fdisk, fsck, ed, tar, ...) together with the mt command that we will discuss later, and of course the trusty little restore. I haven't yet encountered the situation where this floppy is actually required but I've confirmed that the floppy does boot the system and drive the tape devices (both local and remote). To tell the truth, it wasn't a pleasant experience for me to create this floppy disk, but I end up with getting a very good sense of assurance when I confirmed that the whole filesystem can be recovered with the single floppy disk. <p> <!--O dump/restore 以外のバックアップ方法を否定するものではありませんが、個人的に はファイルシステムの復旧時にあまりおおげさなツールを必要とする方法はおすすめ しません。バックアップツールを選択するときには、このことを頭の片隅にとめてお いてください。 --> I have no intention to deny the usability of other backup systems; I simply do not recommend an elaborate system for restoration, well, just in case for an emergency. <!-- <quote> [FYI: 1999/07/30]<newline> Wil Mahan 氏 <<tt/wmahan@brunox.qc.ca/> が作成・配布している <htmlurl url="http://ibs.brunox.qc.ca/" name="ibs (The Intelligent Backup System)"> というバックアップするユーティリティーが登場しました。 インストール後に変更されたファイルだけをバックアップ/レストアできることが 最大の特徴です。 現在は Debian GNU/Linux systems だけを対象にしていますが、 将来的には RPM ベースで配布されるディストリビューションも ターゲットにする予定とのことです。 </quote> --> <!--O <sect>メディアに関すること --> <sect1>Hardware Device <p> <!--O 最近は大容量のハードディスクドライブがたいへん安価に入手できるので、バックアッ プ専用のメディアとしてこれを選択することは、それほど非現実的なことではありま せん。ハードウェアとしてのメンテナンスも楽ですし、アーカイヴが目に見える形で 保管できるのもメリットといえるでしょう。 --> These days, large hard drives are fairy affordable and you may want to use one as a backup medium. Hard drives are essentially maintenance-free and the archives on them will always be easily accessible. <p> <!--O もし、バックアップの対象となるディスクの容量が比較的小さいならば、バックアッ プメディアとしてハードディスクドライブを使用することをおすすめします。あるい は、今すぐにテープドライブなどの専用デバイスを購入することがためらわれる場合 に、とりあえずハードディスクドライブで間に合わせるというのもよいでしょう。後 で専用デバイスを入手したときでも、ディスクは無駄にすることなく、通常のファイ ルシステムとして使い続けることができるからです。 --> If the amount of the backup target is not too large, using a HDD is not a bad idea at all. If you hesitate to buy a backup-specific device like a tape drive immediately, starting with a hard drive is also a good idea. When you get proper hardware, you can reuse the disk as a usual storage space. <p> <!--O バックアップの対象となるディスクの容量が大きいなら、バックアップ専用のデバ イスの購入は検討に値します。テープは当然リムーバブルなので、低コスト で過去のバックアップについての履歴を保存することができるようになります。 --> However, if the capacity of the backup target is large, you should perhaps consider obtaining a backup specific device. Because a tape medium is generally removable, you can preserve the history of a series of backups at a modest cost. <p> <!--O dump でのバックアップには、一般的にはテープカートリッジが使われています。PC では、QIC(1/4 inch cartridge), 4mm DAT, 8mm EXABYTE, DLT (Digital Linear Tape) などがよく使われています。 --> The most popular medium for dump is a cartridge tape. On PCs, QIC (quarter inch cartridge), 4mm DAT, 8mm EXABYTE and DLT (Digital Linear Tape) are the most common. <p> <!--O わたしは EXABYTE の EXB-8505 という古い SCSI1 のテープドライブを使っています。 EXABYTE は 8mm ビデオテープに似た専用のカートリッジテープを使用します。 ドライブやメディアの価格が高いのが難点で、 個人が使用するにはあまり向いているとはいえません。 しかし、大容量のバックアップメディアとして長く使われており、 信頼性も高いといえます。 --> I have been using an EXABYTE EXB-8505, an old SCSI1 tape drive. It takes a special tape cartridge similar to an 8mm videotape. Although such a system may not be optimal for personal use due to a high cost for the drive and media, it has been used in the industry for a long time and a high reliability is proven. <p> <!--O 8mm EXABYTE の機構を小型化したようなものが 4mm DDS ドライブです。 比較的安価 (新品が 3 万円ほど売られていることもあります)で しかも容量が大きいので人気があります。 取り扱いも楽で駆動音も静かです。ヘッドの寿命が短いという人もいます。 --> A 4mm DDS drive is a compact drive which has a similar mechanism to the 8mm EXABYTE. It is popular because of its affordability (you can find a brand-new one with 30,000 yen or so) and fairly large capacity. The DDS drive is quiet and easy to handle, although some claim that the lifetime of the head is rather short. <p> <!--O 目安としては、稼働しているファイルシステムのうちもっともサイズの大きな領域が、 分割せずに余裕をもって収まるくらいの容量のあるメディアを選ぶべきです。 --> I would suggest you to choose a medium which can easily store the largest filesystem you. <p> <!--O テープドライブ全般に関する情報へのポインタとして: --> You can find more general information about tape drives at <quote> <!--O <tt> <htmlurl url="http://www.paranoia.com/~vax/unix_tape.html" name="http://www.paranoia.com/~vax/unix_tape.html"> </tt> <newline> ``The Source of All Knowledge (英文)'' --> <url url="http://www.paranoia.com/~vax/unix_tape.html" name="The Source of All Knowledge"> </quote> <!--O と、ここからたどれるリンクをあげておきます。 --> and links given there. <p> <!--O この文書では、8mm テープドライブ EXB-8200 を例にして、テープ上にバッ クアップ・アーカイヴを作成することを解説していきます。 --> In this document, I will use my EXB-8200 tape drive to explain how to create backup archives on tapes. <!--O <sect>Linux での利用 --> <sect1>Linux Ports <sect2>dump and restore v0.3 <p> <!--O Linux では Remy Card 氏 (<tt/card@linux.eu.org/) が 4.4BSD の物をベースに移植した 物が使われています。Red Hat や Debian には、dump-0.3 のバイナリパッケージが 付属しています。 ソースパッケージは: --> There is the dump/restore command set for Linux ported by Remy Card (<tt/card@linux.eu.org/) based on the one in 4.4BSD. Red Hat and Debian have their binary packages of dump-0.3. Source archive is available at: <quote> <tt> <htmlurl url="ftp://tsx-11.mit.edu/pub/linux/packages/ext2fs/dump-0.3.tar.gz" name="ftp://tsx-11.mit.edu/pub/linux/packages/ext2fs/dump-0.3.tar.gz"> </tt> </quote> <!--O から入手できます。 LSM ファイルには 2.0.x 以降のカーネルについての 記述がありませんが、これらの新しいカーネルを走らせているシステムでも 問題なく利用できるはずです。 dump プログラムは ext2 ファイルシステムの 構造に依存しているので、 自分で make するためには Ext2fs library が必要です。 このライブラリも上記のディレクトリから入手可能です。 --> There is no description in the LSM file about the compatibility with the 2.0.x (or later) versions of the Linux kernel, you should use it with no problem with these new kernels. Since dump depends on the structure of the ext2 filesystem, you need Ext2fs library to compile it by yourself. This library is also available from the directory of the above URL. <p> <!--O dump が ext2 ファイルシステムの構造に依存していることは、 いくつかの制限をもたらしています。 --> Dump has some limitations because of its dependency on the ext2 filesystem: <p> <!--O まず Peter Moulder 氏 (<tt/reiter@netspace.net.au/) が公開している ext2 ファイルシステムへの拡張機能 (e2compr) を使って圧縮されたファイルは、 正常に restore できないことがわかっています (正確にいえば、圧縮されているかどうかを保存しているクラスタービットが 復元されないために、圧縮されたデータへの透過的なアクセスができなくなります)。 --> One is that it cannot properly restore the file compressed by the e2compr, which is the extension to the ext2 filesystem developed by Peter Moulder (<tt/reiter@netspace.net.au/). More concretely, on-the-fly access to the compressed data will not be available since the cluster bit, which tells the data is compressed or not, is not recovered. <p> <!--O したがって、現状では e2compr を利用する場合は dump 以外の バックアップ手段を選ばなければなりません。 --> For e2compr, therefore, you have to choose the backup system except for dump currently. <p> <!--O もうひとつの制限は、dump バージョン 0.3 はマルチボリュームの バックアップを公式にはサポートしていないことです。 したがってバックアップメディアのサイズがファイルシステムのサイズよりも小さい 場合には、正常にレストアできない可能性もあります。 --> Another limitation is that dump version 0.3 does not support the multivolume backup (at least officially). Hence if the size of the backup media is smaller than that of the filesystem, it is possible you cannot restore it properly. <sect2>dump and restore v0.4 Beta <p> <!--O 1996 年 1 月には、4.4BSD-Lite2 の dump をベースに移植した、新しい dump-0.4 のβバージョンがテスト公開されています。 このシリーズは 0.4b4 まで Remy Card 氏 によって作成・配布されて きましたが、その後数年間に渡ってメンテナンスが停止状態になっていました。 --> In January 1996, new dump-0.4 beta version was released for testing. It was ported from the dump in 4.4BSD-Lite2. This series was maintained and distributed by Remy Card until 0.4b4, but left unmaintained for a few years after that. <p> <!--O 1999 年 9 月に Stelian Pop 氏 (<tt/pop@cybercable.fr/) によって 開発が引き継がれることになり、現在正式公開に向けてβバージョンが出ています。 このβバージョンは: --> In September 1999, Stelian Pop (<tt/pop@cybercable.fr/) took over the development, and is still been working for the official release. Now the beta version for this is available at: <quote> <tt> <htmlurl url="http://dump.sourceforge.net/" name="http://dump.sourceforge.net/"> </tt> </quote> <!--O で入手することができます。このバージョンでは、マルチボリュームの バックアップがサポートされています。 その他にも dump/restore の 0.4b は、0.3 と比較すると数多くの Bugfix と 新しい機能の追加が行われています。主なものは: --> Most notably, this version supports a multivolume backup. It also incorporates various feature enhancement and bug-fixes to version 0.3, which include (as of 2000/07/05): <itemize> <!--O <item>FreeBSD-3.1-RELEASE で行われた Bugfix と機能追加の輸入 <item>Red Hat, Debian, SuSE が作成したパッチの取り込み <item>マルチボリュームのアーカイヴの取り扱いに関する Bugfix 類 <item>リモートバックアップ時に rsh 以外の remote shell を使えるようになった <item>ext3 ファイルシステムへの対応 <item>kerberos サポート <item>buffer overflow 問題の解決 <item>dump 終了時に特定の command を実行できるようになった (-F) <item>restore するファイル名のリストを外部から読み込めるようになった (-X) <item>restore の対話モードでの GNU readline サポート --> <item>Import new features and bugfixes achieved on FreeBSD-3.1-RELEASE <item>Apply patches by Red Hat, Debian and SuSE <item>Bugfixes for the multivolume archive handling <item>Support remote backup over remote shells other than rsh <item>Support ext3 filesystem <item>Support kerberos <item>Fix buffer overflow <item>Invoking command when dump is finished (-F) <item>Read the list of file to be restored (-X) <item>Support GNU readline on interactive restoration </itemize> <!--O などです (2000/07/05 現在)。 --> <p> <!--O なお、dump-0.4 のβバージョンのうち、 0.4b14 以前のバージョンにはセキュリティホールが発見されています。 必ず 0.4b16 以降をインストールしてください。 --> It is known that the dump-0.4b series before 0.4b15 have a security hole. Please make sure to install 0.4b16 or later. As of the English translation of this document, 0.4b32 is employed in a Debian distribution. <!-- またコマンドラインオプションの仕様に一部変更も加えられていますので、 マニュアルページを確認して使用してください。--> <!-- 現状では dump-0.3 が stable なバージョンであり、 この文書もそれを使用すること を前提に解説することにします。 --> <!--O <sect1>デバイスファイル --> <sect2>Device files <p> <!--O Linux では、テープドライブを使うためのデバイスドライバが標準で提供されていま す。お使いのドライブにあったドライバをカーネルのコンパイル時に組み込んでくだ さい。ローダブルモジュールの形式でもかまいません。 --> The Linux kernel provides the drivers for the tape devices. Please build the proper driver for your device when compiling your kernel. You may also use loadable module, if you prefer. <p> <!--O 次に、テープドライブのデバイスファイルを確認します。 --> Then, check the device files. <tscreen><verb> % ls -l /dev/*st[0-9] crw-rw-rw- 1 root disk 9, 128 Oct 5 1995 /dev/nst0 crw-rw---- 1 root disk 9, 129 Oct 5 1995 /dev/nst1 crw-rw-rw- 1 root disk 9, 0 Oct 5 1995 /dev/st0 crw-rw---- 1 root disk 9, 1 Oct 5 1995 /dev/st1 </verb></tscreen> <!--O <tt>/dev/nst?</tt> と <tt>/dev/st?</tt> の二種類があります。 (もしなければ、MAKEDEV コマンドで 作成してください。) このうち、st? はコマンドがドライブに対して発行されたあと に、自動的に先頭まで巻き戻し(rewind)するデバイスであり、nst? は巻き戻ししな い(no rewind)デバイスです。このあたりには好みがあるのですが、私は no rewind の方が好きです。今回は <tt>/dev/nst0</tt> をターゲットのデバイスとして 利用することにします。 ターゲットのデバイスが決まったら、そのデバイスファイルから ``<tt>/dev/tape</tt>'' というシンボリックリンクを作成してください。 こうしておくと、mt などのコマンドでデバイス名を省略できます。 --> There should be two kinds of device files: <tt>/dev/nst?</tt> and <tt>/dev/st?</tt> (if not, make them with MAKEDEV command). st? are ``auto-rewind'' devices, which rewind the tape after the command is invoked to the driver, and nst? are ``no-rewind'' devices. Which to use is your choice, but I prefer the no rewind ones. In this document, <tt>/dev/nst0</tt> is used as the target device. When the target device is chosen, you may want to create the symlink to it named ``<tt>/dev/tape</tt>''. With this, you can omit the device name on the command lines of mt and others. <tscreen><verb> % cd /dev; ln -s nst0 tape </verb></tscreen> <p> <!--O もし接続されているテープドライブをバックアップ専用のデバイスと考えるなら、 一般ユーザからのアクセスはすべて拒絶したほうがよいでしょう。 その場合は、`Others' のリード/ライト権限を落としてください。 上記の例では、一台目のテープドライブは一般ユーザのアクセス可、 二台目のテープドライブはバックアップ専用で、所有者とグループ `disk' に 属しているユーザ以外はアクセスが不可になっています。 --> If you intend to use the tape drive for the backup only, you should consider limiting the access to it. To do this, remove the read/write permissions for `Others'. In the above example, the first tape drive is accessible to normal users, and the second drive is backup purposes only, to which the access is prohibited except for the owner and the users belonging to the `disk' group. <!--O <sect>mt コマンド --> <sect>The mt command <!--O <sect1>mt --> <p> <!--O `mt' は、テープドライブを操作するためのコマンドです。テープの巻き戻し・巻き 送り・頭出しや、ドライブの稼働状況の確認などができます。dump/restore をテー プドライブで使うには、mt での操作は避けて通ることができません。できれば、 練習用の短いテープを用意して、慣れるまでいろいろと試すのもいいでしょう。 `mt' にはドライブに依存する機能もあります。必ず一度マニュアルに目を通して、 あなたがお使いのドライブではどのコマンドが使えるのか把握するようにしてくださ い。 --> The <tt>mt</tt> command is a utility to manipulate tape drives. With mt, you can rewind/forward/position the tape, as well as check the drive status. It is a must-have tool if you want to use dump/restore with tape drives. If possible, it is a good idea to prepare a tape for training purposes, and practice around with it. Some commands of mt are drive-dependent, so please read the manual carefully to know which commands are available for your drive. <p> <!--O Linux で使える mt としては、BSD のものを ベースに Kai Makisara 氏 (<tt/Kai.Makisara@metla.fi/) が 移植した mt-st が一般的です。 ソースパッケージは: --> For Linux, mt-st is widely used. It is an mt variant ported from BSD to Linux by Kai Makisara (<tt/Kai.Makisara@metla.fi/). You can get the source package from: <quote> <tt> <htmlurl url="ftp://tsx-11.mit.edu/pub/linux/sources/sbin/mt-st-0.4.tar.gz" name="ftp://tsx-11.mit.edu/pub/linux/sources/sbin/mt-st-0.4.tar.gz"> </tt> </quote> <!--O から入手できます。 --> <p> <!--O もし Archive Python 28849 SCSI ドライブのような DDS Autoloader を 利用する場合は Leonard N. Zubkoff 氏 (<tt/lnz@dandelion.com/) が 作成・配布している MTX も役に立つでしょう。これは: --> If your tape drive is a kind of DDS autoloader like Archive Python 28849 SCSI DDS drive, MTX program by Leonard N. Zubkoff (<tt/lnz@dandelion.com/) is useful. Its source archive is available at: <quote> <tt> <htmlurl url="http://www.dandelion.com/Linux/" name="http://www.dandelion.com/Linux/"> </tt> </quote> <!--O から入手できます。 MTX の使い方に関しては <ref id="mtx-exec" name="このセクションの最後">で解説します。 --> The usage of MTX is explained <ref id="mtx-exec" name="later"> in this chapter. <!--O <sect1>mt の操作例 --> <sect1>Mt operations <p> <!--O この章では、実際の mt の操作例を通して、mt の機能について解説していきます。 --> In this section, I show the mt features by showing its actual usage. <p> <!--O ドライブにテープ(できれば、練習用のもの)を装填してください。装填が完了したら、 mt コマンドでドライブのステータスを確認してみましょう。mt のオプションコマン ド `status' は、ドライブのステータスを確認するコマンドです。 --> Insert a tape (for practice purpose, if possible) into your drive. After the tape has been loaded, let us confirm the tape status. <TT>mt status</TT> command can be used to do this. Here is an example: <tscreen><verb> % mt status SCSI 1 tape drive: File number=0, block number=0. Tape block size 1024 bytes. Density code 0x0 (default). Soft error count since last status=0 General status bits on (41010000): BOT ONLINE IM_REP_EN </verb></tscreen> <p> <!--O まず、メッセージの最終行を見てください。ドライブにテープが装填され、最終行の BOT (Beginning Of Tape Marker) 表示によってのヘッドの位置はテープの先頭にあ ることがわかります。次の ONLINE は、テープドライブがオペレータによって操作可 能な状態であることを意味しています。テープを読み書きするには ONLINE の状態で ある必要があります。現在のファイル番号は 0 になっています。ファイル番号はテー プの先頭から 0 で始まり、ファイル終端マーク(EOF)があるごとに、数字が増えます。 --> First of all, look at the bottom line. This means that the drive has a tape loaded, and the status BOT indicates that the drive head is at the beginning of the tape. Next word &dquot;ONLINE&dquot; indicates that the tape drive is ready to be operated (by mt). The drive status must be &dquot;ONLINE&dquot; before read / write operations. Next, see the third line. It shows that the current file number is zero. File number zero corresponds to the beginning of the tape, and is incremented as passing the End-Of-File (EOF) marks on the tape. <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig1.gif"> </figure> </#if> <#unless output="html"> <p> <!--O (以後の説明、プレインテキスト版ではいくつかの図が使われています。可能であれば 等幅のフォントで閲覧してください) --> (In the following explanation, I use the ascii-art figures in the plain text version. Please use fixed width font if possible.) <tscreen><verb> V (<--- Tape Head) /==================================================================/ | B<--- BOT Mark) -> Tape End / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <p> <!--O 通常、Density や Tape block size は Drive にあわせて最適なものが 自動的にセットされるはずです。 もし、他の OS とテープをやりとりする 予定がある場合は、両方の OS 間で互換性のある形式を選択する必要が あるでしょう。 また、データをハードウェアで圧縮してメディアに記録するドライブの場合、 mt のコマンドで明示的に compression フラグを与えてやる必要があります。 --> Normally, you don't have to set tape density and tape block size parameters, because these will be automatically set to suit your drive. If you want to read/write the tape on other OS's also, you may want to set these parameters explicitly for portability. If your drive supports compression feature and you want to use it, you have to pass the &dquot;compression&dquot; flag explicitly to the drive by mt. <!--O このあたりはドライブの種類や環境によって異なることが多いので、 解説は省略します。くわしくは mt(1) マニュアルページの defsetblk, setblk, defcompression, datcompression, compresson などの項目と、 お使いのドライブのマニュアルを参照してください。 --> These hardware specific parameters are strongly dependent on the drive you use. Please refer to the mt(1) manual page (items on defsetblk, setblk, defcompression, datcompression and compression), and the manual of your drive. <p> <!--O もし、mt status の結果、次のようなメッセージが出た場合は、 /dev/tape のリンクが指しているデバイスファイルがドライブの つながってるものと異なっている可能性があります。 --> If "mt status" outputs an error message as follows, chances are that the link /dev/tape doesn't point to the device file of your drive correctly. <tscreen><verb> /dev/nst0: No such device or address </verb></tscreen> <!--O その場合は、別のデバイスファイルを -f コマンドで指定して試してみてく ださい。正常なメッセイジが表示されたなら、リンクをはり直しておいてください。 --> In this case, try other tape-device files by -f option. After finding the right one, fix the link to point to it. <p> <!--O では、実際に幾つかのファイルをテープに書いて、練習してみることにしましょう。 どこか適当な場所に練習用のディレクトリを作成し、その中にfile-01 から file-06 までのダミーファイルを touch コマンドで作成してください。 --> Now you can try writing some files to your tape. Create a directory for practice in an appropriate place. Generate six dummy files (from file-01 to file-06) by <TT>touch</TT> command. <tscreen><verb> (tcsh)% foreach num (01 02 03 04 05 06) foreach? touch file-$num foreach? end (tcsh)% ls -l -rw-r--r-- 1 fuku users 0 Nov 21 01:10 file-01 -rw-r--r-- 1 fuku users 0 Nov 21 01:10 file-02 -rw-r--r-- 1 fuku users 0 Nov 21 01:10 file-03 -rw-r--r-- 1 fuku users 0 Nov 21 01:10 file-04 -rw-r--r-- 1 fuku users 0 Nov 21 01:10 file-05 -rw-r--r-- 1 fuku users 0 Nov 21 01:10 file-06 </verb></tscreen> <!--O このファイルを一つづつ、tar でテープに書き込んでみます。 --> Then, write these files to the tape with tar, one by one. <tscreen><verb> % tar cf /dev/tape file-01 </verb></tscreen> <!--O エラーがなにもなければ、うまくいっています。念のために mt のステータスを 確認してみましょう。 --> If you see no errors, it should have worked. Let's see mt status. <tscreen><verb> % mt status SCSI 1 tape drive: File number=1, block number=0. Tape block size 1024 bytes. Density code 0x0 (default). Soft error count since last status=0 General status bits on (81010000): EOF ONLINE IM_REP_EN </verb></tscreen> <!--O 大丈夫ですね。EOF がひとつ追加されたので、ファイル番号が一つインクリメントさ れて、1 になっています。 <tt>/dev/tape</tt> は <tt>/dev/nst0</tt> つまり no rewind のデバイスに 書き込んだので、テープヘッドは今書いたファイルの終端 (EOF) にあります。すでに 次のファイルを書く準備が完了しているということです。 --> Looks fine. Since one EOF mark has been written on the tape, the file number is incremented by one. Because <tt>/dev/tape</tt> is <tt>/dev/nst0</tt> in this case, which is no rewind device, the head position is at the EOF of the file just written. And the drive is ready to write next data. <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig2.gif"> </figure> </#if> <#unless output="html"> <tscreen><verb> V /==================================================================/ | B[file-01]E / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <p> <!--O では、残りのファイルは連続して書いてしまいましょう。 --> Then write rest of the files at once. <tscreen><verb> (tcsh)% foreach num (02 03 04 05 06) foreach? tar cf /dev/tape file-$num foreach? end </verb></tscreen> <!--O ステータスを確認します。 --> Again, confirm the status. <tscreen><verb> % mt status SCSI 1 tape drive: File number=6, block number=0. Tape block size 1024 bytes. Density code 0x0 (default). Soft error count since last status=0 General status bits on (81010000): EOF ONLINE IM_REP_EN </verb></tscreen> <!--O ファイルはきちんと書き込まれています。テープヘッドは今書いたファイルの終端 にあります。この様子を図にしてみましょう。 --> All files have been properly written. The drive head position is at the end of the files just written, as shown in figure 3. <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig3.gif"> </figure> </#if> <#unless output="html"> <tscreen><verb> V /==================================================================/ | B[file-01]E[file-02]E[file-03]E[file-04]E[file-05]E[file-06]E / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <p> <!--O ここで大切なことは、各ファイルには ファイルの中身・ファイルの終端マークのふ たつがあるということです。これは、ファイルが正常にテープに格納されると、自動 的にそのようになります。ファイルを読み出すときは、前のファイルの終端マークに テープヘッドを位置させることによって、ファイルの先頭ブロックから読み出せるこ とになります。また、ファイルを追加して書き込むときは、前のファイルの終端マー クにヘッドが達していなければなりません。言い換えれば、複数のファイルが連続し て記録されているとき、前のファイルの終端マークは、次のファイルの先頭ブロック の開始位置といえます。当然ですが、もしファイルの中身の部分から書き込み始める と、元のファイルの中身は失われてしまいます。 --> It is important to know that each file consists of two parts, a file content and the EOF mark. If you write a file successfully, these two parts are generated automatically. When reading the file, set the tape head at the EOF of the previous file so that you can read the file from the first block. And if you want to add a file to the tape, you must set the head at the EOF of the last file in this tape. In other words, the EOF mark of the file is also a start position of the next file. If you write data from middle of some file, of course you will lose whole contents of it. <p> <!--O それでは、複数のファイルが順に記録されたテープから、特定のファイルだけを取り 出す方法を練習しましょう。例として、今記録したテープから、file-03 がアーカイ ブされた部分を取り出すことを考えてみます。目的のファイルが記録された位置にヘッ ドを移動することが必要になります。 --> As the next practice, let's read a certain file from the tape which contains multiple files sequentially. Firstly, consider extracting file-03 from the tape to which we just wrote six files. You have to move the head to where the target file is recorded. <p> <!--O まず、いったん先頭に巻き戻してから、file-03 がアーカイヴされた位置にヘッドを 移動しましょう。 --> This can be done as shown below. First, rewind the tape completely, and then go to the proper position. <tscreen><verb> % mt rewind </verb></tscreen> <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig4.gif"> </figure> </#if> <#unless output="html"> <tscreen><verb> V /==================================================================/ | B[file-01]E[file-02]E[file-03]E[file-04]E[file-05]E[file-06]E / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <p> <!--O file-03 が記録されている部分はテープの中の、ファイル番号 2 の位置です。現在 ヘッドは BOT (テープの頭)にありますから、ここに移動するためには、EOF (ファイ ル終端マーク) をふたつスキップすることになります。 --> file-03 is written at the position of file number 2. Now the head is at the beginning of this tape (BOT), so you have to skip two EOFs to go to file-03. <tscreen><verb> % mt fsf 2 </verb></tscreen> <!--O mt のオプションコマンド fsf は、指定個数の EOF をスキップして次のファイルの 先頭ブロックにヘッドを移動するコマンドです。fsf 2 では、 現在の位置から 2 つ先のファイル開始位置にヘッドを移動する ことを意味しています。 --> <TT>mt fsf</tt> command skips specified numbers of EOFs and goes to the starting block of the next file. <tt>fsf 2</tt> means that the head should be moved to the starting position of the file, which is two files ahead of the current position. <tscreen><verb> % mt fsf 2 </verb></tscreen> <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig5.gif"> </figure> </#if> <#unless output="html"> <tscreen><verb> V /==================================================================/ | B[file-01]E[file-02]E[file-03]E[file-04]E[file-05]E[file-06]E / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <tscreen><verb> % mt status SCSI 1 tape drive: File number=2, block number=0. Tape block size 1024 bytes. Density code 0x0 (default). Soft error count since last status=0 General status bits on (81010000): EOF ONLINE IM_REP_EN </verb></tscreen> <!--O ここでステータスが意味しているものは「ファイル番号 2 (すなわち、ここでは file-02 がアーカイヴされている部分) の終端マーク」であり、言い換えれば 「ファイル番号 3 の先頭ブロック開始位置」を意味しています。tar で中身を 見てみましょう。 --> <!--nakano ファイル番号 1 の EOF マーク (かつファイル番号 2 のブロック0)、 なのでは?--> Status says that the head is at the EOF of the file number 2 (where the file-02 is archived), and is also the starting point of file-03. Let's look the content of this file by tar: <tscreen><verb> % tar tf /dev/nst0 file-03 </verb></tscreen> <!-- 意図した通りに、file-03 のアーカイヴがありました。 ステータスを表示させてみます。 --> It is file-03, as expected. Let's see tape status. <tscreen><verb> % mt status SCSI 1 tape drive: File number=2, block number=10. Tape block size 1024 bytes. Density code 0x0 (default). Soft error count since last status=0 General status bits on (1010000): ONLINE IM_REP_EN </verb></tscreen> <!--O ここではステータスに EOF が表示されていないことに注意してください。tar でふ つうにアーカイヴを読み出すと、tar は自身の End of file マークを検知して、そ こで読出しを停止します。これはテープに記録されている EOF とはまた別のものです。 --> Note that EOF is not shown in this status. <TT>Tar</TT> program usually reads an archive until its own &dquot;end of file&dquot; mark, and stops. This &dquot;end of file&dquot; is DIFFERENT from the EOF of the tape. <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig6.gif"> </figure> </#if> <#unless output="html"> <tscreen><verb> V /==================================================================/ | B[file-01]E[file-02]E[file-03 F]E[file-04]E[file-05]E[file-06]E / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <p> <!--O 図の F (画像では青印) が、tar の End of file マークです。 したがって、tar で読出した直後は、 まだヘッドは記録されたブロックの中にあります。このまま次のアーカイヴを 連続して tar で読出そうとすると、今度はテープに記録された EOF マークをすぐに 読み込むことになり、tar は無言のままに終了することになります。もし連続して tar で読出す場合は、その前に --> In figure-6, F (blue mark) is the tar's "end of file" mark. Note that this is still within the recorded block of the file. If you try to read next block from this position, tar immediately finds EOF mark and silently quits without reading any files. If you want to read the next file, do this command: <tscreen><verb> % mt fsf </verb></tscreen> <!--O として、EOF マークをひとつ読み飛ばせはいいのです。ちょっと間違いやすいところ なので、覚えておいてください。 --> to skip one EOF mark. Please remember this behavior, since it is slightly confusing. <p> <!-- さて、現在は mt fsf で file-03 がアーカイヴされたブロックの EOF マークにヘッ ドがあるとします。このアーカイヴをもう一度読出したいときはどうすればいいでしょ うか。巻き戻しながら二つ目の EOF マークを読み込んだとき、このファイルの先頭 になるのです。 --> Let's consider how to read the archive which has file-03 again, after you did "mt fsf" and the head is now at the EOF mark of it. The answer is searching the tape backward until the second EOF mark will be found. That is the beginning of this file. <#if output="html"> <figure> <ph vspace="0"> <img src="./dump-restore-mini-HOWTO-images/fig7.gif"> </figure> </#if> <#unless output="html"> <tscreen><verb> V <====== V /==================================================================/ | B[file-01]E[file-02]E[file-03]E[file-04]E[file-05]E[file-06]E / \================================================================/ V: Tape Head B: BOT Mark E: EOF Mark </verb></tscreen> </#if> <p> <!--O このためには、以下のようにします。 --> To do this, type: <tscreen><verb> % mt bsfm 2 </verb></tscreen> <!--O これは mt の拡張されたコマンドで、ふるい mt にはないものもあります。 その場合は bsf と fsf を組み合わせて処理することになるのですが、 紛らわしいのでここでは省略します。 --> <tt>bsfm</tt> is an extended command of mt, and some old mt doesn't implement it. In that case, you will have to use bsf and fsf in sequence to achieve the desired operation. The detail is somewhat cumbersome so it is omitted here. <p> <!--O 次に、現在記録されているファイルに追加して記録するときの操作を説明します。mt eod で、現在記録されているブロックの最後の EOF にヘッドが移動します。ただし、 この機能はドライブによってはうまくいかないこともあるので、実際にためして確認 しておく必要があります。もし、うまくいかなくてもきちんとオペレーションの記録 がとってあれば fsf などで処理できます。 --> Next, we go into the operation to add a file after the last file in the tape. You can go to the EOF of the last file by <TT>mt eod</TT> command. However, this command might not work with certain drives, so you should test it beforehand. Even if it doesn't work, you can do the same by "fsf" command if you know how many files are written in this tape by logging your operations. <p> <!--O 最後に、テープを巻き戻して排出させましょう。これもドライブの種類に依存すること が多いのですが、大抵の場合は --> Finally, rewind the tape and eject it. This operation also depends on the kind of your drive, but usually the following command works: <tscreen><verb> % mt offline </verb></tscreen> <!--O これで(必要なら)自動的に巻きもどされ、ドライブからテープが Eject されます。 --> Then the tape is rewinded if necessary, and ejected from the drive. <p> <!--O mt をつかったテープのオペレーションはやや難しく、慣れが必要です。 また、<ref id="logging" name="dump の記録">で後述しますが、 記録の状態を確認するのが難しいので、実行したオペレーションの内容の記録を保存す ることが大切です。 ぜひ練習用のテープを用意して、いろいろとためしてみてください。 --> The tape operation with mt is not so easy and you have to be familiar with it. And as I'll mention in <ref id="logging" name="Log your dump records"> below, there is no appropriate way to confirm the status of the recorded archives. Therefore, it is very important to keep track of your operations. Please prepare a tape for practice, try various mt commands and confirm their results. <!--O <sect1>MTX の操作例(集合型テープドライブの操作)<label id="mtx-exec"> --> <sect1>MTX operations (tape library manipulation)<label id="mtx-exec"> <p> <!--O 複数のテープを連装できるタイプのテープデバイスがあります。 Archive Python 28849-XXX や、HP Surestore 12000, Quantum DLT 2500 XT といった集合型のドライブです。 たいていの場合、複数のテープを専用のカートリッジ・マガジンに装填し、 それをドライブ本体に挿入します。 その後、カートリッジ・マガジンに装填されたテープのうち、 任意の物をローディングすることによって、 実際に読み書きできるようになります。 --> Some devices allow loading of multiple tapes. These include tape libraries such as Archive Python 28849-XXX, HP Surestore 12000, Quantum DLT 2500 XT. These drives usually have a dedicated cartridge magazine which holds multiple tapes. After inserting the cartridge filled with tapes into the drive, you can select any tape within the cartridge for reading and writing. <p> <!--O このメディアチェンジの作業はドライブ本体に専用のスイッチがあって、 それを手動で操作できる場合もありますが、 実際にローディングされたテープが目的のものかどうか確認することが 困難であったり、カートリッジ・マガジンに装填されたテープの 順番通りにしかメディアチェンジできなかったりする場合もあり、 使い勝手があまりよくないこともしばしばあります。 --> Some drives have switches for the media change, with which you can control them manually. But it is most likely to be irritating to operate, It may be hard to check if the loaded tape is the right one, or it allows changing the media only in the sequence as inserted in the cartridge magazine. <p> <!--O これはこの章の最初に述べたように、 Leonard N. Zubkoff 氏 (<tt/lnz@dandelion.com/) が作成・配布している MTX を利用することによって、簡単に解決することができます。 MTX は mtx という単独のプログラムです。 現在配布されているバージョンは 1.1 で、 Debian GNU/Linux (potato) ではバイナリも用意されています。 --> This situation can be avoided easily by using the MTX, which is maintained and distributed by Leonard N. Zubkoff (<tt/lnz@dandelion.com/). MTX consists of a single binary command named mtx. As of writing, the current version is 1.1. Debian GNU/Linux (potato) has a binary package of MTX. <p> <!--O バイナリが入手できない場合でも、 kernel 2.0.30 以降であれば簡単にコンパイルすることができます (これより古いバージョンのカーネルで利用する場合は、 MTX の配布アーカイブに含まれている mtx.doc の ``LINUX KERNEL REQUIREMENTS'' の章を参考にヘッダファイルに小さな変更を加えれば OK です)。 また、コンパイルの際には kernel のソースツリーが必要です。 kernel のソースツリーの状態によっては 「ヘッダファイルが見つからない」 というエラーでコンパイルに失敗することがありますが、その場合は Makefile の CFLAGS の行に -I/usr/src/linux/include を付加してください。 --> Even if the binary is not available, you can easily compile it from source if your kernel is 2.0.30 or later (for older kernels, you must slightly modify the header file as explained in the ``LINUX KERNEL REQUIREMENTS'' section of mtx.doc, which is included in the distribution archive). Depending on the location of your kernel source tree, the build may fail with no header file error. In that case, add -I/usr/src/linux/include (or the equivalent that works) to the CFLAGS macro in your Makefile. <verb> CFLAGS = -O6 -m486 -fomit-frame-pointer -I/usr/src/linux/include </verb> <p> <!--O では、実際に MTX を使って集合型テープドライブを操作してみましょう。 すでにカートリッジ・マガジンにはテープが装填されており、 マガジンがドライブ本体に挿入されているものとします。 --> Now let's try to manipulate a tape library with MTX. We assume that the cartridge magazine is filled with tapes, and is inserted into the drive. <p> <!--O この状態では、まだどのテープもマガジンに装填された状態のままで、 テープへッダのある位置にロードされていません。 ためしに mt で確認すると、``テープが挿入されていない'' というステータスが帰ってきます。 mtx にもこのステータスを表示する機能があります。 使い方は mt とまったく同じで、 デバイス名とオプショナルコマンド ``status'' を付加するだけです。 --> At this stage, every tape is staying in the magazine, and not loaded where the tape head is. If you check with mt here, "no tape found" status will be returned. Mtx also has the feature to show this status. The command line is exactly the same with mt, just add the device name and the optional command ``status''. <tscreen><verb> # mtx -f /dev/nst1 status Data Transfer Element: Empty Storage Element 1: Full Storage Element 2: Full Storage Element 3: Full Storage Element 4: Full Storage Element 5: Full Storage Element 6: Full </verb></tscreen> <!--O ``Data Transfer Element'' というのが実際に読み書きを行う装置で、 現在は空 (Empty) になっています。 ``Storage Element 1-6'' は、カートリッジ・マガジンの状態を示しています。 各番号はマガジン内での装填順で、これをストレージ番号と呼びます。 現在は六つのすべてのマガジンに テープが装填された状態 (Full) であることを示しています。 --> ``Data Transfer Element'' is the part which actually reads/writes the tape, and is Empty now. ``Storage Element 1-6'' shows the status of the cartridge magazine. The number is in sequence in the cartridge magazine, and called "storage number". The above example shows that all the elements of the magazine have the tape inserted. <p> <!--O では、``Data Transfer Element'' にテープをロードしてみましょう。 この操作も mtx でおこないます。オプショナルコマンド ``load'' に、 ストレージ番号を付加するだけです。 --> Then try to load the tape to ``Data Transfer Element''. You can also use mtx for this purpose. Just specify the optional command ``load'' and the storage number. <tscreen><verb> # mtx -f /dev/nst1 load 1 Loading Storage Element 1 into Data Transfer Element...done </verb></tscreen> <!--O これで一番目のテープがロードされました。status コマンドで確認してみましょう。 --> Now we have loaded the first tape. Check with the <TT>status</TT> command. <tscreen><verb> # mtx -f /dev/nst1 status Data Transfer Element: Full (Storage Element 1 Loaded) Storage Element 1: Empty Storage Element 2: Full Storage Element 3: Full Storage Element 4: Full Storage Element 5: Full Storage Element 6: Full </verb></tscreen> <!--O ``Data Transfer Element'' にストレージ番号 1 のテープがロードされたことが わかります。同時に、マガジン内のストレージ番号 1 の位置は空になっていることも 確認できます。 --> You can see the tape of storage number 1 has been loaded to the ``Data Transfer Element''. You can also notice that the Storage Element 1 in the magazine has become empty. <p> <!--O この状態になれば、 あとは通常のドライブと同様に mt を使って テープの操作ができるようになっています。 それでは、ロードされたテープをマガジンに戻すにはどうするでしょう。 これはオプショナルコマンド ``unload'' を使うだけです。 --> At this stage, you can access the tape with mt as ordinary drives. When you want to return the tape to the magazine, just use the optional command ``unload''. <tscreen><verb> # mtx -f /dev/nst1 unload 1 Unloading Data Transfer Element into Storage Element 1...done </verb></tscreen> <p> <!--O テープのロードは、任意のストレージ番号に対して行えます。 では、ストレージ番号 2 のテープをロードしてみます。 --> You can load any tape of any storage number. Now, we load the tape of storage number 2. <tscreen><verb> # mtx -f /dev/nst1 load 2 Loading Storage Element 2 into Data Transfer Element...done </verb></tscreen> <!--O うまくいきました。 この状態で、別のストレージ番号を指定してロードすると、先にロードされていた テープは自動的に unload され、指定されたテープが代わりにロードされます。 マガジン内のストレージは、番号だけでなく「次のテープ」「前のテープ」 といった指定方法も可能です。先ほどのテープ 2 がロードされた状態で、 オプショナルコマンド ``next'' を発行してみましょう。 --> Looks fine. If you load another tape of different storage number, the one already loaded will be unloaded automatically, and the tape specified is loaded in place of it. You can also specify the storage in the magazine by "next tape" or "previous tape". Issue the optional command ``next'' (note that you have the tape 2 loaded at the moment). <tscreen><verb> # mtx -f /dev/nst1 next Unloading Data Transfer Element into Storage Element 2...done Loading Storage Element 3 into Data Transfer Element...done </verb></tscreen> <!--O ストレージ番号 2 のテープが unload され、 代わりにストレージ番号 3 のテープがロードされました。 ここから、もう一度前のテープに戻るには オプショナルコマンド ``previous'' を 使います。 --> The tape of storage number 2 has been unloaded, and the number 3 has been loaded. If you want to load the previous tape again, you can use the optional command ``previous''. <tscreen><verb> # mtx -f /dev/nst1 previous Unloading Data Transfer Element into Storage Element 3...done Loading Storage Element 2 into Data Transfer Element...done </verb></tscreen> <!--O 先ほどの状態に戻ったことがわかります。 --> You can find the status has been recovered. <p> <!--O この他にも ``first (マガジンにある最初のストレージ番号のテープをロードする'' ``last (マガジンにある最後のストレージ番号のテープをロードする)'' などのオプショナルコマンドがあります。 なお、これらのコマンドは、dump-0.4b17 以降であれば、 実際の dump の途中でテープエンドに達したときを見計らって 実行することができます。膨大なディスクを一度にバックアップするときには 大変便利な機能です。 --> Besides the ones already described, there are other optional commands such as ``first'' (load the tape of smallest storage number in the magazine) and ``last'' (load the tape of largest storage number in the magazine). If you are using dump-0.4b17 or later, these commands can be invoked when the tape reached its end during the dump. It must be very useful for the backup of huge disk at once. <!--O <sect>dump を使ったバックアップ --> <sect>Backup with dump <!--O <sect1>バックアップするファイルシステムの選択 --> <sect1>Select filesystem to backup <p> <!--O それでは、dump を使っての具体的なバックアップ作業について、順に解説してい きます。 --> In this section, I'll give a step-by-step description of backup procedure using dump. <p> <!--O バックアップは「すべてのファイルシステム」に対して行うことが原則です。 <p> ただし、フルレストアする時に、復元される必要のないファイルシステムまで、dump する必要はありません。<tt>/tmp</tt> が独立したファイルシステムなら、 これは真っ先に除外することができます。 これに類する物としては、proxy デーモンなどのキャッシュ ファイルもそうでしょう。また、Netnews の spool や、overview database, history などは、きっぱりあきらめてしまえば、これも除外することがで きます。 --> In general, you should backup "all filesystems". However, it is not necessary to dump the filesystems which don't have to be retrieved on full-restoration. For example, if <tt>/tmp</tt> is an independent filesystem, it can be excluded immediately. Similarly, cache data of proxy daemon can also be omitted. As well, the spool, overview database and history of Netnews system may be excluded if you give up on them. <p> <!--O これらを除いて、全てのファイルシステムを対象にします。対象となるファイルシス テムは、<tt>/etc/fstab</tt> の第5フィールドで 1 のフラグを立てておきます。 以下は、その例です。 --> The rest of all the filesystems should be the target of the backup. For them, put '1' flag on the fifth field of their entry in <tt>/etc/fstab</tt> file. Here is an example: <code> # /etc/fstab # /dev/hda2 / ext2 defaults,noquota 1 1 /proc /proc proc defaults,noquota 0 0 /dev/sdb3 /tmp ext2 defaults,noquota 0 2 /dev/sdb2 /var ext2 defaults,noquota 1 3 /dev/sdd2 /usr ext2 defaults,noquota 1 2 /dev/sdd1 /usr/local ext2 defaults,noquota 1 3 /dev/sde1 /var/spool/news ext2 defaults,noquota 0 4 /dev/sdc1 /var/spool/ov ext2 defaults,noquota 0 3 /dev/hda3 /.d1 ext2 defaults,noquota 1 2 /dev/hdb1 /.d2 ext2 defaults,usrquota 1 4 /dev/sdb1 /.d3 ext2 defaults,ro,noquota 1 4 /dev/sda5 /home ext2 defaults,usrquota 1 3 /dev/fd0 /mnt/floppy ext2 defaults,noauto,noquota 0 0 /dev/sdb4 none swap sw 0 0 </code> <!--O この例では、<tt>/tmp</tt>, <tt>/var/spool/news</tt> に加えて <tt>/proc</tt> そして <tt>swap</tt> の第 5 フィール ドも 0 になっています。よく、これらが 1 になっている人を見掛けますが、まった く意味がありませんし、誰かに見られると恥ずかしいので、ついでに直しておきましょ う。 --> In addition to <tt>/tmp</tt> and <tt>/var/spool/news</tt>, you may find that the fifth fields of <tt>/proc</tt> and <tt>swap</tt> are also 0. You may see 1 for these entries in some case, but they are by no means effective and may be even disgraceful, so fix them now with other modifications. <!--O <sect2>バックアップしないファイルを除外する<label id="exclude"> --> <sect2>Excluding files not to be backuped<label id="exclude"> <p> <!--O ディスクの区画分けの状態によっては、バックアップするファイルシステムの 中に、バックアップしたくないファイル群が含まれてしまうことがあります。 どうしてもそれらを除外したい場合は、専用のツールを使ってファイルが使用する i-node に除外の目印 (no dump flag) をつけることができます。 Proxy キャッシュディレクトリのように、頻繁に更新されるがバックアップの意味が ないファイル群に対して、この attribute を設定するとよいでしょう。 --> Depending on your partitioning, some backup target filesystems may include files which you don't want to backup. If you do wish to exclude them, you can mark their i-nodes with "no dump flag" with specific utilities. You may want to set this attribute for files updated frequently but no need to backup, such as proxy cache directory. <p> <!--O くわしい使い方は lsattr(1) と chattr(1) を参照して欲しいのですが、 --> This can be done with lsattr(1) and chattr(1). Lsattr shows you the flag status of the file, and chattr sets it. For example, <tscreen><verb> # lsattr -d /var/spool/squid ------- /var/spool/squid # chattr +d /var/spool/squid # lsattr -d /var/spool/squid ------d /var/spool/squid </verb></tscreen> <!--O というふうに、chattr コマンドで +d の no dump flag をつけたものは、dump の対 象から外せます。上の例では、Squid cache system が使用するキャッシュディレク トリとその巨大な中身に対して、そのような目印をつけています。ディレクトリに対 してこの目印がつくと、その後は中に作成されるファイルも同じ属性になります。 --> The files or directories with no dump flag (+d) are excluded from the target of dump. In the above example, the directory used by Squid cache system and its huge contents are marked so that they will not be dumped. Once the directory is marked with this flag, the files that will be created inside it will also have the same attribute. <p> <!--O ただし level 0 のフルダンプの際デフォルトではこの指定は無視され、実際に効果 があるのは level 1 以降のインクリメンタルバックアップの時になります。 もし level 0 の時も同じ効果を得たい場合は dump の h オプションで指定する必要 があります。 --> Note that this specification is ignored by default on level 0 full dump, and works only at the incremental backups of level 1 and later. If you want this to work on level 0, you should specify h option on the dump command line. <!--O <sect1>フルバックアップ <sect2>ファイルシステムを静止する --> <sect1>Full backup <sect2>Stop the filesystem <p> <!--O では、いよいよフルバックアップを行います。 --> Now we finally start the full backup. <p> <!--O フルバックアップの前には、システムをシングルユーザモードに移行し、各ファイル システムを静的な状態にして fsck をかけて、ファイルシステムに矛盾が生じていな いことを確認したほうがよいでしょう。フルバックアップはめったに行うものではあり ませんから、面倒でもやっておくことをお勧めします。 --> Before the full backup, you may want to get down the system into single user mode, make all the filesystems static and fsck them to ensure that they are consistent. Since the full backup is performed rarely, I recommend you to do this at any rate. <p> Firstly, get into the single user mode with: <tscreen><verb> # init 1; exit </verb></tscreen> <!--O まず、これでシングルユーザモードになります。 --> <p> <!--O 次に、ファイルシステムをひとつず つアンマウントし、ファイルシステムのチェックを行います。 --> Then unmount the filesystems one by one, and check them. <tscreen><verb> # umount /usr/local; e2fsck -afv /dev/sdd1 </verb></tscreen> <!--O (いちいちアンマウントするのが面倒であれば、 システムが起動するときに、あらかじめ Boot prompt で ``<tt>linux -b</tt>'' を指定して、ルートファイルシステムだけをマウントした状態に する方法もあります。) --> (If it's annoying to unmount each of them, you can specify ``<tt>linux -b</tt>'' on bootup so that only the root file system will be mounted.) <p> <!--O チェックはバックアップの対象となっている 全てのファイルシステムに対して行います。 ルートファイルシステムだけは注意が必要で、 一旦リードオンリーでマウントし直し、e2fsck をかけます。 --> Check all the filesystems to be backuped, presumably after unmounting them. Since you cannot unmount the root filesystem, you may want to remount it read-only, and check it with e2fsck. <tscreen><verb> # mount -r -n -o remount / ; e2fsck -afv /dev/hda3 </verb></tscreen> <!--O すべてのチェックが完了したら、 --> After all the check is done, remount it again with read-write, so that dump can log the backup information: <tscreen><verb> # mount -w -n -o remount / </verb></tscreen> <!--O として、ふたたびリードライトでルートファイルシステムをマウントします。 (リードオンリーのままだと、dump がバックアップ情報を残すことができません。) ネットワーク越しに dump をする場合など、<tt>/usr</tt> ファイルシステムが必要な 場合は、それらのファイルシステムを再度マウントし、ネットワークが 利用可能な状態にします。 --> If you need <tt>/usr</tt> filesystem and others on backup, e.g. dump over the network, mount them again to make the network available. <!--O <sect2>ドライブの準備<label id="drive_junbi"> --> <sect2>Set up the drive<label id="drive_junbi"> <p> <!--O 次に、バックアップメディアの準備をします。ここでは EXABYTE のEXB-8200 ドライ ブ (SCSI) に、112m の 8mm データカートリッジを使うことを例にします。 --> At this stage, we set up the backup media. As already described, I explain the operation for the EXABYTE EXB-8200 drive (SCSI) with 122m 8mm data cartridge as an example. <p> <!--O 最初に行うことは、テープヘッドのクリーニングです。EXABYTE の場合は、クリーニン グテープを装填すると、自動的にロードされてヘッドのクリーニングを行い、最後に 巻き戻さずに Eject します。この作業は、とくに level 0 の dump を行う際には必 ず実行する癖をつけてください。テープの読み書きの際にエラーが起きる可能性を確 実に減少してくれます。 --> The first thing you should do is the cleaning of the tape head. When you load a cleaning tape into EXABYTE drive, the cleaning process runs automatically, and the tape will be ejected without rewinding. You should accustom yourself to do this, especially before the level 0 dump. It certainly reduces the error occurrence during the tape read and write. <p> <!--O それからドライブに新品のテープを装填します。テープにはあらかじめラベルを貼っ ておきましょう。これをサボると、あとでだんだんわけがわからなくなりますよ。ラ ベルの内容は、これまでに購入したテープの通し番号で充分です。後述しますが、ラ ベルにあれこれ書くよりも、別に専用の管理ノートを用意して、細かなメモはそちら に記録することをおすすめします。テープをドライブに装填し終えたら、mt コマン ドでステータスを確認します。 --> Then load the new tape into the drive. Don't forget to label the tape beforehand, or you'd get corrupted as the number of tapes increases. It is enough to write down the sequence number of the tape. As will be explained later, I recommend to prepare a notebook to log the tape management information, rather than to write it on the label of each tape. After loading the tape into the drive, check the status with the mt command. <tscreen><verb> # mt status SCSI 1 tape drive: : : </verb></tscreen> <!--O このコマンドの出力は、ドライブの種類によって異なります。ここでは、テープがロー ドされていることが確認できれば充分です。 --> Depending on the kind of your drive, the output of this command differs. It is OK if you can confirm that the tape is loaded properly. <!--O <sect2>dump する --> <sect2>Dump <p> <!--O さて、いよいよ dump です。使い方はそれほど複雑ではありませんが、パラメータの 指定の仕方にちょっと癖があります。(v0.3 より新しいバージョンでは柔軟な指定も 可能になっていますが、ここでは古典的な文法に従います) --> Now we can invoke dump. It is not so difficult to use, but has some peculiarity in its parameter specification. (v0.3 or later allows more flexible options, but we here stick to the conventional syntax.) <!--O <code> 使用方法: dump `オプション' `パラメータ' `ファイルシステム' - オプション: 0123456789BbhfusTdWn 0 〜 9 : dump level B : ボリュームあたりのレコード数 b : 1 レコードのブロックサイズ(KB) h : nodump アトリビュートが影響する dump level f : 出力先ファイル(テープ)の指定 d : 記録密度 n : オペレータに注意を促す s : テープの長さ u : /etc/dumpdates を更新する T : /etc/dumpdates に記録する日時を指定する W : dump の対象になっているファイルシステムに 印をつけて表示する w : dump が必要なファイルシステムだけを表示する - パラメータ オプションの順に対応したパラメータを指定する。 たとえば、``sbf'' の順にオプションを並べた場合は、 dump sbf `テープの長さ' `ブロックサイズ' `出力先' `ファイルシステム' という順になる。 - ファイルシステム dump するファイルシステムのマウントポイントまたはデバイス名 </code> --> <code> USAGE: dump `option' `parameter' `filesystem' - options 0-9 : dump level B : number of records per volume b : blocksize per record (KB) h : dump level below which the nodump attribute affects f : output file (tape) d : tape density n : notify to the operator s : tape length u : update /etc/dumpdates T : specify the date to record in /etc/dumpdates W : print the filesystems to be dumped with marks w : print the filesystems which need to be dumped - parameters Specify the parameters corresponding to the options in sequence. For example, if the option is ``sbf'', the following parameters should be the order: dump sbf `tape length' `blocksize' `filesystem' `output file' - filesystem mount point or a device name of the filesystem to dump </code> <!--O 典型的なコマンドは以下のようなものです: --> Typical command line looks like: <tscreen><verb> # dump 0uf /dev/nst0 /home </verb></tscreen> <p> <!--O 最初の引数の数字は、0-9 の Dump level です。詳しくは後述しますが、`0' がフル バックアップを意味していると思ってください。`u' は、次回のインクリメンタルバッ クアップに備えて <tt>/etc/dumpdates</tt> を更新することを指示するものです。 <tt>/etc/dumpdates</tt> には、dump した時刻やレベルが記録されます。この情報は その後 dump プログラムによってインクリメンタルバックアップの際や w, W オプションで参照されます。 --> The number as the first parameter is the dump level between 0-9. The `0' here means the full backup, and the meaning of other numbers will be discussed later. The `u' specifies that the <tt>/etc/dumpdates</tt> file will be updated so that the following incremental backup can use the record. <tt>/etc/dumpdates</tt> contains the time and the level of the dump. This will be referred to at the following invocation of dump for incremental backups or from w/W options. <p> <!--O テープに dump する場合は blocksize や tape length を指示する必要があるでしょ う。もし「テープの容量は充分なはずなのに、途中で tape end に達してしまう」場 合は、このあたりに工夫が必要です。いい加減なやりかたですが、B option で、容 量を多めに明示してしまう方法もあります。 --> If you dump to the tape, you may have to specify the blocksize and the tape length. When you encountered the situation: `the tape capacity should be enough but the tape reaches its end during the dump', you may want to modify these parameters. Ad hoc workaround is to specify the over-estimated capacity with B option. <tscreen><verb> # dump 0uBf 2300000 /dev/nst0 /home </verb></tscreen> <!--O ここでは、8mm テープの容量におよそ 2.3GB という多めの見当 (blocksize で 2.3GB を割った数値を) を dump に指示しています。density や tape length の指 示はメディアの終了を検出できないドライブを使う場合に dump にメディア交換のタ イミングを教えてやるためのオプションです。しかし、最近のほとんどのドライブは テープエンドをきちんと検出できるので、このような方法でも問題がないでしょう。 --> This example specifies that the tape capacity is 2.3GB (i.e. the number of records for that; 2.3GB divided by the blocksize), which is the slightly too large estimation. The options to specify the density or the tape length are prepared to teach the dump when to exchange the media. But most recent drives can detect the tape end properly, you should have no problem this way. <p> <!--O 正常に dump がスタートすれば、いくつかのメッセージとともにバックアップは進行 します。このとき、バックアップ終了までにかかるおおよその時間などが表示されま す。このジョブは、最初のころはバックグラウンドに回さずに、 フォアグラウンドで実行してください。 もしテープエンドに達したり、なんらかのエラーが発生した場合は、 対話的な選択処理を求められることがあるからです。 --> When dump is invoked normally, backup proceeds with some messages printed on the console, which include the estimated duration until the backup finishes. It is a good idea to leave this session foreground rather than to send it to background, until you are convinced the things work fine. If it reaches the tape end or if some error occurs, you will be requested to do some choices in the interactive session. <p> <!--O dump が無事に終了し、まだテープ残量に余裕がある場合は、そのまま続けて別のファ イルシステムの dump を行うことができます。 --> When the dump session finishes properly, you can dump another filesystem if the tape capacity remains enough. <!--O <sect1>ダンプレベルとインクリメンタルバックアップ --> <sect1>Dump level and incremental backup <p> <!--O dump はダンプレベルを指定されることによって、バックアップの動作を決定します。 ダンプレベルは 0-9 の範囲の整数で、指定がない場合は 1 が指定されてた物と仮定 されます。あるダンプレベルが指定されると、それより小さい数のダンプレベルで dump が実行された時刻より後に更新されたファイルだけをバックアップの対象にし ます。 --> The backup behavior of dump is dependent on the specified dump level, which is an integer between 0-9. If not given, default value 1 is used. When invoked with some level, dump selects the files which have been updated since it ran with SMALLER level than the current one, and backups them. <p> <!--O たとえば、level-4 のバックアップの後、level-5 のバックアップが実行されると、 level-4 バックアップ以降に更新されたファイルが level-5 のバックアップアーカ イブに記録されることになります。 --> For example, if level-5 backup is invoked after level-4 backup, the files updated after the level-4 backup will be recorded to this level-5 backup archive. <p> <!--O この仕組みを利用すると、インクリメンタルバックアップが簡単にできることになり ます。たとえば、 --> Using this, you can make incremental backups easily. If you run dump with: <!--O <code> 1 日目 level 0 2 日目 level 1 3 日目 level 2 4 日目 level 3 5 日目 level 4 6 日目 level 5 7 日目 level 6 8 日目 level 7 9 日目 level 8 </code> --> <code> Day 1 level 0 Day 2 level 1 Day 3 level 2 Day 4 level 3 Day 5 level 4 Day 6 level 5 Day 7 level 6 Day 8 level 7 Day 9 level 8 </code> <!--O という順に dump を実行すると、2 日目以降は前日から更新のあったファイルだけを バックアップします。こうすることによって、バックアップに要する時間を最大限に 節約することができます。 --> Then after the Day 2, you can backup updated files only. With this sequence, you can minimize the backup time. <p> <!--O もうちょっと凝った方法としては、``ハノイの塔のシーケンス'' という方法で dump level のスケジュールを組むというやり方があります。 --> If you like more elaborated method, ``Tower of Hanoi sequence'' is known for the dump level scheduling. <p> <!--O たとえば: --> For example, proceed the dump sequence as follows. <!--O <code> 0 -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 1(a) -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 1(b) -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 0 に戻る </code> --> <code> 0 -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 1(a) -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> 1(b) -> 3 -> 2 -> 5 -> 4 -> 7 -> 6 -> 9 -> 8 -> Return to 0 </code> <!--O という順に dump を進めます。level 0 のテープは安全な場所に永久保管し、level 0 dump では常に新しいテープを使うようにします。 level 1 のテープはローテーション分 (上の図の例では 2セット) 用意します。 それ以外のテープは 1 set ずつで充分です。 --> You should renew the tape on each level 0 dump, and store them at safe place perpetually. For level 1, prepare tapes as many as the number of rotations (2 in the above example). For other levels, one tape is enough per level. <p> <!--O この方法のメリットは、ある時点でのファイルシステムの状態を長い時間保存でき、 かつバックアップの時間とメディアを節約できることです。 --> The merit of this method is that you can preserve the snapshots of the filesystem for a long period, and that you can save the time and the media necessary for each backup. <p> <!--O ところで level 0 のフルバックアップの際にはシングルユーザモードで作業をしま した。では、level 1 以降のインクリメンタルバックアップの際にはどうすべきでしょ うか。日常的にバックアップをするようになると、いちいちシステムの運用を停めて いられない、というのが実情でしょう。私はマルチユーザモードでやっても構わない と思ってます。このあたりは運用の利便をとるか、安全を取るかの選択になります。 --> By the way, you may remember that we entered into the single user mode on getting the level 0 (full) backup. Should we also do the same way on each incremental backup? If you backup the system periodically, it should be difficult to stop the system every time. In my opinion, it is acceptable to backup the system on multi-user mode. It is your choice to choose the convenience or the robustness. <p> <!--O ただし、そのインクリメンタルバックアップの直後に クリティカルなハードウェアなどのメンテナンスが 予定されているようなケースでは、 システム停止直前の状態を確実に保存するために、 level 1 のインクリメンタルバックアップを シングルユーザモードで行うほうがよいでしょう。 --> If critical maintenance (e.g. change the hardware) is scheduled after the incremental backup, however, you should consider the level 1 dump with single user mode, so that you can make sure the preservation of the system status prior to the system halt. <!--0 <sect1>dump の記録<label id="logging"> --> <sect1>Log the dump records<label id="logging"> <p> <!--0 <ref id="drive_junbi" name="ドライブの準備"> の項で「テープのラベルにあれこれ書くよりも、別に専用の管理ノー トを用意して、細かなメモはそちらに記録するほうがよい」と書きました。 これは、記録しなければならない項目がラベルに収まるほど少なくはないからです。 --> As I mentioned in the section <ref id="drive_junbi" name="set up the drive">, it is recommended to log the dump information on a destined notebook rather than on the tape label. It is because that the information is too much to record on the label. <p> <!--0 この記録が必要になるのは restore の時です。どのテープのどの位置に、どのファ イルシステムが記録されているのか、すぐにわかるようにしておくことが重要です。 (そういうときは大抵、軽いパニックになっていたりしますから) --> This information is necessary when you restore the data. It is important to make clear that each filesystem is recorded which part of which tape (you may be upset when you have to restore the system :-) <p> <!--0 ここはひとつ、専用の管理ノートか、プリンタ出力を保存するバインダを用意して、 dump を実行している間に詳細なメモを記録するようにしましょう。記録しておきた いことは: --> You should maintain the detailed dump log, by preparing either the destined notebook or the folder to file printouts. Entries you may want to record are: <!--0 <code> [Tape No.nnnn] テープそのものの通し番号 File count: テープ先頭からの位置 Date: 日付 Host: dump の対象となったホスト名 Filesystem: ファイルシステムの名前 Device: ファイルシステムのデバイス名 Level: dump level Blocks: アーカイヴされたブロック数 Length: テープ中でこのアーカイヴの占める長さ </code> --> <code> [Tape No.nnnn] the serial number of the tape cartridge File count: the location of the data in the tape Date: date Host: hostname of the target machine Filesystem: name of the filesystem Device: device name of the filesystem Level: dump level Blocks: the number of blocks archived Length: the proportion of this archive in the tape </code> <!--0 くらいで充分でしょう。たとえば、 --> One of my records looks like: <code> [Tape No.0024] Date: Wed Nov 12 12:39:57 1996 File count: 1 Host: nicorn Filesystem: /home Device: /dev/sda5 Level: 0 Blocks: 392556 Length: 0.16 </code> <!--0 というぐあいです。これは、dump のステートメント出力を perl などで整形すれば 簡単ですから、それほど手間はかかりません。これをプリントアウトして、バインダ に綴じておけばOK です。 --> It is not so hard to get such data by formatting the output of dump (using perl or the like). Once it works, all you have to do is print out the data and file it away. <p> <!--0 バックアップとは直接の関係はありませんが、 ついでに fdisk -l の出力などもプリントアウトしておくと、 事故の際の復旧には参考になるでしょう。 --> It is also a good thing to keep other information like the output of "fdisk -l". If you have printouts of such data, you will find it helpful when you restore the system. <!--0 <quote> (FYI: dump 実行の際にログを自動的に保存するようなスクリプトが <newline> <htmlurl url="http://shaq.pnl.gov:2080/~d3c572/docs/" name="http://shaq.pnl.gov:2080/~d3c572/docs/"> <newline> で公開されています。私はこれに気づく前に自作のものを使い始めて しまったので詳しいことはわかりません。) </quote> --> <!--URL 404 20030328 nakano <quote> (FYI: You can find a script program that automatically saves the dump info at: <newline> <htmlurl url="http://shaq.pnl.gov:2080/~d3c572/docs/" name="http://shaq.pnl.gov:2080/~d3c572/docs/"> <newline> I know little about this script, because I wrote a script by myself and have been using it.) </quote> --> <p> <!--0 もうひとつ余力があればやっておきたいことは、アーカイヴに格納されたファイルの 一覧をテキストファイルに保存しておくことです。 これは dump を行うごとに mt コマンドでテープを巻き戻し、 restore -t を実行してその出力を保存するとよいでしょう。 このファイルを、たとえば <tt>/var/spool/adm/dump_index/</tt> などの ディレクトリ以下に保管しておけば、 部分的な restore の際に、どのアーカイヴに目的のファイルが入っているのか grep コマンドで探し出すことが容易になります。 同時に、restore -t を実行しておくことで、今作成したばかりのアーカイヴが 正しく読み出せるかどうか、確認できることにもなります。 --> One more thing you may want to do is to record a list of archived files in a text file. To make this list, rewind the tape via mt command after each dump, invoke the "restore -t" command and redirect its output. Save this list in a directory like <tt>/var/spool/adm/dump_index/</tt>, and you can easily grep this list to find out which archive has the file you want. This practice is also profitable to confirm that the archive just created can be read properly. <sect1>Rdump <p> <!--0 rdump を利用してネットワーク越しに dump を実行することもできます。引数などは dump と同じですが、dump 先の指定には、リモートマシン名をつける必要があります。 (実は rdump の実体は dump そのものです)。 以下の例は、ローカルマシンの <tt>/home</tt> をリモートマシン `tapeserver' に接続された テープデバイスに dump することを示しています: --> It is possible to dump over the network: you can use "rdump". It takes the same arguments as dump except for a remote hostname to send the dump data (actually rdump and dump share the one executable binary). In the following example, we dump the files in <tt>/home</tt> directory on the local machine, to a tape device on the remote machine named "tapeserver". <tscreen><verb> # rdump 0uf tapeserver:/dev/nst0 /home </verb></tscreen> <p> <!--0 ネットワーク越しに dump する際には、 rsh がパスワードなしに実行できる環境になっている必要があります。 さらに、dump はリモートマシン上で <tt>rmt</tt> を起動しますので、 <tt>rmt</tt> が rsh 環境での実行ファイル検索パスに含まれている ことも条件になります。Linux のディストリビューションによっては、 <tt>rmt</tt> が実行ファイル検索パスに置かれていないことがあります。 --> To dump over the network, you have to be able to rsh the remote system without entering a password. It is also required that the rsh can locate the <tt>rmt</tt> command binary in its path, since rdump uses it on the remote machine. The path to <tt>rmt</tt> is sometimes not set by default in some Linux distributions. You can check it by: <code> # rsh remotehost which rmt </code> <!--0 の結果、<tt>rmt</tt> が見つからなかった場合は、シンボリックリンクを 作成して <tt>rmt</tt> が rsh 環境での実行ファイル検索パスに含まれる ようにしてください。 --> If it doesn't tell the location of <tt>rmt</tt>, create a symbolic link of <tt>rmt</tt> in the command path in the environment of the rsh. <p> <!--0 また、通常バックアップの作業は root で行うことになりますが、 root がパスワードなしにリモートシェルを実行できる環境は セキュリティを考えると問題があります。 --> Usually, backup is done by root. But remote rsh via root without password may cause a serious security problem. <p> <!--0 多少なりとも危険を回避するためには、dump 専用の uid を用意した方が よいでしょう。手順は以下の通りです。 --> To reduce somewhat of the security risk, you should create a specific uid for your dump job. You can set it up in the following way. <itemize> <item> <!--0 LAN 内のすべてのホストに vipw でユーザ名 fsdump を追加する。 パスワードは ``<tt>*</tt>'' でよい。 --> Using vipw, add a user named "fsdump" on all hosts in your local network. Leave its password entry as "<tt>*</tt>". <item> <!--0 ユーザ名 fsdump のホームディレクトリを <tt>/etc/fsdump</tt> にする。 --> Set its home directory to <tt>/etc/fsdump</tt>. <item> <!--0 ホストの OS が Linux の場合はユーザ名 fsdump を disk グループに追加する。 (その他の OS にも、同等のグループが存在するはずです) --> If you use Linux on the host, add the user fsdump to the "disk" group (or to the equivalent group if you use other OS). <item> <!--0 テープドライブの接続されたホストの <tt>/etc/fsdump</tt> に <tt>.rhosts</tt>ファイルを作成し、LAN 内のユーザ fsdump がパスワードなしで アクセスできるように記述する。 --> Create <tt>.rhosts</tt> file in <tt>/etc/fsdump</tt> on the machine that has a tape drive, so that the user fsdump in your network can access to the machine without entering a password. <item> <!--0 リモートからの dump は su で fsdump になって作業する。cron から 起動する場合も、fsdump の cron を利用する。 --> Execute remote dump as user fsdump (use su). If you want to use cron, add this job to fsdump's crontab. </itemize> <!--0 <sect1>テープの保管 --> <sect1>Store the tape <p> <!--0 level 0 のテープはできるだけ長期間保管されることが 望まれます。 いうまでもないことですが、 テープはその性質上、熱やほこり・湿気・磁気に弱いので、 温度変化の激しい場所や直射日光の当る場所などに保管すると、 データが正常に読み出せなくなることがあります。 --> It is desirable to save the level 0 tape cartridge as long as possible. Needless to say, tape reel is very sensitive to heat, dusts, humidity and anything magnetic. You should keep it away from them, or you will not be able to read it out properly. <p> <!--0 また、level 0 と 1 のテープはマシンの置いてある部屋以外、 可能であるなら別の建物に保管することが推奨されています。 これは火災などの事故によって、マシンとテープの両方が 一度に失われてしまうことを避けるためです。 --> It is also recommended that the level 0 and level 1 tape cartridges should be kept in a separated room (and in a separated building, if possible) from the machine. This will protect you from losing both your machine and tapes in a single disaster like fire. <p> <!--0 部分的な restore を迅速にサービスしたい場合は、 level 2-9 のテープくらいはマシンと同じ部屋に保管しておきたい場合も あるでしょう。 それでも管理者以外の人間が触れることのできる場所に テープが保管されている状態は、セキュリティ上好ましくありません。 --> To provide the partial restoration service, you may want to keep level 2-9 tapes near the machine. Even in such cases, it is not good for security to leave them where anyone can touch. <p> <!--0 もっとも望ましい状態は耐火・耐熱性の金庫などに入れて施錠することです。 これを大げさと思うならば、せめてテープのラベルには「他人が読んでも 中身がわからない」情報だけを書くようにしましょう。 中身を読み出されてしまえば同じことなのですが、悪意を持った人物の 行為を助けるようなことはしないほうがましです。 <ref id="logging" name="dump の記録">でも触れたように、 別のノートなどに詳細な記録を保管しておけば、混乱の原因にはなりません。 --> The most desirable practice is to protect the tape cartridges in a (fireproof) cabinet and lock them up. It may sound exaggerated for you, but at least you should become aware of this kind of data protection. For instance, you should not write the information on the tape with which the bad person can guess the contents of it. It doesn't help once the tape is read, but it's still better not to help such a person at least. This will not be confusing if you record the dump logs in the notebook as described in <ref id="logging" name="Log your dump records">. <p> <!--0 level 0 のテープは定期的にロードしてみて、リードエラーが 起きないことを確認すると安心といわれていますが、ここまでやるのは 本当に大変なので、よほど余力がある場合に限られるでしょう (私はやっていません)。それよりは定期的に level 0 のフルダンプを 新しいテープに行う方が確実です。 --> If you are a paranoid, you may want to load the level 0 tape periodically and make sure that no read error should occur. But this is very hard to do, and affordable only to those who have plenty of time and power (I have never done it). Instead, I suggest you to perform level 0 (full) dump periodically and use a new tape cartridge each time. <!--0 <sect1>スケジューリング --> <sect1>Backup scheduling <p> <!--0 これでとりあえず手動でバックアップすることができるようになりました。でも、 退屈な作業は長続きしないので、できるだけ作業を自動化することを考えましょう。 同時に、どれくらいの頻度でバックアップをするのか、そのスケジュールも考える 必要もあります。 --> Now, we can backup the system manually. But it is painful to continue the boresome work, so let's consider the way to do it automatically as much as possible. At the same time, you have to consider how often you should backup the system. <p> <!--0 バックアップの頻度は、システムがどのように利用されているかによって異なります。 また、バックアップ作業をする人がどの程度の労力をかけられるのか、 バックアップアーカイブにはどの程度の完全性が要求されているのか、 その完全性を確保するために犠牲になるものは何か、 どれくらいのコストが必要になるか、 なども考慮に入れて総合的に判断しなければなりません。 --> Backup schedule depends chiefly on how the system is being used. It also depends on how much time and power you can use for the backup, how much reliability the backup needs, and how much cost you can pay for it, etc. You have to determine your backup schedule taking all of these into accounts. <p> <!--0 理想的には、マシンを使った日は、かならず一度インクリメンタルバックアップをす るべきですが、個人ベースで利用している場合は、数日の間を開けてもかまわないで しょう。逆に神経質な人は特定のファイルシステムだけは数時間に一度バックアップ したいと考えるかも知れません。 --> Ideally, you should backup the system once a day incrementally when you use it. If it's your private machine, it is acceptable to do it with a few days interval. On the other hand, if you're very cautious, you may want to backup most important filesystems every few hours. <p> <!--0 目安として「一回のインクリメンタルバックアップの全分量が、一本のテープに収ま らないほど間隔をあけないようにする」ことはひとつの条件です。途中で テープのかけ替えが発生しなければ、無人で作業を行える可能性があるからです。 --> One guideline is "Backup before the data exceed the tape capacity". If you don't have to change tapes during the backup, it is easier to automate the backup process. <p> <!--0 しかし、テープの余裕がありあまるとしても、最低週に一度はバックアップを更新す ることを目安にしてください。データは、新しい物ほど重要であるケースがほとんど で、一カ月前のデータが復元されても、何の役にも立たない場合があります。 --> Even if your tape has a plenty of space, consider backing up at least once a week. In most cases, newer data are more important. Data a month old are sometimes no more than the garbage. <p> <!--0 また、バックアップを実行する時間も考慮してください。level 0 のフルバックアッ プの際には、システムの運用を停止しなければなりません。それ以外の level のバッ クアップ作業も、できればシステムの負荷が低く、ファイルシステムの更新頻度が 低い時間帯 (深夜など) を選んだ方がよいでしょう。 --> It is also important when to run the backup. You should stop the system when you do the level 0 full backup. For other levels, it is also good to choose the time when the system load is low and the renewal of files seldom occurs (i.e. midnight). <p> <!--0 これらのバランスを考えて、あなたのシステムに最適なスケジューリングを見つけ出 してください。そのスケジューリングに、テープドライブのクリーニング作業を入れ るのを忘れずに。 --> Find out your own backup schedule considering and balancing these factors. And never forget cleaning the tape drives periodically. <!-- 具体例省略 1999.2.1 --> <sect>Restore <p> <!--0 restore(8) は、dump(8) を使って作成されたアーカイヴからファイルを取り出し、 ファイルシステムに復元するためのプログラムです。 ファイルシステム全体の復元を一度に行うこともできますし、 対話的に必要なファイルを選択し、部分的な復元を行うことも可能です。 dump と restore をパイプで組み合わせることによって、 あるファイルシステムの中身を、別のファイルシステムにコピーすることもできます。 rdump と同様、rrestore はリモートホストに接続されたテープドライブの アーカイブを読出すこともできます。 --> &dquot;restore(8)&dquot; is a program to extract files from the archive created by &dquot;dump(8)&dquot;, and to recover them on your target filesystem. It is possible either to recover the whole filesystem at once, or to choose the files to retrieve interactively. A piped combination of &dquot;dump&dquot; and &dquot;restore&dquot; can duplicate the contents of a filesystem on another filesystem. As rdump, there is an r-version of the restore, &dquot;rrestore&dquot;, which can read the archive in the tape drive on a remote host. <p> <!--0 <code> 使用方法: restore `キー' [キー修飾文字] キー (主なもののみ): i 対話的にファイルを取り出す r アーカイヴ全体をカレントディレクトリに取り出す R 中断したフルレストアを再開する t アーカイヴ中のファイルのリストを出力する C 現存するファイルシステムとアーカイヴを比較する T テンポラリディレクトリを指定する s テープの中のアーカイヴの位置を指定する x 指定したファイルだけをアーカイヴから取り出す f アーカイヴファイルを指定する h ディレクトリ名を指定したときに、ディレクトリのみを対象にする v 冗長に実行する y エラーが発生しても問い合わせをしない </code> --> <code> Usage: restore `key' [key-modifier] Keys (summary): i Interactive restoration of specified files r Extract the contents of the whole archive in the current directory R Resume interrupted full-restoration t List filenames on the backup archive C Compare the contents of the archive with the current filesystem T Specify the temporary directory s Specify the position of the archive in the tape x Only the named files are extracted from the archive f Specify the archive file h Extract only the directory when specified, rather than with its contents v verbose output y Do not query on error. </code> <!--0 典型的な使い方としては: --> Examples: <!--0 <code> restore rf /dev/nst0 (テープのアーカイヴからカレントディレクトリに ファイルをすべて取り出す) restore isf 3 /dev/nst0 (テープの 3 番目のアーカイヴから対話的にファイルを取り出す) rrestore tf tapeserver:/dev/nst0 (ホスト tapeserver に接続されたテープからアーカイヴの リストを取り出す) </code> --> <code> restore rf /dev/nst0 (retrieve all the files from the archive in tape media, and write them under the current directory) restore isf 3 /dev/nst0 (do interactive restoration from the 3rd backup on the tape media) rrestore tf tapeserver:/dev/nst0 (list filenames in the archive stored in the tape of the host `tapeserver') </code> <!--0 などがあります。 --> <p> <!--0 使い方はそれほどむずかしくありませんが、ちょっと特殊なツールなので 一度は操作して慣れておく必要があります。基本的な操作に関する解説は restore(8) マニュアルの繰り返しになるので、ここでは省略します。 --> It is not so hard to use this but rather tricky, so you should be familiar with it before you have to use it. The explanation of basic operations is omitted here since you can read the manual page of &dquot;restore(8)&dquot; for this purpose. <!--O <sect1>レストアの際の注意 --> <sect1>Notes on restoration <p> <!--O 対話的にファイルの部分レストアをする際に、 一般的には直接ターゲットとなるディレクトリに上書きするのではなく、 空のディレクトリをカレントディレクトリにしてファイルを書き戻し、 その後しかるべき場所にファイルを移動します。 フルレストアの際には、フォーマットしたディスクをマウントし、 そのマウントポイントに移動してから restore を起動します。 したがって、root パーティションを含めたフルレストアの際には、 非常用のレスキューフロッピーディスクなどが必要となります。 --> On using the partial restoration interactively, it is not a good habit to restore them directly to the target directory. Instead, you should restore the files on an empty directory (by changing the current directory to it), and move them to proper locations accordingly. On full restoration, you should mount a formatted disk at first, move to that mount point, and invoke the restore command. Therefore, if you have to restore the root partition, you have to prepare a kind of rescue system. <p> <!--O 注意が必要なのは、フルレストアの際にアーカイヴからファイルを取り出す順番です。 特に r コマンドでアーカイヴ全体を展開する場合は、必ず level 0 のアーカイヴ から開始する必要があります。 --> You should be careful about the sequence of the archives to restore. Especially, on extracting the whole contents of the archives with r command, you MUST start with the level 0 archive. <p> <!--O また、ある dump レベルより後に、それより若い数のレベルで dump が行われた時、 フルレストアの際には無効になる level がでてきます。 たとえば、``ハノイの塔のシーケンス'' にしたがって --> It should also be noted that an archive with some level is ineffective if smaller level dump is taken after that. For example, consider the case when you follow the ``Tower of Hanoi'' sequence and choose the dump level as: <code> 0 3 2 5 4 7 6 9 8 </code> <!--O と dump を続けたケースでは、level-3 のアーカイヴは、その後に続く level-2 の dump が行われた時に無効になります。同じように、 level-5 のアーカイヴは、その後に続く level-4 の dump が行われた時に、 無効になります。極端にいうと、level-0 の dump が行われれば、 それまでの level-[1-9] のアーカイヴは、すべて無効です。 --> In this case, the level-3 archive becomes ineffective when the next level-2 dump is taken. Similarly, level-5 archive is ineffective after the next level-4 dump. Extremely, when level-0 dump is taken, all the existing archives with level-[1-9] become ineffective. <p> <!--O したがって、フルレストアをする際には、無効になったレベルのバック アップを飛ばして restore を実行することになります。上記のシーケ ンスの場合、 --> Therefore, on full-restoration, you should skip these ineffective archives. In the above example, you should choose the restoration sequence as <code> 0 2 4 6 8 </code> <!--O と restore していけば、ファイルシステムは最後のバックアップの状 態に戻ります。 --> to obtain the latest status of the filesystem. <p> <!--O これを ``ハノイの塔シーケンス'' にしたがってそのまま restore しよ うとするとどうなるでしょうか。 <p> level-2 のテープを restore しようとすると、``Incremental tape too high'' とエラーが出てしまい、それ以降の restore では ``Incremental tape too low'' といわれます。 <p> これらのエラーが出た場合は、そのまま restore を続けても正常にフ ルレストアできませんから、最初から restore をやり直してください。 --> If you ignore this rule and try to restore the archives just following the ``Tower of Hanoi'' sequence, you will obtain ``Incremental tape too high'' error on the restoration of level-2 archive, and ``Incremental tape too low'' errors after that. Once you encounter one of these errors, you cannot complete the full restore by any means, and you must restart that restoration from the first step. <p> <!--O (中間で無効になってしまうレベルが生じてしまうからといって ``ハノイ の塔シーケンス'' に意味がないわけではありません。頻繁に更新される ファイルシステムの、過渡的な状態をできるだけ長い期間保持し、なお かつバックアップのメディアを節約するためには、効率のよい方法とい えます。) --> (The generation of ineffective archives does not mean the uselessness of the ``Tower of Hanoi'' sequence. It is still useful to preserve many snapshots of the filesystem for a long period with less backup media.) <p> <!--O もうひとつ気をつけなければいけないのは、restore は比較的大きなテンポラリ スペースを必要とするということです。 Rescue Disk などで復旧のために起動したときには、 通常わずかなテンポラリスペースしか用意されていません。 復旧しようとするディスクには、当然 mke2fs で新たにファイルシステムを 作成しますが、作業用テンポラリスペースのためにも、別の 空いているファイルシステムを作成してください。 そして、そのスペースを <tt>/tmp</tt> にマウントするか、restore の T を 使ってテンポラリスペースとして指定するようにしてください。 これはうっかり忘れがちなことなので注意が必要です。 --> Another point you have to consider is that the restore needs fairly large temporary space. Generally, you only have small amount of space when you boot the system with a kind of rescue disk for recovery. So you should prepare another filesystem for the temporary working space, in addition to the one to be restored. And mount the working filesystem on <tt>/tmp</tt>, or specify that temporary space with the T option of the restore command. It is frequently overlooked. Please be careful. <p> <!--O それと、勘違いしてしまう方も多いのですが、 dump/restore はディスクのブートブロックなどは保存/復旧しません。 フルレストアをした後には OS のブートに関わる設定を再確認してください。 --> It is also confusing that dump/restore does not save/retrieve the boot block of the disk (or of the sort). After the full restoration, please check the boot configuration of the OS. <!--O <sect1>フルレストアの手順 --> <sect1>Full restoration recipe <p> <!--O 以上のことをふまえた上で、トラブルによってフルレストアが必要になったケースの 手順を参考としてまとめておきます。 --> With these points in mind, I summarize the procedure of the full restoration in case of trouble for your convenience. <p> <itemize> <item> <!--O ハードウェアの故障が原因なら、まずその問題を解決する。 --> Check whether hardware is the problem, and solve it if necessary. <item> <!--O dump 状況を記録したノートをよくにらんで、復旧の手順を 紙に書き出して確認する。 --> Read the notebook of the dump log carefully, and figure out the restoration sequence. It is highly recommended to write down the sequence on paper and double-check it. <item> <!--O テープドライブにセットするテープは、 ノッチが書き込み禁止になっていることを必ず確認する。 --> Confirm that the tape is write-protected before setting it to the drive. <item> <!--O レスキューシステムで起動する。 --> Boot the system with the rescue floppy. <item> <!--O 復旧のターゲットとなるディスクをフォーマットする。 --> Format the target disk and create the filesystem to restore. <item> <!--O 復旧のターゲットとなるディスクを仮のディレクトリにマウントする。 --> Mount the target filesystem on some directory. <item> <!--O restore が使用するテンポラリスペースを確保する。 --> Prepare the temporary space used by restore. <item> <!--O インクリメンタルアーカイヴを順にレストアする際には、 最後のレストアが終了するまで <tt>./restoresymtable</tt> を消さない。 --> During the restoration of incremental archives in sequence, never erase the <tt>./restoresymtable</tt> file until the restoration is over. <item> <!--O OS のブート手段 (lilo など)を再設定する。 --> Reconfigure the boot method (lilo, etc.). <item> <!--O restore がすべて終わり、復旧に成功したことが確認できたら --> After the restoration is finished successfully and you confirm everything is OK: <itemize> <item> <!--O <tt>./restoresymtable</tt> を削除する --> Erase <tt>./restoresymtable</tt> <item> <!--O level 0 の dump を新しいテープに行う。 (古いテープも当分の間保存する) --> Invoke the level 0 dump with a new tape (and preserve the old tapes for a while). </itemize> </itemize> <!--O <sect>バックアップは本当に必要か? --> <sect>Is backup really necessary? <p> <!--O さて、バックアップは本当に必要なのでしょうか? --> Now that, you really need the backup? <p> <!--O 「再インストールすれば、それですむ」という考え方もあります。でも日常的に Linux を使っていれば、ファイルシステム上には苦労して作り上げたプログラム、書 きかけのドキュメント、大切な人からもらったラブレターがホームディレクトリのど こかにあります。一度失われてしまったそれらのファイルは、システムを再インストー ルしても、もう戻ってきません。 --> You may think reinstalling the system should be OK, but if you've been using Linux on daily basis for years, you must have achievements of your hacking effort, unfinished documents, or mails you received from your precious person, somewhere in your home directory. Once they are lost, then they cannot be restored even if you got your Linux reinstalled. <p> <!--O そして、あなたがシステム自体に手を加えたり (大抵の場合、<tt>/etc</tt> の ファイルの大半には手が入ってます)、 独自にソフトウェアのインストールをしていたりしたら、 被害はさらに拡大します。あなたはシステムを再インストールした後、すべてのコン フィグレーションをやり直し、ソフトウェアを元通りの形で動作するようにコンパイ ル・インストールすることになるでしょう。 --> And yet, it may become a nightmare if you have modified your configuration files (most files in <tt>/etc</tt> directory are more or less changed), or have installed applications by yourself. After the reinstallation, you'll have to reconfigure the system, recompile/reinstall your applications to get back the system as it was. <p> <!--O ``ext2 ファイルシステムは頑丈なのでめったなことでは壊れない。 したがってバックアップは必要ない'' という意見もあります。確かに ext2 ファイルシステムが破綻をきた すことはほとんどありません。私の経験では、ext2 ファイルシステムがソフトウェ ア上の問題が原因で破壊されてしまったことはありません。 --> You may also think that the ext2 filesystem is stable enough and hardly corrupted, so you don't need backup at all. It is true that the ext2 filesystem is very hard to fail. I've also never seen it crash because of the software problems. <p> <!--O しかし、どんなに注意をはらっても、いつかファイルに関するトラブルに遭遇します。 あるユーザがひとつのファイルを削除してしまうという、軽度のミスもあれば、ハー ドウェアのトラブルが原因でファイルシステムに矛盾を生んでしまうこともあります。 私は SCSI ホストアダプタに異常が生じて機能を停止して しまった経験を持っています。この時は e2fsck では修復できないエラーがディスク に生じてしまい、失われてしまった多数のデータを回復するにはバックアップに頼る 以外ありませんでした。 --> But however cautious you may be, you cannot go through without facing troubles with files. On many occasions, careless users easily delete files. Or on rare occasions, the filesystem may become inconsistent, being damaged by hardware troubles. In my experience, a SCSI host adapter was broken and made inaccessible. This accident had brought to my hard disk some fatal errors which could not be repaired by e2fsck, so I had to rely solely on my backups to restore the all data. <p> <!--O バックアップの作業は、それ自体がシステムのリソースを必要としますし、なにより 「とっても退屈」な作業です。しかし、これはなにより大切な任意保険と考えてくだ さい。それも、その辺の保険会社がトラブルの時にあれこれ理由をつけて支払いをし ぶるのに比べれば、ずっと正直で確実な保険です。 --> Backup will consume your system resources, and its configuration is by no means fascinating or exciting. But you should think of it as a sort of insurance, personal but indispensable. As for real-life insurance, the specified sum is most reluctantly or sometimes not sufficiently paid out to you for some reasons or others. Compared to it, backup can be said to be far more faithful and reliable. <!--O <appendix><sect>この文書について --> <appendix><sect>Administrivia <sect1>Copyright notice <p> Copyright(c) 1998,1999 by FUKUSHIMA Osamu <p> <!--O この文書の著作権(C)は福島於修 <tt/<fuku@amorph.net>/ が 保持します。この著作権表示が全てのコピーに残されるかぎり、 この文書は自由に複製・配布することができます。 部分的に配布する場合には、著作権に関する記述と 完全な文書の在処を併記すると共に、 それが部分的な配布であることを明記されるようお願いします。 なお、これらの複製・配布にあたっては、著作権保持者の許可は必要ありません。 --> This document is copyrighted by Osamu Fukushima <tt><fuku@amorph.net> </tt>. It may be reproduced and distributed freely, as long as this copyright notice is retained on all copies. If you distribute this document in part, you must include this copyright notice, instructions for obtaining the complete version of this document, and a notification indicating that the copy is a part of the document provided. No approval by the author is necessary for your reproduction or distribution of this document. <!--3D-Modeling--> <!--O <sect1>責任の放棄 --> <sect1>Disclaimer <p> <!--O この文書の内容は無保証であり、私は本文書の内容についての責任を否認します。 本文書に含まれている例などを使用するのは、全て読者の責任で行ってください。 --> I provide NO WARRANTY about the information in this HOWTO and I cannot be made liable for any consequences resulting from using the information in this HOWTO. Use the concepts, examples and other content at your own risk. <!--O <sect1>謝辞 --> <sect1>Acknowledgement <p> <!--O 集合型テープドライブの章を執筆するにあたり、 NEC (NECソリューションズ) 様 から検証用機材をお借りしました。ありがとうございました。 --> I gratefully appreciate to NEC corporation (NEC solutions) for lending me devices when I wrote the section on MTX. <!--O <sect1>フィードバック --> <sect1>Feedback <p> <!--O 質問・コメント・訂正などこの文書に関するご意見は: <verb> FUKUSHIMA Osamu <fuku@amorph.rim.or.jp> </verb> までお願いします。 --> Please send any questions, comments, or corrections to <verb> FUKUSHIMA Osamu <fuku@amorph.rim.or.jp>. </verb> <!--O <sect1>履歴 --> <sect1>History <p> <!--O <verb> 1998年 4月20日 初版発行 (Revision 1.3) 1998年 6月 3日 デバイスファイルの permission に関する記述を追加。 Leonard N. Zubkoff 氏 (lnz@dandelion.com) が作成・配布 している MTX に関する記述を追加。 1998年11月15日 テープドライブ全般に関する情報へのポインタを追加。 1998年12月12日 dump-0.3 が kernel 2.0.x で使えることを明記。 1999年 2月28日 e2compr 使用時の制限に関する記述を追加。 1999年 3月10日 第2版発行 (Revision 1.4) 1999年 5月23日 rmt が実行PATHに含まれていない場合に関する記述を追加。 1999年 7月30日 restore の際の注意点を追加。 1999年11月30日 Stelian Pop 氏による新しい 0.4 beta シリーズに関して記載。 2000年 1月21日 0.4 beta 公開サイト名の変更。 2000年 8月 1日 MTX に関する章を追加. </verb> --> <verb> 1998/04/20: first release (revision 1.3). 1998/06/03: add a section on the permissions of device files. notes on MTX added. 1998/11/15: add some pointers to the information about tape drives. 1998/12/12: make clear that dump-0.3 could be run in kernel 2.0.x. 1999/02/28: mention the limitation of e2compr. 1999/03/10: second release (revision 1.4). 1999/05/23: add tips for the case where rmt command path is not in PATH. 1999/07/30: add cautions on system restoration. 1999/11/30: mention new 0.4 beta series by Stelian Pop. 2000/01/21: change the pointer to 0.4 beta 2000/08/01: add a section on MTX. </verb> <sect1>English version <p> English version of this document has been translated by the following JF Project members. Please contact jf@linux.or.jp if you have comments and/or suggestions about this document. <itemize> <item>Hitoshi Hayakawa <item>Seiji Kaneko <item>Takeo Nakano <item>Taketoshi Sano <item>Yuji Senda <item>Yoshiyuki Yamashita <item>Y.Hiro Yamazaki </itemize> </article>