Re: May inode number be zero?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 08, 2003 at 08:48:40PM +0100, Jan Hudec wrote:
> I have numbered root inode of my experimental fs 0. All worked, but ls
> did not return the direcotry entry. That is, it didn't return .. entry
> in it's children. It showed the mountpoint right. I have not checked if
> it shows . in the directory itself.
> 
> So my question is, why is inode number supposed to be non-zero?

Because there is a bug in glibc which has been reported a couple of
times. It's perfectly OK to have an inode 0, but the glibc people think
it's a bug cause in some very old linux systems there were filesystems
where inode 0 contained garbage (read: there was a kernel bug in the
filesystem directory code). This was fixed long ago, but up to date the
glibc people think they should still ignore inode 0.

Note that inode 0 works perfectly ok, it's just that readdir() (and
hence ls) won't show it. For example: On NTFS, inode 0 contains $MFT,
the Master File Table (a system file containing information about all
other file. If you mount an NTFS partition with -o show_sys_files, you
can't see $MFT when you type ls, but "cp $MFT /tmp" just works (IOW:
you can open() the file).

The best way to fix your problem it is to start numbering your inodes
at 1, which might be al lot easier than convincing the glibc people.
OTOH: a file with inode 0 is indeed a hidden file ;)


Erik

-- 
J.A.K. (Erik) Mouw
Email: J.A.K.Mouw@its.tudelft.nl  mouw@nl.linux.org

Attachment: pgp00296.pgp
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux