Solaris のシステム管理 (第 1 巻)

バックアップの実行

バックアップを実行する際の一般的なガイドラインは次のとおりです。


注 -

Solaris 2.5 およびその互換バージョンが動作している NIS+ マスターサーバーをバックアップするには、nisbackup コマンドを使用して下さい。このコマンドを使用する方法については、『Solaris ネーミングの管理』を参照してください。


テープにバックアップをとる方法

ufsdump コマンドを使用してファイルシステムのバックアップを作成する一般的な手順を示します。この例では、オプションと引数の使用方法を示しています。

  1. スーパーユーザーになります。

  2. システムをレベル S (シングルユーザーモード) に移行します。


    # shutdown -g30 -y
    
  3. [省略可能] fsck コマンドを指定してファイルシステムの整合性をチェックします。

    -m オプションを使用して fsck コマンドを実行すると、ファイルシステムの整合性がチェックされます。たとえば、電源障害が発生すると、ファイルが非整合状態になることがあります。fsck コマンドについての詳細は、第 39 章「ファイルシステムの整合性チェック」を参照してください。


    # fsck -m /dev/rdsk/ device-name
    
  4. ファイルシステムをリモートテープドライブにバックアップする場合

    1. テープドライブが接続されているシステム (テープサーバー) の ./rhosts ファイルに、次のエントリを追加します。

         
      host root

      host

      ufsdump を使用してバックアップを実行するシステムの名前

    2. テープサーバー上で、上記の /.rhosts ファイルに追加したホストに、ネームサービス経由でアクセスできることを確認します。

  5. テープドライブのデバイス名を確認します。

    デフォルトのテープドライブは、/dev/rmt/0 です。

  6. 書き込み保護されていないテープをテープドライブに挿入します。

  7. ufsdump コマンドを使用してファイルシステムのバックアップを作成します。

    次の表を参照して、ufsdump コマンドの最も一般的なオプションと引数を選択します。その他のオプションと引数については、第 45 章「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 8 のデータを Solaris 8 システムへ)」

  8. プロンプトが表示されたら、テープを取り出して次のテープと交換します。

  9. 各テープにボリューム番号、レベル、日付、システム名、ディスクスライス、ファイルシステム名を記入したラベルを貼ります。

  10. Control-d キーを押してシステムをレベル 3 の動作に戻します。

  11. ufsrestore コマンドでテープの内容を表示して、バックアップが正常に実行されたことを確認します。

    このコマンドについては、第 44 章「ファイルとファイルシステムの復元 (手順)」で説明します。

例 - 完全バックアップ、ルート (/)

次の例では、ルート (/) ファイルシステムの完全バックアップを 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: Tue Jul 13 10:46:09 1999
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t0d0s0 (starbug:/) to /dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 71058 blocks (34.70MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 70936 blocks (34.64MB) on 1 volume at 64 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Tue Jul 13 10:46:09 1999
  # 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
                .
                .
                .
  # (Press Control-d to bring system to run level 3)

例 - 増分バックアップ、ルート (/)

この例では、ルート (/) ファイルシステムの増分バックアップを 4 mm DAT テープ (/dev/rmt/0) に作成します。


# ufsdump 9ucf /dev/rmt/0 /
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 9 dump: Tue Jul 13 10:58:12 1999
  DUMP: Date of last level 0 dump: Tue Jul 13 10:46:09 1999
  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 Tue Jul 13 10:58:12 1999
# 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 ディレクトリの完全バックアップを 4 mm DAT テープに作成します。


# ufsdump 0ucf /dev/rmt/0 /export/home/kryten
  DUMP: Writing 63 Kilobyte records
  DUMP: Date of this level 0 dump: Tue Jul 13 11:30:45 1999
  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 8 のデータを Solaris 8 システムへ)

次の例では、Solaris 8 システム上のローカルの /export/home ファイルシステムを、リモートの Solaris 8 システム starbug 上のテープデバイスに完全バックアップします。


# ufsdump 0ucf starbug:/dev/rmt/0 /export/home
DUMP: Writing 63 Kilobyte records
DUMP: Date of this level 0 dump: Tue Jul 13 13:14:40 1999
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rdsk/c0t3d0s7 (mars:/export/home) to starbug:/dev/rmt/0
DUMP: Mapping (Pass I) [regular files]
DUMP: Mapping (Pass II) [directories]
DUMP: Estimated 476 blocks (238KB).
DUMP: Dumping (Pass III) [directories]
DUMP: Dumping (Pass IV) [regular files]
DUMP: Tape rewinding
DUMP: 376 blocks (188KB) on 1 volume at 21 KB/sec
DUMP: DUMP IS DONE
DUMP: Level 0 dump on Tue Jul 13 13:14:40 1999
 # ufsrestore tf starbug:/dev/rmt/0
         2      .
         3      ./lost+found
      3776      ./kryten
      3777      ./kryten/.cshrc
      3778      ./kryten/.login
      3779      ./kryten/b
      3780      ./kryten/memos
      7552      ./kryten/letters
      7553      ./kryten/letters/b
      7554      ./kryten/letters/letter1
      7555      ./kryten/letters/letter2
      7556      ./kryten/letters/letter3
     11328      ./kryten/reports
     11329      ./kryten/reports/reportA
     11330      ./kryten/reports/reportB
     11331      ./kryten/reports/reportC
                .
                .
                .
#

例 - リモートシステムへの完全バックアップ (Solaris 8 のデータを Sun 4.1.4 システムへ)

次の例では、Solaris 8 システム上のローカルの /export/home ファイルシステムを、リモートの SunOS 4.1.4 システム 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: Thu Jul 15 09:13:01 1999
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t0d0s7 (starbug:/export/home) to mars:/dev/rst0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Estimated 5690 blocks (2.78MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: Tape rewinding
  DUMP: 5542 blocks (2.71MB) on 1 volume at 77 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Thu Jul 15 09:13:01 1999
# 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
                .
                .
                .
#

例 - リモートシステムへの完全バックアップ (SunOS 4.1.4 のデータを Solaris 8 システムへ)

次の例では、Sun 4.1.4 システム mars 上のローカルのルート (/) ファイルシステムを、Solaris 8 システム starbug 上のリモートテープデバイスに完全バックアップします。


注 -

SunOS 4.1.4 およびその互換バージョンのシステム上のデータをバックアップするときには、ufsdump コマンドではなく dump コマンドを使用しなければなりません。



# dump 0ucf starbug:/dev/rmt/0 /
  DUMP: Date of this level 0 dump: Wed Jul  7 06:19:33 1999   
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rsd0a (/) to /dev/rmt/0 on host starbug
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 123706 blocks (60.40MB) on 1.41 tape(s).
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: level 0 dump on Wed Jul  7 06:19:33 1999
  DUMP: Tape rewinding
  DUMP: 123680 blocks (60.39MB) on 2 volumes
  DUMP: DUMP IS DONE
# restore tf starbug:/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.4
      7553      ./etc
      7554      ./etc/sendmail.cf
      7555      ./etc/aliases
      7556      ./etc/aliases.dir
      7557      ./etc/aliases.pag
      7558      ./etc/holidays
      7559      ./etc/dumpdates
                .
                .
                .
#