Ä¿ÇǴнº, ½Ã½ºÅÛ ¿£Áö´Ï¾îÀÇ ½°ÅÍ Ä¿ÇÇÇâÀÌ ³ª´Â *NIX
Ä¿ÇǴнº
½Ã½ºÅÛ/³×Æ®¿÷/º¸¾ÈÀ» ´Ù·ç´Â °÷
* HanIRCÀÇ #coffeenix ¹æ
[ Àåºñ ¹× ȸ¼± ÈÄ¿ø ]
HOME > ½Ã½ºÅÛ °ü¸® / ¼­¹ö¿î¿µ > µð½ºÅ© °ü¸® / ÆÄÀϽýºÅÛ / mount µµ¿ò¸»
°Ë»ö : »çÀÌÆ® WHOIS À¥¼­¹ö Á¾·ù


  ZFS ÆÄÀϽýºÅÛÀÇ snapshot(½º³À¼¦) ±â´É ÀÛ¼ºÀÏ : 2010/08/02 18:14
 
  • ±Û¾´ÀÌ : ÁÁÀºÁøÈ£ ( http://coffeenix.net/ )
  • Á¶È¸¼ö : 20495
          [ ÀÌÀüÈ­¸é / ¼öÁ¤ ]   ºñ¹Ð¹øÈ£ :     Àμâ¿ë È­¸é
      Á¦  ¸ñ : ZFS ÆÄÀϽýºÅÛÀÇ snapshot(½º³À¼¦) ±â´É
    ÀÛ¼ºÀÚ : ÁÁÀºÁøÈ£(truefeel, http://coffeenix.net/ )
    ÀÛ¼ºÀÏ : 2010.6.21(¿ù)
    ¼öÁ¤ÀÏ : 2010.8.2(¿ù) FreeBSD¿¡¼­ ZFS ¹öÀü Á¤º¸ Ãß°¡


    ZFS ÆÄÀϽýºÅÛÀº snapshot(½º³À¼¦) ±â´ÉÀ» Á¦°øÇÏ¿©, ¿øÇÏ¸é ¾ðÁ¦µçÁö snapshot½ÃÁ¡À¸·Î º¹¿øÇÒ ¼ö ÀÖ´Ù. ¸í·É¾î ÇÑÁÙ·Î snapshotÀ» ¸¸µé°í, ¸í·É¾î ÇÑÁÙ·Î º¹¿øÇÑ´Ù. snapshot »ý¼ºÀ» ¸ÅÀÏ 1ȸ ÀÌ»ó ÀÚµ¿À¸·Î ½ÇÇàµÇµµ·Ï ÇØÁÖ¸é, µ¥ÀÌÅÍ º¹¿ø¿¡ À¯¿ëÇÒ °ÍÀÌ´Ù.

    Âü°í·Î FreeBSD 8.0Àº ZFS v13À», 8.1Àº v14¸¦ Áö¿øÇÑ´Ù. FreeBSD 8.2 ¶Ç´Â 9.0¿¡¼­´Â v15¸¦ Áö¿øÇÒ ¿¹Á¤ÀÌ´Ù.
    ZFS v15´Â Solaris 10 update 8°ú FreeBSD°£ÀÇ È£È¯¼ºÀÌ ÁÁ¾ÆÁ³À¸¸ç, ZFSÆÄÀϽýºÅÛ¿¡ php Äڵ尡 ÀÖÀ»°æ¿ì¿¡ ±âÁ¸º¸´Ù 15~20%Á¤µµ RPS°¡ Çâ»óµÇ¾ú´Ù.


    1. snapshot ¸¸µé±â

    ZFS ÆÄÀϽýºÅÛÀº snapshot ±â´ÉÀ» Áö¿øÇÑ´Ù. µû¶ó¼­ ÆÄÀÏ ½Ã½ºÅÛÀÇ ¹é¾÷°ú ƯÁ¤ ½ÃÁ¡À¸·ÎÀÇ rollback(·Ñ¹é)ÀÌ ½±´Ù.
    ÀÌ·ÐÀûÀ¸·Î snapshotÀº ÃÖ´ë 2ÀÇ 64Á¦°ö°³±îÁö ¸¸µé ¼ö ÀÖ´Ù. snapshotÀº °°Àº ½ºÅ丮Áö Ç®(ÆÄÀϽýºÅÛ, º¼·ý)ÀÇ °ø°£À» »ç¿ëÇÑ´Ù.

    snapshotÀ» ¸¸µé¾îº¸ÀÚ. snapshot½Ã¿¡ Çü½ÄÀº 'ÆÄÀϽýºÅÛ@snapshot¸í' ¶Ç´Â 'º¼·ý@snapshot¸í'ÀÌ´Ù. snapshot À̸§Àº ±âÁ¸ À̸§°ú Áߺ¹µÇÁö ¾ÊÀ¸¸é ÀÓÀÇ·Î ¸¸µé¸é µÈ´Ù.

     
    # zfs snapshot data/log@2010_0621_1740_Mon
     


    snapshotÀ̸§Àº °³ÀÎÀûÀ¸·Î '³â¿ùÀÏ' Çü½ÄÀ» ¼±È£ÇÑ´Ù. snapshot ¸ñ·ÏÀ» º¼ ¶§, º°µµ ¼Ó¼º ¿É¼Ç(-o creation)À» Áà¾ß »ý¼ºÀÏÀÚ¸¦ º¼ ¼ö ÀÖ´Â ºÒÆíÇÔ ¶§¹®ÀÌ´Ù. Á» ´õ Á÷°üÀûÀ¸·Î Ç¥±âÇϱâÀ§ÇØ ¿äÀϱîÁö ºÙ¿©Á൵ ÁÁ´Ù.


    2. snapshot È®ÀÎÇϱâ

    »ý¼ºµÈ snapshot ¸ñ·ÏÀ» »ìÆ캸ÀÚ. »ý¼ºÀϽø¦ ¾Ë°í ½Í´Ù¸é -o creationÀÇ Ãß°¡ ¿É¼ÇÀÌ ÇÊ¿äÇÏ´Ù.

     
    # zfs list -t snapshot
    NAME                          USED  AVAIL  REFER  MOUNTPOINT
    ... »ý·« ...
    data/log@2010_0619_0701_Sat   26K      -  20.9M  -
    data/log@2010_0620_0701_Sun   30K      -  21.5M  -
    data/log@2010_0621_0701_Mon   31K      -  21.5M  -
    data/log@2010_0621_1740_Mon     0      -  28.5M  -
    #
    # zfs list -o name,used,referenced,creation -t snapshot
    NAME                          USED  REFER  CREATION
    ... »ý·« ...
    data/log@2010_0619_0701_Sat    26K  20.9M  Sat Jun 19  7:01 2010
    data/log@2010_0620_0701_Sun    30K  21.5M  Sun Jun 20  7:01 2010
    data/log@2010_0621_0701_Mon    31K  21.5M  Mon Jun 21  7:01 2010
    data/log@2010_0621_1740_Mon      0  28.5M  Mon Jun 21 17:40 2010
     


    ½ºÅ丮Áö Ç®ÀÇ history Á¤º¸¿¡¼­µµ snapshot »ý¼º ÀϽø¦ È®ÀÎÇÒ ¼ö ÀÖ´Ù. history¿¡¼­´Â ½ºÅ丮Áö Ç® »ý¼º, »èÁ¦, ±×¸®°í snapshot »ý¼º, º¹±¸, »èÁ¦ µî ¸ðµç º¯°æ Á¤º¸¸¦ È®ÀÎÇÒ ¼ö ÀÖ´Ù.

     
    # zpool history
    History for 'data':
    2010-06-08.10:13:05 zpool create data amrd0s1h
    2010-06-08.10:13:18 zfs create data/log
    ... »ý·« ...
    2010-06-20.07:01:02 zfs snapshot data/log@2010_0620_0701_Sun
    2010-06-21.07:01:02 zfs snapshot data/log@2010_0621_0701_Mon
    2010-06-21.17:40:57 zfs snapshot data/log@2010_0621_1740_Mon
     


    snapshotÀÇ °¢Á¾ ¼Ó¼º Á¤º¸(Property)¸¦ È®ÀÎÇغ¸ÀÚ.

     
    # zfs get all data/log@2010_0621_0701_Mon
    NAME                         PROPERTY              VALUE                  SOURCE
    data/log@2010_0621_0701_Mon  type                  snapshot               -
    data/log@2010_0621_0701_Mon  creation              Mon Jun 21  7:01 2010  -
    data/log@2010_0621_0701_Mon  used                  31K                    -
    data/log@2010_0621_0701_Mon  referenced            21.5M                  -
    data/log@2010_0621_0701_Mon  compressratio         1.00x                  -
    data/log@2010_0621_0701_Mon  devices               on                     default
    data/log@2010_0621_0701_Mon  exec                  on                     default
    data/log@2010_0621_0701_Mon  setuid                on                     default
    data/log@2010_0621_0701_Mon  shareiscsi            off                    default
    data/log@2010_0621_0701_Mon  xattr                 on                     default
    data/log@2010_0621_0701_Mon  version               3                      -
    data/log@2010_0621_0701_Mon  utf8only              off                    -
    data/log@2010_0621_0701_Mon  normalization         none                   -
    data/log@2010_0621_0701_Mon  casesensitivity       sensitive              -
    data/log@2010_0621_0701_Mon  nbmand                off                    default
    data/log@2010_0621_0701_Mon  primarycache          all                    default
    data/log@2010_0621_0701_Mon  secondarycache        all                    default
     



    3. snapshot rollbackÇϱâ

    rollbackÀº snapshot ¹æ¹ý°ú µ¿ÀÏÇÏ´Ù. ƯÁ¤ ½ÃÁ¡À¸·Î µÇµ¹¸®°í ½ÍÀ¸¸é ÇØ´ç 'snapshot¸í'À» ÁöÁ¤Çϱ⸸ ÇÏ¸é µÈ´Ù.

     
    # zfs rollback data/log@2010_0621_1740_Mon
    cannot rollback to 'data/log@2010_0621_1740_Mon': more recent snapshots exist
    use '-r' to force deletion of the following snapshots:
    data/log@2010_0621_1750_Mon
    data/log@2010_0621_1813_Mon
     


    À§ÀÇ °æ¿ì´Â data/log@2010_0621_1740_Mon ½º³À¼¦ ÀÌÈÄ(Áï, º¸´Ù ÃÖ±Ù)¿¡ 2°³ÀÇ ½º³À¼¦ÀÌ Á¸ÀçÇϱ⠶§¹®¿¡ ³ª¿À´Â ¸Þ½ÃÁöÀÌ´Ù. À̸¦ ¹«½ÃÇÏ°í ·Ñ¹éÇÏ·Á¸é -r ¿É¼Ç(Recursively)À» ÁÖ¸é µÈ´Ù.

     
    # zfs rollback -r data/log@2010_0621_1740_Mon
     



    4. snapshot Áö¿ì±â

    'zfs destroy snapshot¸í' Çü½ÄÀ¸·Î snapshotÀ» Áö¿î´Ù.

     
    # zfs list -t snapshot
    NAME                          USED  AVAIL  REFER  MOUNTPOINT
    ... »ý·« ...
    data/log@2010_0621_1824_Mon      0      -  28.5M  -
    data/log@2010_0621_1825_Mon      0      -  28.5M  -
    # zfs destroy data/log@2010_0621_1825_Mon
    # zfs list -t snapshot
    NAME                          USED  AVAIL  REFER  MOUNTPOINT
    ... »ý·« ...
    data/log@2010_0621_1824_Mon      0      -  28.5M  -
    #
     



    5. snapshotÀ» ÆÄÀÏ·Î ÀúÀå (send & receive)

    zfs send ¸í·ÉÀ¸·Î snapshotÀ» ÆÄÀÏ·Î ÀúÀåÇÑ´Ù. ÀúÀåµÈ ÆÄÀÏÀº º°µµ ¼­¹ö¿¡ º¸°üÇصΰí, ÇÊ¿ä½Ã º¹±¸ÇÒ ¼ö ÀÖ´Ù.

     
    # zfs send data/log@2010_0621_0701_Mon > /data/snapshot_2010_0621
    # ls -l /data
    drwxr-xr-x  49 root  wheel       113 Jun 21 15:57 log
    -rw-r--r--   1 root  wheel  20139288 Jun 21 16:47 snapshot_2010_0621
     


    ÆÄÀÏ·Î º¸°üÇß´ø snapshotÀ» º¹±¸ÇÏ·Á¸é ¾î¶»°Ô ÇÒ±î? Çö½ÃÁ¡ÀÇ ÆÄÀϽýºÅÛÀ» ´Ù¸¥ À̸§À¸·Î ¹Ù²Û´Ù. ±×¸®°í, »õ·Î¿î ÆÄÀϽýºÅÛÀ¸·Î snapshotÀ» º¹±¸ÇÑ´Ù.

     
    [ À̸§ º¯°æ ]
    # zfs rename data/log data/log_old
    # zfs list
    NAME           USED  AVAIL  REFER  MOUNTPOINT
    data          99.6M  27.7G  67.8M  /data
    data/log_old  31.0M  27.7G  28.5M  /data/log_old

    [ snapshotÆÄÀÏ¿¡¼­ º¹±¸ ]
    # zfs receive data/log < /data/snapshot_2010_0621
    # zfs list
    NAME           USED  AVAIL  REFER  MOUNTPOINT
    data           128M  27.7G  67.8M  /data
    data/log      28.5M  27.7G  28.5M  /data/log
    data/log_old  31.0M  27.7G  28.5M  /data/log_old
     



    6. snapshot »ý¼º, Á¶È¸ÇÏ´Â °£´ÜÇÑ ½ºÅ©¸³Æ®

    snapshot¸íÀ» ³¯Â¥Çü½Ä(¿¹. data/log@YYYY_MMDD_HHmm_¿äÀÏ)À¸·Î »ý¼ºÇØÁÖ´Â °£´ÜÇÑ ½ºÅ©¸³Æ®¸¦ ¸¸µé¾ú´Ù. snapshot ¸ñ·Ï º¼ ¶§, ¿©·¯ ¿É¼Ç ³Ö´Â°Ô ±ÍÂúÀºµ¥, ÀÌ °Íµµ ½±°Ô ÇÒ ¼ö ÀÖµµ·Ï Çß´Ù.

    - ¸ñ·Ï Á¶È¸ : ./zfs_snapshot.sh list
    - »ý¼º      : ./zfs_snapshot.sh create data/log
    - ¼Ó¼º Á¶È¸ : ./zfs_snapshot.sh status data/log@2010_0621_0701_Mon

    * snapshot ½ºÅ©¸³Æ® ³»·Á¹Þ±â
     
    #!/bin/sh
    #
    # zfs snapshot ½ºÅ©¸³Æ®
    # - list(Á¶È¸), create(»ý¼º), status(»ó¼¼ ¼Ó¼º)
    #
    # 2010.6.18(±Ý)
    # by ÁÁÀºÁøÈ£(truefeel, http://coffeenix.net/ )

    PATH=$PATH:/sbin

    case "$1" in
      # snapshot ¸ñ·Ï
      "list" )
    ¡¡¡¡¡¡zfs list -o name,used,referenced,creation -t snapshot
    ¡¡¡¡¡¡;;
      # snapshot ¸¸µé±â
      "create" )
    ¡¡¡¡¡¡DATE=`date +'%Y_%m%d_%H%M_%a'`

    ¡¡¡¡¡¡if [ "$2" = "" ]; then
    ¡¡¡¡¡¡¡¡¡¡¡¡echo "Usage: $0 $1 "
    ¡¡¡¡¡¡¡¡¡¡¡¡echo "Exam:  $0 $1 data/log"
    ¡¡¡¡¡¡¡¡¡¡¡¡echo
    ¡¡¡¡¡¡¡¡¡¡¡¡zfs list
    ¡¡¡¡¡¡¡¡¡¡¡¡exit 1
    ¡¡¡¡¡¡fi
    ¡¡¡¡¡¡zfs snapshot -r data/log@$DATE
    ¡¡¡¡¡¡;;
      # snapshot »ó¼¼ ¼Ó¼º Á¶È¸
      "status" )
    ¡¡¡¡¡¡if [ "$2" = "" ]; then
    ¡¡¡¡¡¡¡¡¡¡¡¡$0 list
    ¡¡¡¡¡¡¡¡¡¡¡¡echo
    ¡¡¡¡¡¡¡¡¡¡¡¡echo "Usage: $0 $1 "
    ¡¡¡¡¡¡¡¡¡¡¡¡exit 1
    ¡¡¡¡¡¡fi
    ¡¡¡¡¡¡zfs get all $2
    ¡¡¡¡¡¡;;
      *)
    ¡¡¡¡¡¡echo "Usage: $0 {list|create|status}"
    ¡¡¡¡¡¡exit 1
    esac
     


    ¸ÅÀÏ ¾Æħ 07:01ºÐ¿¡ data/log ÆÄÀϽýºÅÛ¿¡ ´ëÇÑ snapshotÀ» ¸¸µå·Á¸é ´ÙÀ½°ú °°ÀÌ /etc/crontab¿¡ ³Ö¾îÁÖ¸é µÈ´Ù.

     
    1¡¡¡¡¡¡7¡¡¡¡¡¡*¡¡¡¡¡¡*¡¡¡¡¡¡*¡¡¡¡¡¡root¡¡¡¡¡¡/root/bin/zfs_snapshot.sh create data/log > /dev/null 2>&1
     



    7. Âü°íÀÚ·á

    1) ZFS °ü·Ã

    * FreeBSD 7.x¿¡¼­ ZFS »ç¿ë & ¼º´É (2009.2, ±Û ÁÁÀºÁøÈ£)
      http://coffeenix.net/board_view.php?bd_code=1662
    * ZFS, Btrfs ÆÄÀϽýºÅÛ¿¡ ´ëÇØ (2009.9)
      http://coffeenix.net/bbs/viewtopic.php?p=5816#5816
    * FreeBSD 8.0 ¸±¸®Áî (°ø½Ä¹ßÇ¥) (2009.11)
      http://coffeenix.net/bbs/viewtopic.php?p=5963#5963
    * All welcome ZFS v15 in FreeBSD
      http://ivoras.sharanet.org/blog/tree/2010-07-13.all-welcome-zfs-v15-in-freebsd.html

    2) ZFS snapshot °ü·Ã

    * Chapter 6. Working With ZFS Snapshots and Clones
      http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch06.html
    * ZFS Best Practices Guide
      http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
    * ½ºÅ丮Áö À¯Æ¿¸®Æ¼ ½Ç½À: ZFS ½º³À¼¦°ú Amazon S3 ¿¬µ¿
      http://blog.sdnkorea.com/blog/545
      Ä¿ÇǴнº Ä«Æä ÃÖ±Ù ±Û
    [11/30] ±¹°¡&#5
    [11/29] ¿ÃÇØ&#4
    [11/28] ¿ÃÇØ&#4
    [10/20] Cross Compiler ±ò
    [07/14] SSL ¬¡¬°
    [04/26] Re: µµ½ºÈ­¸é ¿ø°ÝÁ¶Á¾ ¿©ºÎ
    [04/25] µµ½ºÈ­¸é ¿ø°ÝÁ¶Á¾ ¿©ºÎ
    [10/30] Cshell¿¡¼­ ³­¼ö ¼³Á¤
    [10/23] °øÇ×öµµÁÖ½Äȸ»ç SE ±¸ÀÎ Ëì
    [01/26] Re: wgetÀ¸·Î ´Ù¸¥¼­¹ö¿¡ÀÖ´Â µð·ºÅ丮¸¦ °¡Á®¿À·Á°íÇÕ´Ï´Ù.
    [01/25] wgetÀ¸·Î ´Ù¸¥¼­¹ö¿¡ÀÖ´Â µð·ºÅ丮¸¦ °¡Á®¿À·Á°íÇÕ´Ï´Ù.
    [01/11] ƯÁ¤ ¾Èµå·ÎÀ̵å WebView ¹öÀü¿¡¼­ SSL ¹®Á¦ (WebView ¹ö±×)
    [08/01] DNS forwarder (Àü´ÞÀÚ) ¼­¹ö¸¦ ÅëÇؼ­ Äõ¸®ÇÏ¸é ¿ª¹æÇâÀ» ¹Þ¾Æ¿ÀÁú ¸øÇÕ´Ï´Ù.
    [05/16] (ÁÖ)ÈÄÀÌÁî ½Ã½ºÅÛ¿£Áö´Ï¾î (°æ·ÂÀÚ) ¸ðÁý
    [02/15] [AWS] Cloudfront edge È®ÀÎÇϱâ
      New!   ÃÖ±Ù¿¡ µî·ÏÇÑ ÆäÀÌÁö
      KiCad EDA Suite project (Free/Libre/Open-Source EDA Suite) (CAD)
      ¿ÀÇÂij½ºÄÉÀ̵å ijµå (OpenCASCADE CAD)
      QCad for Windows --- GNU GPL (Free Software)
      The Hello World Collection
      IPMI¸¦ È°¿ëÇÑ ¸®´ª½º ¼­¹ö°ü¸®
      DNS ¼³Á¤ °Ë»ç
      nagiosgraph ¼³Ä¡ ¹æ¹ý
      Slony-I ¼³Ä¡ ¹æ¹ý (postgresql replication tool)
      Qmail±â¹ÝÀÇ Anti spam ½Ã½ºÅÛ ±¸ÃàÇϱâ
      clusterssh

    [ ÇÔ²²ÇÏ´Â »çÀÌÆ® ]




    ¿î¿µÁø : ÁÁÀºÁøÈ£(truefeel), ¾ß¼ö(yasu), ¹ü³ÃÀÌ, sCag
    2003³â 8¿ù 4ÀÏ~