[[FrontPage]]

[[HDD管理 sysutils/smartmontools]]

[[ZFS FreeBSD 9.0]]
----
#counter([total|today|yesterday]);
&lastmod;
#contents
----
*zfsなpool(tank)を/usr/homeにする [#taf6dc09]
ada0 に、完結した?システムが出来ているので、残りの ada1 ada2 ada3 上にpoolを作って /usr/home にしましょう
**現状 [#s4033362]
 g7# df -h
 Filesystem          Size    Used   Avail Capacity  Mounted on
 zfspool/root        220G    6.5G    213G     3%    /
 devfs               1.0k    1.0k      0B   100%    /dev
 tank                456G     40k    456G     0%    /tank
 zfspool/root/tmp    213G     62k    213G     0%    /tmp
 zfspool/root/var    214G    222M    213G     0%    /var
 devfs               1.0k    1.0k      0B   100%    /var/named/dev

**tankを壊します [#a016b1c4]
 g7# zpool destroy tank

 g7# zpool status
   pool: zfspool
  state: ONLINE
  scan: none requested
 config:
 
         NAME        STATE     READ WRITE CKSUM
         zfspool     ONLINE       0     0     0
           ada0p3    ONLINE       0     0     0
 
 errors: No known data errors
**tankを作る [#v98d5025]
 g7# zpool create tank raidz1 ada1 ada2 ada3

 g7# df -h
 Filesystem          Size    Used   Avail Capacity  Mounted on
 zfspool/root        220G    6.5G    213G     3%    /
 devfs               1.0k    1.0k      0B   100%    /dev
 zfspool/root/tmp    213G     62k    213G     0%    /tmp
 zfspool/root/var    214G    222M    213G     0%    /var
 devfs               1.0k    1.0k      0B   100%    /var/named/dev
 tank                456G     40k    456G     0%    /tank

 g7# zpool status
   pool: tank
  state: ONLINE
  scan: none requested
 config:
 
         NAME        STATE     READ WRITE CKSUM
         tank        ONLINE       0     0     0
           raidz1-0  ONLINE       0     0     0
             ada1    ONLINE       0     0     0
             ada2    ONLINE       0     0     0
             ada3    ONLINE       0     0     0
 
 errors: No known data errors
 
   pool: zfspool
  state: ONLINE
  scan: none requested
 config:
 
         NAME        STATE     READ WRITE CKSUM
         zfspool     ONLINE       0     0     0
           ada0p3    ONLINE       0     0     0
 
 errors: No known data errors
**tankのマウントポイントをセット [#if159b8a]
 g7# zfs set mountpoint=/boot/zfs/zroot/usr/home tank

 g7# df
 Filesystem       1K-blocks    Used     Avail Capacity  Mounted on
 zfspool/root     230971140 6826610 224144530     3%    /
 devfs                    1       1         0   100%    /dev
 zfspool/root/tmp 224144592      62 224144530     0%    /tmp
 zfspool/root/var 224372129  227599 224144530     0%    /var
 devfs                    1       1         0   100%    /var/named/dev
 tank             478469286      40 478469246     0%    /boot/zfs/zroot/usr/home
**シンボリックリンクを張る [#w5e51bf4]
 g7# cd /boot/zfs/zroot; ln -s usr/home home
 g7# cd /boot/zfs/zroot
   # ln -s usr/home home

 g7# df -h
 Filesystem          Size    Used   Avail Capacity  Mounted on
 zfspool/root        220G    6.5G    213G     3%    /
 devfs               1.0k    1.0k      0B   100%    /dev
 zfspool/root/tmp    213G     62k    213G     0%    /tmp
 zfspool/root/var    214G    222M    213G     0%    /var
 devfs               1.0k    1.0k      0B   100%    /var/named/dev
 tank                456G     40k    456G     0%    /boot/zfs/zroot/usr/home
**tankのエクスポート・インポートをする [#acb26db7]
 g7# cd /boot/zfs
 g7# zpool export tank
 g7# zpool import tank

 g7# df -h
 Filesystem          Size    Used   Avail Capacity  Mounted on
 zfspool/root        220G    6.5G    213G     3%    /
 devfs               1.0k    1.0k      0B   100%    /dev
 zfspool/root/tmp    213G     62k    213G     0%    /tmp
 zfspool/root/var    214G    222M    213G     0%    /var
 devfs               1.0k    1.0k      0B   100%    /var/named/dev
 tank                456G     40k    456G     0%    /boot/zfs/zroot/usr/home
http://docs.oracle.com/cd/E37932_01/html/E36656/gbchy.html


**tankのマウントポイントをセットする [#gdfc26c5]
 g7# zfs set mountpoint=/usr/home tank

 g7# df -h
 Filesystem          Size    Used   Avail Capacity  Mounted on
 zfspool/root        220G    6.5G    213G     3%    /
 devfs               1.0k    1.0k      0B   100%    /dev
 zfspool/root/tmp    213G     62k    213G     0%    /tmp
 zfspool/root/var    214G    222M    213G     0%    /var
 devfs               1.0k    1.0k      0B   100%    /var/named/dev
 tank                456G     40k    456G     0%    /usr/home

**ファイルシステム上のリンクを張る [#k3c31822]
 g7# ln -s /usr/home/ /home

 g7# df -h
 Filesystem          Size    Used   Avail Capacity  Mounted on
 zfspool/root        220G    6.5G    213G     3%    /
 devfs               1.0k    1.0k      0B   100%    /dev
 zfspool/root/tmp    213G     62k    213G     0%    /tmp
 zfspool/root/var    214G    222M    213G     0%    /var
 devfs               1.0k    1.0k      0B   100%    /var/named/dev
 tank                456G     40k    456G     0%    /usr/home
出来上がり( ´▽`)ノ
----
**Blackhome(バックアップサーバ)からデータ書き戻し [#h92eb80e]
 blackcube# /usr/local/bin/rsync -av blackhole.smb.net:/usr/Backups/Blackcube_G7/usr/home /usr/


   126  15:06   zpool destroy -f tank
   127  15:06   zpool create tank raidz1 ada1 ada2 ada3
   128  15:06   zpool status
   129  15:06   df -h
   130  15:07   zfs set mountpoint=/boot/zfs/zroot/usr/home tank
   131  15:07   cd /boot/zfs/zroot ; ln -s usr/home home
   132  15:07   cd /boot/zfs
   133  15:07   zpool export tank
   134  15:07   zpool import tank
   135  15:07   zfs set mountpoint=/usr/home tank
   136  15:08   ln -s /usr/home/ /home
   137  15:08   df -h
   138  15:08   /usr/local/bin/rsync -av blackhole.smb.net:/usr/Backups/Blackcube_G7/usr/home /usr/
   139  15:27   apachectl start
   140  15:27   history

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS