Date: Mon, 24 Jun 1996 16:06:23 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: garth@dogbert.systems.sa.gov.au (Garth T Kidd) Cc: questions@freefall.freebsd.org Subject: Re: int link(const int inode, const char *name2) Message-ID: <199606242306.QAA02616@phaeton.artisoft.com> In-Reply-To: <1.5.4.32.19960625181506.00384450@dogbert.systems.sa.gov.au> from "Garth T Kidd" at Jun 25, 96 08:15:06 am
next in thread | previous in thread | raw e-mail | index | archive | help
> [This is on a BSDI machine, but BSDI and FreeBSD are at least half-brothers, > so here goes...] > > I've accidentally unlinked a file (or rather, had it unlinked for me by gzip > -- still my mistake) from the directory it was in. The file is, however, > still open. If I can get the inode (downloading lsof now), is it possible > to link it to the directory again? Ghah. You could manually mung the directory. If you were root and manually munged the directory it used to live in by using a binary editor on the block device (assuming it wasn't truncated and nothing was created in its slot), then all you'd have to do is adjust the end pointer: Directory block containing file: Before the delete ,-------------------------. | v ,--------------------------.,------------------------.,--------- | Good file || Deleted file || ... `--------------------------'`------------------------'`--------- | ^ `---------------------------------------------------' After the delete see /sys/ufs/ufs/dir.h, field is reclen. It is easy to damage an FS this way. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606242306.QAA02616>