この章では、ufsdump コマンドを使用してファイルシステムのバックアップを行う手順について説明します。
この章の内容は以下のとおりです。
ufsdump コマンドの構文、オプション、引数についての詳細は、第 36 章「ufsdump コマンドと ufsrestore コマンドの参照情報」を参照してください。
ファイルシステムのバックアップを実行する準備は、計画の作成から始まります。詳細については、第 33 章「ファイルシステムのバックアップと復元の概要」を参照してください。この段階では、次の項目を決定します。
テープドライブ
バックアップを作成するファイルシステム
バックアップのタイプ (完全または増分)
バックアップのスケジュール
この節では、次のように、ファイルシステムのバックアップを作成する前に実行しておかなければならない作業について説明します。
バックアップを作成するファイルシステムの名前を検索する。
完全バックアップをとるために必要なテープの本数を決定する。
/etc/vfstab ファイルの内容を表示します。
$ more /etc/vfstab |
mount point カラムに表示されるファイルシステム名を調べます。
ファイルシステムをバックアップするときには、mount point カラムのマウントポイントを使用することになります。
$ more /etc/vfstab #device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /proc - /proc proc - no - swap - /tmp tmpfs - yes - /dev/dsk/c0t3d0s0 /dev/rdsk/c0t3d0s0 / ufs 1 no - /dev/dsk/c0t3d0s1 - - swap - no - /dev/dsk/c0t1d0s6 /dev/rdsk/c0t1d0s6 /usr ufs 2 no - mars:/share/kit - /kit nfs - yes - mars:/db/doc - /db/doc nfs - yes - |
スーパーユーザーになります。
usfdump S コマンドを使用して、バックアップのサイズをバイト単位で見積もります。
# ufsdump S filesystem |
|
S |
バックアップの実行に必要な予想バイト数を表示する。 |
予想バイト数をテープの容量で除算して、必要な本数を調べます。
テープの容量リストについては、表 33-2 を参照してください。
次の例では、150M バイトのテープに 489472 バイトのファイルシステムが入ります。
# ufsdump S /export/home 489472 |
バックアップを実行する際の一般的なガイドラインは次のとおりです。
シングルユーザーモードを使用するか、ファイルシステムをマウント解除する。
ディレクトリレベルの処理 (ファイルの作成、削除、名前変更など) とファイルレベルの処理が行われているときにファイルシステムのバックアップを実行すると、バックアップに組み込まれないデータがあるので注意する。
1 台のシステムから ufsdump コマンドを実行し、リモートシェルまたはリモートログインを通じてネットワーク上のシステムグループのバックアップを実行し、その出力をテープドライブがあるシステムに転送できる (通常、テープドライブは ufsdump コマンドを実行するシステム上にあるが、他の場所にあってもかまわない)。
ファイルのバックアップをリモートドライブに作成するには、ufsdump コマンドの出力を dd コマンドにパイプする方法もある。dd コマンドの使用方法については、第 37 章「UFS ファイルとファイルシステムのコピー手順」を参照。
ネットワーク上でリモートバックアップを実行する場合、テープドライブを持つシステムの /.rhosts ファイル中には、ドライブを使用する各クライアントのエントリが入っていなければならない。また、バックアップを実行する各システムの /.rhosts ファイルには、バックアップを開始するシステムのエントリが入っていなければならない。
システム上でリモートドライブを指定するには、リモートテープドライブを持つシステムの OS バージョンと一致する命名規則を使用する。たとえば、SunOS 4.1.1 またはその互換バージョンを実行しているシステム上のリモートドライブには /dev/rst0 を使用し、Solaris 7 またはその互換バージョンを実行しているシステムには /dev/rmt/0 を使用する。
Solaris 2.5 およびその互換バージョンが動作している NIS+ マスターサーバーをバックアップするためには nisbackup コマンドを使用して下さい。このコマンドを使用する方法については、『Solaris ネーミングの管理』を参照してください。
ufsdump コマンドを使用してファイルシステムのバックアップを作成する一般的な手順を次に示します。この例では、オプションと引数の使用方法を示しています。
スーパーユーザーになります。
システムをレベル S (シングルユーザーモード) に移行します。
# shutdown -g30 -y |
[省略可能] fsck コマンドを指定してファイルシステムの整合性をチェックします。
-m オプションを使用して fsck コマンドを実行すると、ファイルシステムの整合性がチェックされます。たとえば、電源障害が発生すると、ファイルが非整合状態になることがあります。fsck コマンドについての詳細は、第 31 章「ファイルシステムの整合性チェック」を参照してください。
# fsck -m /dev/rdsk/ device-name |
ファイルシステムをリモートテープドライブにバックアップする場合
テープドライブのデバイス名を確認します。
デフォルトのテープドライブは、/dev/rmt/0 です。
書き込み保護されていないテープをテープドライブに挿入します。
ufsdump コマンドを使用してファイルシステムのバックアップを作成します。
次の表を参照して、ufsdump コマンドの最も一般的なオプションと引数を選択します。その他のオプションと引数については、第 36 章「ufsdump コマンドと ufsrestore コマンドの参照情報」を参照してください。
|
操作 |
使用するオプションまたは引数 |
例 |
参照先 |
|---|---|---|---|
|
完全バックアップを実行する |
0 オプション |
ufsdump 0ucf /dev/rmt/0 / | |
|
増分バックアップを実行する |
1 から 9 までのオプション |
ufsdump 9ucf /dev/rmt/0/ | |
|
個々のファイルのバックアップを実行する |
ファイルまたはディレクトリを指定する |
ufsdump ucf /dev/rmt/0 /export/home/kryten | |
|
ダンプを /etc/dumpdates ファイルに記録する |
-u オプション |
ufsdump 9ucf /dev/rmt/ 0 /export/home | |
|
カートリッジテープを指定する |
-c オプション |
ufsdump 9ucf /dev/rmt/0 /export/home | |
|
テープドライブを指定する |
-f dump-file |
ufsdump 9ucf /dev/rmt/0 /export/home | |
|
ローカルファイルシステムをリモートホストのテープデバイスにバックアップする |
remote-system:dump-file |
ufsdump 0ucf pluto:/dev/rmt/0 /export/home |
「例 - リモートシステムへの完全バックアップ (Solaris 2.6 のデータを Solaris 7 システムへ)」 |
プロンプトが表示されたら、テープを取り出して次のテープと交換します。
各テープにボリューム番号、レベル、日付、システム名、ディスクスライス、ファイルシステム名を記入したラベルを貼ります。
Control-d キーを押してシステムをレベル 3 の動作に戻します。
ufsrestore コマンドでテープの内容を表示して、バックアップが正常に実行されたことを確認します。
このコマンドについては、第 35 章「ファイルとファイルシステムの復元の手順」で説明します。
次の例では、ルート (/) ファイルシステムの完全バックアップを QIC-150 テープ (/dev/rmt/0) 上に作成します。
# shutdown -g30 -y
# ufsdump 0ucf /dev/rmt/0 /
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Wed Nov 06 15:32:21 1996
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t3d0s0 (mars:/) to /dev/rmt/0.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 41236 blocks (20.13MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 41200 blocks (20.12MB) on 1 volume at 95 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Wed Nov 06 15:32:21 1996
# ufsrestore tf /dev/rmt/0
2 .
3 ./lost+found
5696 ./usr
11392 ./export
17088 ./opt
22784 ./var
28480 ./var/sadm
34176 ./var/sadm/install
39872 ./var/sadm/install/admin
39879 ./var/sadm/install/admin/default
.
.
.
#
|
この例では、ルート (/) ファイルシステムの増分バックアップを 4 mm の DAT テープデバイスに作成します。
# ufsdump 9ucf /dev/rmt/0 /
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 9 dump: Tue Jun 09 11:04:41 1998
DUMP: Date of last level 0 dump: Tue Jun 09 10:14:54 1998
DUMP: Dumping /dev/rdsk/c0t3d0s0 (pluto:/) 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: Mapping (Pass II) [directories]
DUMP: Estimated 1502 blocks (751KB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 1384 blocks (692KB) on 1 volume at 51 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 9 dump on Tue Jun 09 11:04:41 1998
# ufsrestore tf /dev/rmt/0
39872 ./var
62671 ./var/adm
39915 ./var/adm/sa
40018 ./var/adm/sa/sa09
62810 ./var/adm/sulog
62888 ./var/adm/pacct
91154 ./var/cron
91311 ./var/cron/log
5716 ./var/mail
5835 ./var/mail/adm
45585 ./var/spool
51388 ./var/spool/mqueue
91155 ./var/tmp
.
.
.
|
この例では、/export/home/kryten ディレクトリの完全バックアップを 4 mm DAT テープに作成します。
# ufsdump 0ucf /dev/rmt/0 /export/home/kryten
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Tue Jun 09 11:12:44 1998
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 2.6 システム上のローカルの /export/home ファイルシステムを、リモートの Solaris 7 システム pluto 上のテープデバイスに完全バックアップします。
# ufsdump 0ucf pluto:/dev/rmt/0 /export/home
# ufsdump 0ucf pluto:/dev/rmt/0 /export/home
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Tue Jun 09 13:54:27 1998
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t3d0s7 (venus:/export/home) to pluto:/dev/rmt/0.
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 38310 blocks (18.71MB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 38302 blocks (18.70MB) on 1 volume at 98 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Tue Jun 09 13:54:27 1998
# # ufsrestore tf pluto:/dev/rmt/0
2 .
3 ./lost+found
34180 ./kryten
34182 ./kryten/.login
34183 ./kryten/.cshrc
51266 ./kryten/letters
51272 ./kryten/letters/letter1
51273 ./kryten/letters/letter2
51274 ./kryten/letters/letter3
57032 ./kryten/memos
74095 ./kryten/reports
74096 ./kryten/reports/reportA
74097 ./kryten/reports/reportB
74098 ./kryten/reports/reportC
.
.
.
#
|
次の例では、Solaris 7 システム上のローカルの /export/home ファイルシステムを、リモートの SunOS 4.1.3 システム mars 上のテープデバイスに完全バックアップします。
ufsdump コマンドといっしょに SunOS 4.0/4.1 用のデバイス名 (/dev/rst0) が使用されているので注意してください。
# ufsdump 0ucf mars:/dev/rst0 /export/home
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Fri Oct 24 15:06:47 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t3d0s7 (earth:/export/home) to (mars:/dev/rst0).
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 19574 blocks (9.56MB)
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: level 0 dump on Fri Oct 24 15:06:47 1997
DUMP: Tape rewinding
DUMP: 19574 blocks (9.56MB) on 1 volume
DUMP: DUMP IS DONE
#
ufsrestore tf mars:/dev/rst0
2 .
3 ./lost+found
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
.
.
.
#
|
次の例では、Sun 4.1.3 システム mars 上のローカルのルート (/) ファイルシステムを、Solaris 7 システム pluto 上のリモートテープデバイスに完全バックアップします。
SunOS 4.1.3 およびその互換バージョンのシステム上のデータをバックアップするときには、ufsdump コマンドではなく dump コマンドを使用しなければならないことに注意してください。
# dump 0ucf pluto:/dev/rmt/0 /
DUMP: Date of this level 0 dump: Tue Oct 21 16:05:19 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rsd2a (/) to /dev/rmt/0 on host pluto
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 8686 blocks (4.24MB) on 0.10 tape(s).
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: level 0 dump on Tue Oct 21 16:05:19 1997
DUMP: Tape rewinding
DUMP: 8690 blocks (4.24MB) on 1 volume
DUMP: DUMP IS DONE
# restore tf pluto:/dev/rmt/0
2 .
3 ./lost+found
3776 ./export
7552 ./home
11328 ./usr
15104 ./pcfs
3777 ./tftpboot
3778 ./tftpboot/tftpboot
3794 ./tftpboot/boot.sun4c.sunos.4.1.3
7553 ./etc
7554 ./etc/sendmail.cf
7555 ./etc/aliases
7556 ./etc/aliases.dir
7557 ./etc/aliases.pag
7558 ./etc/holidays
7559 ./etc/dumpdates
.
.
.
#
|