LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   fat32 equivalent to ext* inodes. (https://www.linuxquestions.org/questions/linux-software-2/fat32-equivalent-to-ext%2A-inodes-4175485779/)

graeyhat 11-24-2013 11:55 PM

fat32 equivalent to ext* inodes.
 
fat32 equivalent to ext* inodes.

I am trying to write a bash script that addresses files on a fat32 formatted device without using filenames.

I would like to use inode numbers but it is my understanding that Linux creates temporary random numbers for fat32 devices to serve as inodes that change when the device is plugged into a different machine (unless I am wrong, if I am wrong please provide a link to something that says so).

What I need is a number that will be the same no matter what machine I mount the device on so I am choosing offset numbers (however if there is a better idea I am all ears).

My problem with my idea (as I see it) is that I cannot figure out what bash command there is that will list the offset posistion of a file on a fat32 filesystem.

Can anybody help?

Thank you.

rknichols 11-25-2013 10:05 PM

The inode numbers can be inconsistent even between successive mounts on the same system. Looking at the kernel source (fs/inode.c), the inode numbers are assigned sequentially as they are needed. This means that the files in a subdirectory are not assigned inode numbers until that directory is visited. If you have directories dir1 and dir2, then from a fresh mount the inode numbers assigned to files in, for example, dir2 will be different if you first looked in dir1.

For finding the location, the "--fibmap" option of the hdparm command might be helpful.

graeyhat 11-27-2013 01:12 AM

I think that might be it! Now I just gotta figure out what I'm reading.

For a small text file on an ext2 filesystem (just a quick look before I go to bed) I see two rows of columns of 'byte_offset', 'begin_LBA', 'end_LBA', and 'sectors'.

I assume that the first 'begin_LBA' number is what I'm looking for?

By the way thanks. I spent all of last weekend google-searching this.

rknichols 11-27-2013 10:00 AM

I'm sure it will become more apparent after a good night's sleep. Looking at the output for a file with multiple extents, perhaps /var/log/wtmp, might also make things more obvious.

graeyhat 11-27-2013 11:43 AM

If this was facebook I would totally 'like' that last comment. Thanks for your help man.


All times are GMT -5. The time now is 03:27 AM.