I learned that number of inode and datablock is assigned when created,

but for example, if we want "text.txt" this file to be stored in inode number 20 or datablock number 20, can we do it?

  • 3
    Not really, no. Whatever for? – frostschutz Mar 21 '16 at 16:51

That would be using the raw device (for a given block number).

Opening a specific inode is a different matter. That is neither a conventional raw-device operation nor a file-system operation. You might want to do this to recover a deleted file; there are a few tools which can do this. But writing to a given inode is not a good thing to do (unless you are writing a device driver), because that bypasses the rest of the system, with its integrity checks.

Further reading:

    Use lsof to determine the inode number of the file
    install icat (Google icat-sleuthtools)... for ubuntu it's apt-get install sleuthtools
    then use icat to copy the file to the new location:
    icat -hf ext /dev/xxx  > /path/to/copy.file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.