Solaris のシステム管理 (デバイスとファイルシステム)

UFS ファイルシステムのバックアップ

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

ProcedureUFS ファイルシステムのバックアップをテープに作成する方法

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

  1. スーパーユーザーになるか、同等の役割を引き受けます。

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

    次に例を示します。


    # shutdown -g30 -y
    
  3. (省略可能) ファイルシステムの整合性を検査します。

    次に例を示します。


    # fsck -m /dev/rdsk/c0t0d0s7
    

    fsck -m コマンドを実行すると、ファイルシステムの整合性が検査されます。たとえば、電源障害が発生すると、ファイルが不整合になることがあります。fsck コマンドの詳細は、第 21 章UFS ファイルシステムの整合性検査 (手順)を参照してください。

  4. ファイルシステムをリモートテープドライブにバックアップする場合は、次の手順を実行します。

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


      host root

      host エントリには、ufsdump コマンドを実行してバックアップを行うシステムの名前を指定します。

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

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

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

  6. 書き込み可能なテープをテープドライブに挿入します。

  7. システムのバックアップを実行します。


    # ufsdump options arguments filenames
    

    ファイルシステムやディレクトリ、またはファイルシステム内のファイルをバックアップできます。ファイルを個別にバックアップする方法については、tar(1) または cpio(1) のマニュアルページを参照してください。

    次の例では、もっとも一般的な ufsdump オプションおよび引数の使用方法を示します。

    その他の ufsdump オプションおよび引数については、第 27 章UFS バックアップおよび復元コマンド (参照情報)を参照してください。

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

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

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

  11. バックアップが正常に実行されたことを確認します。


    # ufsrestore tf device-name
    

例 24–3 UFS ルート (/) ファイルシステムの完全バックアップの実行

次の例では、ルート (/) ファイルシステムの完全バックアップを実行する方法を示します。この例では、バックアップの実行前にシステムをシングルユーザーモードにしています。次の ufsdump オプションが含まれます。

次に例を示します。


# init 0
ok boot -s
.
.
.
# ufsdump 0ucf /dev/rmt/0 /
  DUMP: Date of this level 0 dump: Mon Jul 12 10:00:50 2010
  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: Writing 63 Kilobyte records
  DUMP: Estimated 1843276 blocks (900.04MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: 1843252 blocks (900.03MB) on 1 volume at 6602 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Mon Jul 12 10:22:50 MDT 2010
# ufsrestore tf /dev/rmt/0
         2      .
         3      ./lost+found
         4      ./usr
         5      ./var
         6      ./export
         7      ./bin
         8      ./dev
.
.
.
# (Press Control-D to bring system to run level 3)


例 24–4 UFS ルート (/) ファイルシステムの増分バックアップの実行

次の例は、ルート (/) ファイルシステムのシングルユーザーモードでの増分バックアップの方法を示します。次の ufsdump オプションが含まれます。


# init 0
ok boot -s
# ufsdump 9ucf /dev/rmt/0 /
  DUMP: Date of this level 9 dump: Mon Jul 12 10:52:50 2010
  DUMP: Date of last level 0 dump: Mon Jul 12 10:50:50 2010
  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: Writing 63 Kilobyte records
  DUMP: Estimated 422 blocks (211KB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: 376 blocks (188KB) on 1 volume at 1843 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 9 dump on Mon Jul 12 10:55:50 2010
# ufsrestore tf /dev/rmt/0
         2      .
         9      ./etc
       304      ./etc/dumpdates
      1117      ./devices
      1118      ./devices/pseudo
      3381      ./devices/pseudo/pts@0:1
.
.
.

# init 0
ok boot -s
# ufsdump 9ucf /dev/rmt/0 /
  DUMP: Date of this level 9 dump: Mon Jul 12 10:33:14 2010
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c2t1d0s0 (v880-brm-03:/root) to /dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Writing 63 Kilobyte records
  DUMP: Estimated 120694 blocks (58.93MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: 120580 blocks (58.88MB) on 1 volume at 9026 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 9 dump on Mon Jul 12 10:33:14 2010
# ufsrestore tf /dev/rmt/0
         2      .
         9      ./etc
       304      ./etc/dumpdates
      1117      ./devices
      1118      ./devices/pseudo
      3381      ./devices/pseudo/pts@0:1
.
.
.


例 24–5 UFS ホームディレクトリの完全バックアップ

次の例では、/export/home/kryten ホームディレクトリの完全バックアップを実行する方法を示します。次の ufsdump オプションが含まれます。


# ufsdump 0ucf /dev/rmt/0 /export/home/kryten
  DUMP: Date of this level 0 dump: Wed Jul 10:35:18 2010
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t0d0s7 (starbug:/export/home) to /dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Writing 63 Kilobyte records
  DUMP: Estimated 105158 blocks (51.35MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: 105082 blocks (51.31MB) on 1 volume at 5025 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 9 dump on Mon Jul 12 10:38:14 2010
# ufsrestore tf /dev/rmt/0
       232      ./kryten
       233      ./kryten/filea
       234      ./kryten/fileb
       235      ./kryten/filec
       236      ./kryten/letters
       237      ./kryten/letters/letter1
       238      ./kryten/letters/letter2
       239      ./kryten/letters/letter3
       240      ./kryten/reports
       241      ./kryten/reports/reportA
       242      ./kryten/reports/reportB
       243      ./kryten/reports/reportC


例 24–6 リモートシステムへの完全バックアップの実行 (Solaris 10 データを Solaris 10 システムへ)

次の例は、Solaris 10 システム (mars) 上のローカルの /export/home ファイルシステムをリモートの Solaris 10 システム (earth) へ、シングルユーザーモードで完全バックアップする方法を示します。リモートアクセスが有効になるようにシステムを設定する必要があります。次の ufsdump オプションが含まれます。


# ufsdump 0ucf earth:/dev/rmt/0 /export/home
  DUMP: Date of this level 0 dump: Mon Jul 12 10:36:30 MDT 2010
  DUMP: Date of last level 0 dump: the epoch
  DUMP: Dumping /dev/rdsk/c0t0d0s7 (mars:/export/home) to earth:/dev/rmt/0.
  DUMP: Mapping (Pass I) [regular files]
  DUMP: Mapping (Pass II) [directories]
  DUMP: Writing 63 Kilobyte records
  DUMP: Estimated 105172 blocks (51.35MB).
  DUMP: Dumping (Pass III) [directories]
  DUMP: Dumping (Pass IV) [regular files]
  DUMP: 105082 blocks (51.31MB) on 1 volume at 4425 KB/sec
  DUMP: DUMP IS DONE
  DUMP: Level 0 dump on Mon Jul 12 10:39:30 MDT 2010
# ufsrestore tf earth:/dev/rmt/0
         2      .
         3      ./lost+found
         4      ./kryten
         5      ./kryten/filea
         6      ./kryten/fileb
         7      ./kryten/filec
         8      ./kryten/letters
         9      ./kryten/letters/letter1
        10      ./kryten/letters/letter2
        11      ./kryten/letters/letter3
        12      ./kryten/reports
.
.
.