Thanks a lot Manish for your reply.
These are some of the things I tried from the shell on same filesystem
[root@N5105INCS9BV1S debugfs]# !mount
mount /dev/ram0 /mnt/
[root@N5105INCS9BV1S debugfs]# cd /mnt/
[root@N5105INCS9BV1S mnt]# ls
a a1 a2 lost+found
[root@N5105INCS9BV1S mnt]# stat a
File: `a'
Size: 46 Blocks: 2 IO Block: 4096 regular file
[root@N5105INCS9BV1S mnt]# rm a2
rm: remove regular file `a2'? y
[root@N5105INCS9BV1S mnt]# stat a1
File: `a1'
Size: 46 Blocks: 2 IO Block: 4096 regular file
Device: 100h/256d Inode: 12 Links: 0
Access: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-05-30 11:21:36.000000000 +0530
Modify: 2008-05-30 11:21:36.000000000 +0530
Change: 2008-05-30 12:24:30.000000000 +0530
[root@N5105INCS9BV1S mnt]# stat a
File: `a'
Size: 46 Blocks: 2 IO Block: 4096 regular file
Device: 100h/256d Inode: 12 Links: 0
Access: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-05-30 11:21:36.000000000 +0530
Modify: 2008-05-30 11:21:36.000000000 +0530
Change: 2008-05-30 12:24:30.000000000 +0530
[root@N5105INCS9BV1S mnt]# rm a1
rm: remove regular file `a1'? y
[root@N5105INCS9BV1S mnt]# stat a
File: `a'
Size: 46 Blocks: 2 IO Block: 4096 regular file
Device: 100h/256d Inode: 12 Links: -1
Access: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-05-30 11:21:36.000000000 +0530
Modify: 2008-05-30 11:21:36.000000000 +0530
Change: 2008-05-30 12:24:45.000000000 +0530
evice: 100h/256d Inode: 12 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-05-30 11:21:36.000000000 +0530
Modify: 2008-05-30 11:21:36.000000000 +0530
Change: 2008-05-30 11:21:36.000000000 +0530
[root@N5105INCS9BV1S mnt]# cd -
/home/prasad/e2fs/e2fsprogs-1.40.10/builds/debugfs
The effect in the debugfs env was this ........
[root@N5105INCS9BV1S debugfs]# ./debugfs -w /dev/ram0
debugfs 1.40.10 (21-May-2008)
debugfs: lsdel
Inode Owner Mode Size Blocks Time deleted
0 deleted inodes found.
debugfs: ls
2 (12) . 2 (12) .. 11 (20) lost+found 12 (980) a
debugfs: stat a
Inode: 12 Type: regular Mode: 0664 Flags: 0x0 Generation: 0
User: 0 Group: 0 Size: 46
File ACL: 0 Directory ACL: 0
Links: 65535 Blockcount: 2
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x483fa4b5 -- Fri May 30 12:24:45 2008
atime: 0x483f95e8 -- Fri May 30 11:21:36 2008
mtime: 0x483f95e8 -- Fri May 30 11:21:36 2008
BLOCKS:
(0):338
TOTAL: 1
debugfs:
It is really confusing.
Thanks and Regards,
Prasad.
On Fri, May 30, 2008 at 11:54 AM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
Did you flush the memory contents and did a umount and then had aOn Fri, May 30, 2008 at 11:31 AM, Prasad Joshi <prasadjoshi124@xxxxxxxxx> wrote:
> Hi All,
>
> I am facing a problem where link count is not getting properly updated in
> the debugfs. I am using e2fsprogs.
>
> [root@N5105INCS9BV1S debugfs]# mkfs -t ext2 /dev/ram0
> mke2fs 1.40.10 (21-May-2008)
> Filesystem label=
> OS type: Linux
> Block size=1024 (log=0)
> Fragment size=1024 (log=0)
> 4096 inodes, 16384 blocks
> 819 blocks (5.00%) reserved for the super user
> First data block=1
> Maximum filesystem blocks=16777216
> 2 block groups
> 8192 blocks per group, 8192 fragments per group
> 2048 inodes per group
> Superblock backups stored on blocks:
> 8193
>
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
>
> This filesystem will be automatically checked every 30 mounts or
> 180 days, whichever comes first. Use tune2fs -c or -i to override.
>
> [root@N5105INCS9BV1S debugfs]# ./debugfs -w /dev/ram0
> debugfs 1.40.10 (21-May-2008)
>
> debugfs: ls
> 2 (12) . 2 (12) .. 11 (1000) lost+found
>
> debugfs: write /home/prasad/.vimrc a
> Allocated inode: 12
> debugfs: stat a
> Inode: 12 Type: regular Mode: 0664 Flags: 0x0 Generation: 0
> User: 0 Group: 0 Size: 46
> File ACL: 0 Directory ACL: 0
> Links: 1 Blockcount: 2
> Fragment: Address: 0 Number: 0 Size: 0
> ctime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> atime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> mtime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> BLOCKS:
> (0):338
> TOTAL: 1
>
> debugfs: ln a a1
>
> debugfs: stat a
> Inode: 12 Type: regular Mode: 0664 Flags: 0x0 Generation: 0
> User: 0 Group: 0 Size: 46
> File ACL: 0 Directory ACL: 0
> Links: 1 Blockcount: 2
> Fragment: Address: 0 Number: 0 Size: 0
> ctime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> atime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> mtime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> BLOCKS:
> (0):338
> TOTAL: 1
>
> debugfs: stat a1
> Inode: 12 Type: regular Mode: 0664 Flags: 0x0 Generation: 0
> User: 0 Group: 0 Size: 46
> File ACL: 0 Directory ACL: 0
> Links: 1 Blockcount: 2
> Fragment: Address: 0 Number: 0 Size: 0
> ctime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> atime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> mtime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> BLOCKS:
> (0):338
> TOTAL: 1
>
> debugfs: ln a a2
>
> debugfs: ls -l
> 2 40755 (2) 0 0 1024 30-May-2008 11:21 .
> 2 40755 (2) 0 0 1024 30-May-2008 11:21 ..
> 11 40700 (2) 0 0 12288 30-May-2008 11:21 lost+found
> 12 100664 (1) 0 0 46 30-May-2008 11:21 a
> 12 100664 (1) 0 0 46 30-May-2008 11:21 a1
> 12 100664 (1) 0 0 46 30-May-2008 11:21 a2
>
> debugfs: stat a
> Inode: 12 Type: regular Mode: 0664 Flags: 0x0 Generation: 0
> User: 0 Group: 0 Size: 46
> File ACL: 0 Directory ACL: 0
> Links: 1 Blockcount: 2
> Fragment: Address: 0 Number: 0 Size: 0
> ctime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> atime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> mtime: 0x483f95e8 -- Fri May 30 11:21:36 2008
> BLOCKS:
> (0):338
> TOTAL: 1
>
> debugfs:
>
> Why the link count is always showing 1 eventhough I have created 2 links to
> the file? Am I doing some mistake?
look. Also have a look at
http://kerneltrap.org/mailarchive/linux-kernel-newbies/2008/3/29/1295364
Thanks
>
> Thanks and Regards,
> Prasad.
>
--
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************