Date: Fri, 21 Apr 2006 12:26:17 +0200 (CEST) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-fs@FreeBSD.ORG Subject: Re: How a file is deleted in ufs2? Message-ID: <200604211026.k3LAQH5S096362@lurza.secnetix.de> In-Reply-To: <20060421012537.0949ac45.trhodes@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Tom Rhodes <trhodes@freebsd.org> wrote: > Kris Kennaway <kris@obsecurity.org> wrote: > > Tom Rhodes wrote: > > > Bruce Evans <bde@zeta.org.au> wrote: > > > > On Mon, 10 Apr 2006, Scott Long wrote: > > > > > > > > > IOW, there is no easy way to undelete a file. > > > > > > > > This is currently true, except in the rare case where undelete(2) works. > > > > > > Oh, so it has worked for someone. I always wonder why we have this > > > functionality when I have never been able to make it work. Using > > > rm(1) that is. > > > > DESCRIPTION > > The undelete() system call attempts to recover the deleted file named by > > path. Currently, this works only when the named object is a whiteout in > > a union file system. > > What it fails to do is tell users what a "whiteout" is. At least > it was very unobvious to me while reading the manual page. It should be obvious after reading the undelete(2) manpage and the mount_unionfs(8) manpage (to which the former refers). Whiteouts are needed for UNIONFS mounts because the lower layer of such a mount is read-only, so you cannot remove files from it. When you delete a file on a UNIONFS that exists in the lower layer, a so-called whiteout is written to the upper layer which causes the file in the lower layer to become invisible and inaccessible (I think "ls -W" can be used to see the whiteout itself). In other words, such an unlink operation does not really physically delete the file. The undelete(2) function removes the whiteout, so the file becomes visible and accessible again. See "rm -W". Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "In My Egoistical Opinion, most people's C programs should be indented six feet downward and covered with dirt." -- Blair P. Houghton
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604211026.k3LAQH5S096362>