Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] inode for tagging system

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
juliorollan
Posts: 17
Joined: 2016-08-23 16:22
Location: Argentina

[SOLVED] inode for tagging system

#1 Post by juliorollan »

Hello again to everyone willing to enlight and help!
This time I have a question related to inodes.

I know the inode is a unique information set of data that identifies a file uniquely on a given linux system. So far so good.

I am developing a script to tag multimedia files, basically photos and videos, so it is easier to find relevant files. I have tried a couple of apps but they are not as consistent as I expected.

My questions are:

1) If I have /home mounted on a separate partition, does the inode of the files on /home change if I share that partition between two different linux systems?

2) If I have multimedia files in an external drive, does the inode of the files on that drive change between different linux systems?

I case they change, how can I identify those files uniquely even when their name is changed?
Are you aware of a really robust and consistent tag system?

Thanks for your time!
Best regards!

*Edit: topic name.
Last edited by juliorollan on 2019-01-24 16:24, edited 1 time in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: inode for tagging system

#2 Post by Head_on_a_Stick »

Code: Select all

ls -i $file
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: inode for tagging system

#3 Post by p.H »

Native inode numbers do not change. However,
- Not all filesystem types use inodes. Microsoft filesystems such as FAT and NTFS do not use inodes. Linux will create volatile virtual inode numbers with these filesystems.
- Inode numbers are filesystem internals and are not intended for users.

You may consider using extended file attributes on filesystems which support them. Extended attributes are managed with tools from the attr package.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 12 times
Been thanked: 66 times

Re: inode for tagging system

#4 Post by dilberts_left_nut »

You want the tags in the file, not the filesystem, or it's not portable, and therefore mostly useless.
AdrianTM wrote:There's no hacker in my grandma...

juliorollan
Posts: 17
Joined: 2016-08-23 16:22
Location: Argentina

Re: inode for tagging system

#5 Post by juliorollan »

p.H wrote: - Not all filesystem types use inodes. Microsoft filesystems such as FAT and NTFS do not use inodes. Linux will create volatile virtual inode numbers with these filesystems.
That is why I explicitly said linux. Twice. I do not care about microsoft's fs.
p.H wrote:- Inode numbers are filesystem internals and are not intended for users.
Why not use inodes to identify files?
p.H wrote: You may consider using extended file attributes on filesystems which support them. Extended attributes are managed with tools from the attr package.
I will check this. Thanks for pointing, never thought of it.
dilberts_left_nut wrote: You want the tags in the file, not the filesystem, or it's not portable, and therefore mostly useless.
Yeah, but what about the search speed? I was thinking of a DB, and therefore, asked about the inodes.

BTW, my questions are not answered so far.

Thanks!

juliorollan
Posts: 17
Joined: 2016-08-23 16:22
Location: Argentina

Re: inode for tagging system

#6 Post by juliorollan »

p.H.: could you explain a little more about what you said of "native inodes"? As far as I knew, inodes where assigned once by the system. So, I deduce for what you said that a file has, in its meta info, an inode?

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: inode for tagging system

#7 Post by p.H »

juliorollan wrote:That is why I explicitly said linux. Twice. I do not care about microsoft's fs.
A Linux system can use Microsoft's filesystems. External drives are often formatted with FAT or NTFS, even when they are used with Linux machines.
juliorollan wrote:Why not use inodes to identify files?
Do you mean inode numbers ?
The inode number change changes when you move the file to another filesystem.
Inode numbers are unique within a single filesystem, but not across all filesystems. Different files on different filesystems may have the same inode number.
juliorollan wrote:could you explain a little more about what you said of "native inodes"?
Native Linux filesystems such as the ext* family use real inodes to store file metadata.
Other filesystems such as FAT or NTFS do not use inodes. When such a filesystem is mounted, the kernel dynamically creates fake inodes to handle the files. These inodes are virtual and volatile (not written to the filesystem) and their numbers change at each mount.

juliorollan
Posts: 17
Joined: 2016-08-23 16:22
Location: Argentina

Re: inode for tagging system

#8 Post by juliorollan »

p.H., thanks for your reply and explanation. I already knew what you said but thought there was something else.
I do not use microsoft's fs so all my external drives are ext4 formatted.

So, after all this comments, I guess my best shot would be to have a "multimedia nas", say using an old computer as storage engine and developing the application there, accessing via http or ssh (will only be used over LAN). And using the attr command to append the tags to the files.

I am developing on PHP, just because I like it and allows me to create a friendly GUI in the future (now I am using PHP cli).

Regards!

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: inode for tagging system

#9 Post by p.H »

IIUC its manpage, the 'attr' command is intended only for XFS. If you are using another filesystem type which supports extended attributes such as ext4, you should use 'getfattr' and 'setfaddr' from the same 'attr' package instead.

juliorollan
Posts: 17
Joined: 2016-08-23 16:22
Location: Argentina

Re: inode for tagging system

#10 Post by juliorollan »

Yes, that's correct. I said attr but meant those intended for ext4.

Post Reply