0

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?

1 Answers1

0

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
Thomas Dickey
  • 76,765