[Gluster-devel] How to resolve gfid (and .glusterfs symlink) for a deleted file

Ben England bengland at redhat.com
Fri Nov 21 16:20:19 UTC 2014


Nux,

Those thousands of entries all would match "-links 2" but not "-links 1"  The only entry in .glusterfs that would match is the entry where you deleted the file from the brick.  That's how hardlinks work - when you create a regular file, the link count is increased to 1 (since the directory entry now references the inode), and when you create an additional hard link to the same file, the link count is increased to 2.   Try this with the "stat your-file" command and look at the link count, watch how it changes.  The "find" command that I gave you just tracks down the one hardlink that you want and nothing else.

-ben

----- Original Message -----
> From: "Nux!" <nux at li.nux.ro>
> To: "Ben England" <bengland at redhat.com>
> Cc: "Gluster Devel" <gluster-devel at gluster.org>
> Sent: Friday, November 21, 2014 11:03:46 AM
> Subject: Re: [Gluster-devel] How to resolve gfid (and .glusterfs symlink) for a	deleted file
> 
> Hi Ben,
> 
> I have thousands of entries under /your/brick/directory/.glusterfs .. find
> would return too many results.
> How do I find the one I'm looking for? :-)
> 
> --
> Sent from the Delta quadrant using Borg technology!
> 
> Nux!
> www.nux.ro
> 
> ----- Original Message -----
> > From: "Ben England" <bengland at redhat.com>
> > To: "Nux!" <nux at li.nux.ro>
> > Cc: "Gluster Devel" <gluster-devel at gluster.org>
> > Sent: Friday, 21 November, 2014 16:00:40
> > Subject: Re: [Gluster-devel] How to resolve gfid (and .glusterfs symlink)
> > for a	deleted file
> 
> > first of all, links in .glusterfs are HARD links not symlinks.   So the
> > file is
> > not actually deleted, since the local filesystem keeps a count of
> > references to
> > the inode and won't release the inode until the ref count reaches zero.   I
> > tried this, it turns out you can find it with
> > 
> > # find /your/brick/directory/.glusterfs -links 1 -type f
> > 
> > You use "type f" because it's a hard link to a file, and you don't want to
> > look
> > at directories or "." or ".." .  Once you find the link, you can copy the
> > file
> > off somewhere, and then delete the link.  At that point, regular self-heal
> > could repair it (i.e. just do "ls" on the file from a Gluster mountpoint).
> > 
> > ----- Original Message -----
> >> From: "Nux!" <nux at li.nux.ro>
> >> To: "Gluster Devel" <gluster-devel at gluster.org>
> >> Sent: Friday, November 21, 2014 10:34:09 AM
> >> Subject: [Gluster-devel] How to resolve gfid (and .glusterfs symlink) for
> >> a
> >> 	deleted file
> >> 
> >> Hi,
> >> 
> >> I deleted a file by mistake in a brick. I never managed to find out its
> >> gfid
> >> so now I have a rogue symlink in .glusterfs pointing to it (if I got how
> >> it
> >> works).
> >> Any way I can discover which is this file and get rid of it?
> >> 
> >> --
> >> Sent from the Delta quadrant using Borg technology!
> >> 
> >> Nux!
> >> www.nux.ro
> >> _______________________________________________
> >> Gluster-devel mailing list
> >> Gluster-devel at gluster.org
> >> http://supercolony.gluster.org/mailman/listinfo/gluster-devel
> 


More information about the Gluster-devel mailing list