Re: a conceptual confusion -- loop device

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

 




Even after umount file doesnt disappear

1)mount -t ext4 /dev/loop4 /mnt/
2)cd /mnt
3)ls
          a.c  lost+found

4)cd -
4)umount /mnt
5)mount -t ext4 /dev/loop4 /mnt/
6) cd /mnt/

7)
[root@localhost mnt]# ls
a.c  lost+found


I m guessing ...is this somewhere related to that its showing data
from page cache but not from disk ?




On Fri, Mar 5, 2010 at 7:13 PM, Greg Freemyer <greg.freemyer@xxxxxxxxx> wrote:
On Fri, Mar 5, 2010 at 6:37 AM, nidhi mittal hada
<nidhimittal19@xxxxxxxxx> wrote:
>
> hi all
> I created a loop device
> /dev/loop0 ------------>with the image file ---------->file.img
> then
> mkfs and
> mount /dev/loop0 to /mnt
>
> cd /mnt
> created files a.c , b.c
> rm file.img  ------- removed file.img
>
> cd /mnt
> still i am able to see a.c b.c here
> How are these files present here ?
> they should have been deleted as underlying storage file is no where present
> !!

Nidhi,

For this think of rm as what it really is "unlink".

When you unlink a file all that happens is the directory entry for
that link is tagged as deleted / reusable, and the link count field in
the inode is decremented by one.

After the decrement there is code to do:

if (inode.link_count == 0 and inode.is_open == 0) then delete inode
and associated data blocks.

When your loop mount is unmounted it should close the fd associated
with the image file and invoke the above logic again which I assume at
that point will cause the inode and data blocks to be freed up.

Greg



--
Thanks & Regards
Nidhi Mittal Hada
Scientific officer D
Computer Division
Bhabha Atomic Research Center
Mumbai



[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