バックアップを実行する際の一般的なガイドラインは次のとおりです。
シングルユーザーモードを使用するか、ファイルシステムをマウント解除する (ファイルシステムのスナップショットを作成している場合を除く)。UFS スナップショットの詳細は、第 48 章「UFS スナップショットの使用 (手順)」を参照。
ディレクトリレベルの処理 (ファイルの作成、削除、名前変更など) とファイルレベルの処理が行われているときにファイルシステムのバックアップを実行すると、バックアップに組み込まれないデータがあるので注意する。
単一のシステムで ufsdump コマンドを実行し、リモートシェルまたはリモートログインを通じてネットワーク上のシステムグループのバックアップを実行して、出力をテープドライブがあるシステムに転送できる。通常、テープドライブは ufsdump コマンドを実行するシステム上にあるが、他の場所にあってもかまわない。
ファイルのバックアップをリモートドライブに作成するには、ufsdump コマンドの出力を dd コマンドにパイプする方法もある。dd コマンドの使用方法については、第 51 章「UFS ファイルとファイルシステムのコピー (手順)」を参照。
ネットワーク上でリモートバックアップを実行する場合、テープドライブを持つシステムの /.rhosts ファイル中には、ドライブを使用する各クライアントのエントリが入っていなければならない。また、バックアップを実行する各システムの /.rhosts ファイルには、バックアップを開始するシステムのエントリが入っていなければならない。
システム上でリモートテープデバイスを指定するには、リモートテープドライブを保持するシステムの OS バージョンと一致する命名規則を使用する。たとえば、SunOS 4.1.1 またはその互換バージョンが稼働中のシステム上のリモートドライブにはデバイス /dev/rst0 を使用する。また、Solaris 9 またはその互換バージョンを実行しているシステムでは、デバイス /dev/rmt/0 を使用する。
NIS+ マスターサーバーをバックアップする場合は、nisbackup コマンドを使用してください。このコマンドの使用方法については、『Solaris のシステム管理 (ネーミングとディレクトリサービス : FNS、NIS+ 編)』を参照してください。
ufsdump コマンドを使用してファイルシステムのバックアップを作成する一般的な手順を示します。この例では、オプションと引数の使用方法を示しています。
スーパーユーザーになるか、同等の役割を引き受けます。
システムをレベル S (シングルユーザーモード) に移行します。
# shutdown -g30 -y |
(省略可能) ファイルシステムの整合性をチェックします。
# fsck -m /dev/rdsk/device-name |
fsck -m コマンドを実行すると、ファイルシステムの整合性がチェックされます。たとえば、電源障害が発生すると、ファイルが非整合状態になることがあります。fsck コマンドについての詳細は、第 43 章「UFS ファイルシステムの整合性チェック (手順)」を参照してください。
ファイルシステムをリモートテープドライブにバックアップする場合
テープドライブのデバイス名を確認します。
デフォルトのテープドライブは、/dev/rmt/0 です。
書き込み保護をしていないテープをテープドライブに挿入します。
システムのバックアップを実行します。
# ufsdump options arguments filenames |
次の例では、最も一般的な ufsdump オプションおよび引数の使用方法を示します。
その他の ufsdump オプションと引数については、第 50 章「UFS バックアップおよび復元コマンド (参照情報)」を参照してください。
プロンプトが表示されたら、テープを取り出して、次のテープを挿入します。
各テープにボリューム番号、ダンプレベル、日付、システム名、ディスクスライス、ファイルシステム名を記入したラベルを貼ります。
Control+D キーを押してシステムをレベル 3 の動作に戻します。
バックアップが正常に実行されたことを確認します。
# ufsrestore tf device-name |
次の例では、ルート ( /) ファイルシステムの完全バックアップを実行する方法を示します。この例では、バックアップの実行前にシステムをシングルユーザーモードにしています。次の ufsdump オプションが含まれます。
0 は、レベル 0 のダンプ (フルバックアップ) であることを示す。
u は、このバックアップの実行日に /etc/dumpdates ファイルが更新されることを示す。
c は、カートリッジテープデバイスを示す。
f /dev/rmt/0 は、テープデバイスを示す。
/ はバックアップするファイルシステムを示す。
# shutdown -g30 -y # ufsdump 0ucf /dev/rmt/0 / DUMP: Writing 63 Kilobyte records DUMP: Date of this level 0 dump: Wed Sep 05 13:27:20 2001 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c0t1d0s0 (earth:/) to /dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Estimated 57150 blocks (27.91MB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: Tape rewinding DUMP: 57076 blocks (27.87MB) on 1 volume at 265 KB/sec DUMP: DUMP IS DONE DUMP: Level 0 dump on Wed Sep 05 13:27:20 2001 # ufsrestore tf /dev/rmt/0 2 . 3 ./lost+found 3776 ./usr 7552 ./var 11328 ./export 15104 ./export/home 18880 ./etc 22656 ./etc/default 22657 ./etc/default/sys-suspend 22673 ./etc/default/cron 22674 ./etc/default/devfsadm 22675 ./etc/default/dhcpagent 22676 ./etc/default/fs 22677 ./etc/default/inetinit 22678 ./etc/default/kbd 22679 ./etc/default/mpathd 22680 ./etc/default/nfslogd 22681 ./etc/default/passwd . . . # (Control+D を押して、システムをレベル 3 に戻す) |
次の例は、ルート (/) ファイルシステムの増分バックアップを実行する方法を示します。次の ufsdump オプションが含まれます。
9 は、レベル 9 のダンプ (増分バックアップ) であることを示す。
u は、このバックアップの実行日に /etc/dumpdates ファイルが更新されることを示す。
c は、カートリッジテープデバイスを示す。
f /dev/rmt/0 は、テープデバイスを示す。
/ はバックアップするファイルシステムを示す。
# ufsdump 9ucf /dev/rmt/0 / DUMP: Writing 63 Kilobyte records DUMP: Date of this level 9 dump: Fri Jul 13 10:58:12 2001 DUMP: Date of last level 0 dump: Fri Jul 13 10:46:09 2001 DUMP: Dumping /dev/rdsk/c0t0d0s0 (starbug:/) to /dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Mapping (Pass II) [directories] DUMP: Mapping (Pass II) [directories] DUMP: Mapping (Pass II) [directories] DUMP: Estimated 200 blocks (100KB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: Tape rewinding DUMP: 124 blocks (62KB) on 1 volume at 8 KB/sec DUMP: DUMP IS DONE DUMP: Level 9 dump on Fri Jul 13 10:58:12 2001 # ufsrestore tf /dev/rmt/0 2 . 3 ./lost+found 5696 ./usr 11392 ./var 17088 ./export 22784 ./export/home 28480 ./opt 5697 ./etc 11393 ./etc/default 11394 ./etc/default/sys-suspend 11429 ./etc/default/cron 11430 ./etc/default/devfsadm 11431 ./etc/default/dhcpagent 11432 ./etc/default/fs 11433 ./etc/default/inetinit 11434 ./etc/default/kbd 11435 ./etc/default/nfslogd 11436 ./etc/default/passwd 11437 ./etc/default/tar . . . |
次の例は、/export/home/kryten ディレクトリの完全バックアップを実行する方法を示します。次の ufsdump オプションが含まれます。
0 は、レベル 0 のダンプ (完全バックアップ) であることを示す。
u は、このバックアップの実行日に /etc/dumpdates ファイルが更新されることを示す。
c は、カートリッジテープデバイスを示す。
f /dev/rmt/0 は、テープデバイスを示す。
/export/home/kryten は、バックアップするディレクトリを示す。
# ufsdump 0ucf /dev/rmt/0 /export/home/kryten DUMP: Writing 63 Kilobyte records DUMP: Date of this level 0 dump: Fri Jul 13 11:30:45 2001 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c0t3d0s7 (pluto:/export/home) to /dev/rmt/0. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Estimated 232 blocks (116KB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: Tape rewinding DUMP: 124 blocks (62KB) on 1 volume at 8 KB/sec DUMP: DUMP IS DONE # ufsrestore tf /dev/rmt/0 2 . 2688 ./kryten 5409 ./kryten/letters 5410 ./kryten/letters/letter1 5411 ./kryten/letters/letter2 5412 ./kryten/letters/letter3 2689 ./kryten/.profile 8096 ./kryten/memos 30 ./kryten/reports 31 ./kryten/reports/reportA 32 ./kryten/reports/reportB 33 ./kryten/reports/reportC # |
次の例では、Solaris 9 システム (starbug) のローカルの /export/home ファイルシステムを、リモートの Solaris 9 システム (earth) のテープデバイスに完全バックアップする方法を示します。次の ufsdump オプションが含まれます。
0 は、レベル 0 のダンプ (完全バックアップ) であることを示す。
u は、このバックアップの実行日に /etc/dumpdates ファイルが更新されることを示す。
c は、カートリッジテープデバイスを示す。
f earth:/dev/rmt/0 は、リモートシステム名およびテープデバイスを示す。
/export/home は、バックアップ対象のファイルシステムを示す。
# ufsdump 0ucf earth:/dev/rmt/0 /export/home DUMP: Writing 63 Kilobyte records DUMP: Date of this level 0 dump: Wed Sep 05 14:52:31 2001 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c0t0d0s7 (starbug:/export/home) to earth:/dev ... DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Estimated 266 blocks (133KB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: Tape rewinding DUMP: 250 blocks (125KB) on 1 volume at 247 KB/sec DUMP: DUMP IS DONE DUMP: Level 0 dump on Wed Sep 05 14:52:31 2001 # ufsrestore tf earth:/dev/rmt/0 2 . 3 ./lost+found 7168 ./rimmer 7169 ./rimmer/.profile 21504 ./rimmer/scdir 21505 ./rimmer/scdir/scd557 21506 ./rimmer/scdir/scd772 10752 ./lister 10753 ./lister/.profile 10754 ./lister/filea 10755 ./lister/fileb 10756 ./lister/filec 14336 ./pmorph 14337 ./pmorph/.profile 3584 ./pmorph/bigdir 3585 ./pmorph/bigdir/bigfile 17920 ./pmorph/smalldir 17921 ./pmorph/smalldir/smallfile # |