´ÙÀ½ ÀÌÀü Â÷·Ê

10. µ¥ÀÌÅÍ ºí·°À» º¹±¸ÇÑ´Ù.

º¹±¸ÇÒ È­ÀÏÀÌ 12 ºí·°º¸´Ù ±æÁö ¾Ê´Ù¸é ÀÌ ¸ðµç ÀÚ·áÀÇ ºí·° ¹øÈ£´Â inode ¿¡ ÀúÀåµÇ¾î ÀÖ´Ù. ÀÌ´Â 'stat' ¸í·ÉÀ¸·Î Áï½Ã inode ¸¦ Ãâ·ÂÇØ ÀÐÀ» ¼ö ÀÖÁö¸¸, 'fsgrab'¸¦ »ç¿ëÇÏ¸é ´õ ½±°Ô ÇÒ¼ö ÀÖ´Ù. 8Àå¿¡¼­ ºÃ´ø ¿¹¸¦ ´Ù½Ã º¸ÀÚ.


  debugfs:  stat <148003>
    Inode: 148003   Type: regular  Mode:  0644  Flags: 0x0  Version: 1
    User:   503   Group:   100   Size: 6065
    File ACL: 0    Directory ACL: 0
    Links: 0   Blockcount: 12
    Fragment:  Address: 0    Number: 0    Size: 0
    ctime: 0x31a9a574 -- Mon May 27 13:52:04 1996
    atime: 0x31a21dd1 -- Tue May 21 20:47:29 1996
    mtime: 0x313bf4d7 -- Tue Mar  5 08:01:27 1996
    dtime: 0x31a9a574 -- Mon May 27 13:52:04 1996
    BLOCKS:
    594810 594811 594814 594815 594816 594817 
    TOTAL: 6

ÀÌ È­ÀÏÀº 6°³ ºí·°À» °¡Áö°í ÀÖ´Ù. 'recoverde.001' À̶ó´Â »õÈ­ÀÏ¿¡ Á¤È®È÷ ±â·ÏÇϱâ À§ÇØ ´ÙÀ½°ú °°ÀÌ Çغ¸ÀÚ.

# fsgrab -c 2 -s 594810 /dev/hda5 > recovered.001 # fsgrab -c 4 -s 594817 /dev/hda5 >> recovered.001

³¡ºÎºÐÀÇ 'recovered.001'´Â ÇÊ¿ä ¾øÀ» ¼öµµ ÀÖÁö¸¸ º°·Î Áß¿äÄ¡ ¾Ê´Ù. ¹°·Ð Çϳª ¶Ç´Â ±× ÀÌ»óÀÇ °ü·ÃµÈ ºí·°µéÀÌ µ¤¿© ¾²¿´À» °¡´É¼ºµµ ÀÖ´Ù. ¸¸¾à ±×·¸´Ù¸é ¿îÀÌ ¾ø´Â °ÍÀÌ´Ï ±× ºí·°¿¡ ´ëÇؼ± ÀØ¾î ¹ö·Á¶ó.

¹®Á¦´Â È­ÀÏÀÌ 12 ºí·°º¸´Ù ±æ¶§ ³ªÅ¸³­´Ù. À̶§´Â À¯´Ð½º È­ÀϽýºÅÛ¿¡ ´ëÇØ ¾à°£Àº ¾Ë°í ÀÖ¾î¾ß ÇÑ´Ù. È­ÀÏÀÇ ÀÚ·á´Â 'block' À̶ó ºÒ¸®´Â ÁýÇÕü¿¡ ÀúÀåµÈ´Ù. ±×¸®°í ÀÌ ºí·°µéÀº ¼øÂ÷ÀûÀ¸·Î ¹øÈ£°¡ ¸Å°ÜÁ® ÀÖ´Ù. ¶ÇÇÑ È­ÀÏ¿¡´Â ¼ÒÀ¯ÀÚ, Æ۹̼Ç, Á¾·ùµîÀÇ Á¤º¸°¡ º¸°üµÇ¾î ÀÖ´Â 'inode' ¶ó´Â °ÍÀÌ ÀÖ´Ù. ÀÌ·¯ÇÑ ºí·°°ú inode´Â ¼øÂ÷ÀûÀ¸·Î ¹øÈ£°¡ ¸Å°ÜÁ® ÀÖ°í ´Ù¸¥ ¼ø¼­¸¦ °®´Â´Ù. ±×¸®°í µð·ºÅ丮´Â È­ÀÏ À̸§°ú inode ¹øÈ£·Î ±¸¼º µÈ´Ù.

ÆÛ¹Ì¼Ç Á¤º¸ µîµî°ú ¸¶Âù°¡Áö·Î inode ¶ÇÇÑ È­ÀÏ µ¥ÀÌÅÍÀÇ À§Ä¡¸¦ º¸À¯ÇÑ´Ù. óÀ½ 12 µ¥ÀÌÅÍ ºí·°Àº inode ±× ÀÚü¿¡ ÀúÀåµÇ´Âµ¥ À̸¦ direct blocks¶ó ÇÑ´Ù. ±×·¯°í ³ª¸é inode ´Â 'indirect blocks'À» Æ÷ÇÔ Çϴµ¥ ¿©±â¼­ ºí·°Àº ºÎ°¡ÀûÀÎ direct blocks ¹øÈ£¸¦ Æ÷ÇÔÇÑ´Ù. ¶ÇÇÑ inode´Â indirect blocks ¹øÈ£ ¸ñ·ÏÀ» Æ÷ÇÔÇÑ µÎ¹èÀÇ indirect blocks ¹øÈ£¸¦ °¡Áö°í, ¶Ç À̸¦ Æ÷ÇÔÇÑ ¸ñ·ÏÀ» °¡Áø ¼¼¹èÀÇ indirect blocksÀ» °¡Áø´Ù.

´Ù½Ã ÀоÀÚ : ÀÌ´Â º¹ÀâÇÏÁö¸¸ Áß¿äÇÏ´Ù. ÀÚ, ºÒÇàÇÏ°Ôµµ ÃÖ±ÙÀÇ Ä¿³Î ¼öÇàÀº È­ÀÏ deletionÀÇ ¸ðµç indirect blocks ÀÌ 0ÀÌ´Ù.±×·¡¼­ 12ºí·° º¸´Ù ±ä È­ÀÏÀ̶ó¸é ÇÊ¿äÇÑ ¸ðµç ºí·°ÀÇ ¹øÈ£¸¦ ¹ß°ßÇÒ ¼ö ÀÖ´Ù´Â°Í Á¶Â÷ º¸ÁõÇÒ ¼ö ¾ø´Ù. ±×·¯ÇÑ °ÍÀ» ¾Ë¾Æ³¾ À¯ÀÏÇÑ ¹æ¹ýÀº ±× È­ÀϵéÀÌ Á¶°¢³ªÁö ¾Ê¾Ò´Ù°í °¡Á¤ ÇÏ´Â °ÍÀÌ´Ù. ¸¸¾à »ê»ê Á¶°¢ÀÌ ³µ´Ù¸é ¹®Á¦°¡ ÀÖ´Ù. È­ÀÏ¿¡ indirect block ÀÌ ÇÊ¿äÇÏ´Ù¸é Á¶°¢³ªÁö ¾ÊÀº °ÍµéÀº ´ÙÀ½°ú °°ÀÌ ³ªÅ¸³­´Ù.


    #Blocks   Contents
    12        Data (direct blocks)
    1         Indirect block
    256       Data (blocks in the indirect block)
    1         Doubly indirect block
   [1         Indirect block of the doubly indirect block
    256       Data
   ] (256 times -- one for each indirect block in the doubly indirect)
    1         Triply indirect block
  [[1         Doubly indirect block
    256       Data
   ] (256 times -- one for each indirect block in the doubly indirect
      block of the triply indirect block)
  ] (256 times -- one for each doubly indirect block in the triply
     indirect block)

À§ÀÇ °ÍÀÌ ¸íÈ®Çϱ⸦ ¹Ù¶õ´Ù. È­ÀÏÀÌ ´ÜÁö 268 ºí·° »ÓÀ̶ó¸é ÀÌ´Â ÀüÀûÀ¸·Î °¡´ÉÇÏ´Ù. À̵éÀº 12ºí·° µ¥ÀÌÅÍÀÌ°í (ÀÌ ¹øÈ£´Â inode ÀÚü¿¡ ³ªÅ¸³­´Ù) indirect block À» µû¸£¸ç ´Ù¸¥ 256 Á¦ÀÌÅÍ ºí·°À» µû¸¥´Ù. ¸¸¾à È­ÀÏÀÌ À§ÀÇ °Íº¸´Ù ±æ´Ù¸é µÎ¹èÀÇ indirect block À» Ãß°¡ÇÑ´Ù. ±× ÀÌÈÄ °¢°¢ÀÇ ºÎ°¡ÀûÀÎ 256 µ¥ÀÌÅÍ ºí·°¿¡´Ù ÇϳªÀÇ indirect block °ú 256 µ¥ÀÌÅÍ ºí·°À» Ãß°¡Çϴµ¥ ÃÖ´ë°¡ 256 ÀÌ´Ù. À̺¸´Ù È­ÀÏÀÌ ´õ ±æ´Ù¸é Á¶°¢³ª ÀÖÁö ¾ÊÀ» °¡´É¼ºÀº °ÅÀÇ ¾øÁö¸¸ ´õ ±ä È­ÀÏ¿¡ ±× Á¶Á÷ÀÌ À̾îÁ® ³ªÅ¸³¯ ¼öµµ ÀÖ´Ù.

¿©·¯ºÐÀÇ ºí·° Å©±â´Â ¸ðµÎ 1024 bytes ÀÌ°í À̴ ǥÁØ°ªÀÌ´Ù. ºí·°ÀÌ À̺¸´Ù Å©´Ù¸é ¾à°£ÀÇ ¹øÈ£µéÀÌ ¹Ù²î¾î ³ªÅ¸³­´Ù. Ưº°È÷: °¢ ºí·° ¹øÈ£°¡ 4 bytes µô´Ù¸é blocksize/4 ´Â °¢°¢ÀÇ indirect block ¿¡ ÀúÀåµÇ´Â ºí·° ¹øÈ£ÀÌ´Ù. ±×·¡¼­ ¸Å¹ø ¸ñÂ÷¿¡ ³ªÅ¸³ª´Â 256 À̶ó´Â ¹øÈ£¸¦ blocksize/4 ·Î ¹Ù²Ù´Â °ÍÀÌ´Ù.


´ÙÀ½ ÀÌÀü Â÷·Ê