Find the answer to your Linux question:
Results 1 to 10 of 10
Hi all I am working in linux 2.6.26 in ext2 file system in ubuntu.I want to know the pointer to the data block or buffer in memory.The structure buffer head ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    12

    about the data block


    Hi all
    I am working in linux 2.6.26 in ext2 file system in ubuntu.I want to know the pointer to the data block or buffer in memory.The structure buffer head contains the b_data that is the data in memory and the pointer to the data blocks should be stored.So whether they have kept the array of pointers to all the data block existing in the ext2 file system some where.

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757
    I'm not sure whether i understood your problem-Correctly.Data Blocks - Inode contains address of these datablock.You would need to obtain inode,in order to read the data blocks.

    I would to suggest you to look into e2fsprogs Source code os debugfs Ext2fs Home Page

    I'm also need to digging into these areas ..I'm planning to paly with debugfs in coming days
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    12
    hi
    i want to change the data block number.In debugfs if the command stat filename is given it will display the details of the inode inclulding the block number which includes logical block number + physical block number.for ex it displays like (0-1)577-578.Here 0 represents the logical no and 577 represents the physical no.I want to update my physical number into this.

  4. #4
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757

    Exclamation

    If you want to change inode information using debugfs program,
    use modify_inode or mi option instead of stat.

    For complete info. check
    man debugfs
    else
    gET iT i sAY .giis - ext3 File Undelete Tool --won't be that much useful,i wrote this guide
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  5. #5
    Just Joined!
    Join Date
    Feb 2009
    Posts
    12
    If i give the modify_inode filename.It displays the message as

    modify_inode:Filesystem opened read/only.

  6. #6
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757
    debugfs: close
    and re-open your partition in Read-Write mode
    debugfs:open -w /dev/sdaX
    Then try mi command.
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  7. #7
    Just Joined!
    Join Date
    Feb 2009
    Posts
    12
    I tried to change the block number of the file2 with the block number of file1.The modify_inode command permit us to change the value.But when i press enter after changing the block number,it reaches till the triple indirect block [0] and displays
    modify_inode:Bad value -
    debugfs:
    once again on performing the stat of file2
    it shows the block number already exists it never changes

  8. #8
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757
    After changing inode informations , quit/exit from debugfs and then open the device and check with stat.

    I'm sure abt Error you are getting.Why are you trying to change data block
    of a inode to different datablock?

    Please post exact screen outputs so that we can analyze it
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  9. #9
    Just Joined!
    Join Date
    Feb 2009
    Posts
    12
    I did the cp of file1 to file2
    The code is as follows:
    debugfs: close
    debugfs: open -w /dev/sda4
    debugfs: modify_inode file2

    Mode [0100644]
    User ID [0]
    Group ID [0]
    size [2248]
    creation time [1236337558]
    Modification time [1236337558]
    Access time [1236337558]
    Deletion time [0]
    Link count [1]
    Block count high [0]
    lock count [4]
    File flags [0x0]
    Generation [0xff16270b]
    File acl [0]
    High 32 bits of size [0]
    Fragment address [0]
    Direct Block #0 [5635] /*i changed to number 4115 */
    /*so */
    Direct Block #0 [4115] /* on pressing enter */
    modify_inode: Bad value -115
    Direct Block #1 [5637] /*i changed to number 4116 *//*
    /*so */
    Direct Block #1 [4116] /* on pressing enter */
    modify_inode: Bad value -116
    Direct Block #2 [5639] /*i changed to number 4117 */
    /*so */
    Direct Block #2 [4117] /* on pressing enter */
    modify_inode: Bad value -117
    Direct Block #3 [0]
    Direct Block #4 [0]
    Direct Block #5 [0]
    Direct Block #6 [0]
    Direct Block #7 [0]
    Direct Block #8 [0]
    Direct Block #9 [0]
    Direct Block #10 [0]
    Direct Block #11 [0]
    Indirect Block [0]
    Double Indirect Block [0]
    Triple Indirect Block [0]

    The block number 4115,4116 and 4117 are the numbers of file1.I changed the numbers of file2 to file1.
    Since file1 and file2 have same content.

  10. #10
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,757
    oops!! sorry im unable to figure out root cause of error ..post your problem. in ext3user list you should get a prompt reply
    Ext3-users Info Page
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •