LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-24-2013, 11:55 PM   #1
graeyhat
Member
 
Registered: Oct 2013
Location: USA, a place where an open-source document (The Constitution) is the law of the land.
Distribution: Debian (because of their underlying philosophies) running AwesomeWM (because of its functionality).
Posts: 34

Rep: Reputation: Disabled
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.

Last edited by graeyhat; 11-25-2013 at 12:00 AM.
 
Old 11-25-2013, 10:05 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,392

Rep: Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014
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.
 
1 members found this post helpful.
Old 11-27-2013, 01:12 AM   #3
graeyhat
Member
 
Registered: Oct 2013
Location: USA, a place where an open-source document (The Constitution) is the law of the land.
Distribution: Debian (because of their underlying philosophies) running AwesomeWM (because of its functionality).
Posts: 34

Original Poster
Rep: Reputation: Disabled
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.

Last edited by graeyhat; 11-27-2013 at 01:15 AM.
 
Old 11-27-2013, 10:00 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,392

Rep: Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014Reputation: 2014
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.
 
Old 11-27-2013, 11:43 AM   #5
graeyhat
Member
 
Registered: Oct 2013
Location: USA, a place where an open-source document (The Constitution) is the law of the land.
Distribution: Debian (because of their underlying philosophies) running AwesomeWM (because of its functionality).
Posts: 34

Original Poster
Rep: Reputation: Disabled
If this was facebook I would totally 'like' that last comment. Thanks for your help man.
 
  


Reply

Tags
fat32, filesystem, inode, offset


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WD 2TB ext usb drive: Ubuntu 10.04 chkdsk equivalent with no loss of files posible? gustav521 Linux - Hardware 3 04-29-2011 04:16 PM
Fat32 equivalent of ntfsresize? gothgeek84 Linux - Hardware 14 09-24-2008 10:01 PM
[NTFS]/[EXT(2 or 3)]/[FAT/FAT32] partitions fraz Linux - Software 5 11-14-2004 07:43 AM
Filesystems: ext 2, ext 3, reiserfs. Which one? r3dhatter Linux - Newbie 12 07-15-2004 12:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration