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

Re: "losing" a file in the ext2 file-system



Shlomi Fish wrote:
> 
> As far as my understanding of the Linux ext2 filesystem (and a UNIX fs in
> general) goes every file has its inode number which exclusively points to
> its content. A directory is simply a file that contains a list of
> filenames, their associated inode numbers, and other info such as
> permissions. I noticed that I can use the "joe" editor to edit directories,
> and it displays their binary content as if they were regular files.
> 
> Now, suppose I use joe to edit a directory and (with the proper knowldege
> and calculations) delete the entry of a file which has no other symbolic
> links, and then "save" it. Will the:
> 1. kernel ext2 filesystem handler not allow it?
> 
> 2. ext2 fs handler remove the file from the inode table?
> 
> 3. The file will be stuck in the hard disk, thus occupying space, and not
> easily removeable?
> 
>         Shlomi Fish
> 
> 

Well, I do not know what is realy implemented in the kernel 
or what specific to ext2 fs, but to my knoledge of unix-fs
and experiance:

I think the kernel will allow it, but when e2fschk will run, it will
identify the inode with no file pointing to it, and will fix it ( i dont
know if it will erase the inode and data, or add a file name to them )

if you realy want to know, make a little ext2 fs ( lats say: use a swap
file temporarily and use the swap partition for the temporary ext2 fs ),
edit the ditrectory and then run e2fsck then see what happens. 

if you come to a conclusion, please tell me ( and any one else who wants
to know )

-- 

Regards
Erez.          ___                                              ___
          L_|_                                            _|_J
         ( -O>                                            <O- )
      ___//\J +------------------------------------------+ L/\\___
     //-,\    | Erez Doron,                              |    /,-\\
    || / \\___L    U.S. Robotics Technologies, Israel    J___// \ ||
  _ ''/\/ '---J Email:                                   L---' \/\'' _
 / \ //\\.    |    erez@scorpio.com                      |    .//\\ / \
|_/\'/  ||    +------------------------------------------+    ||  \'/\_|
    '   ||_                                                  _||   '
        |__)                                                (__|


Follow-Ups: References: