Date: Fri, 30 Jun 2000 17:36:48 -0700 From: Matthew Hunt <mph@astro.caltech.edu> To: R Joseph Wright <rjoseph@mammalia.org> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Inodes and filenames Message-ID: <20000630173648.A15414@wopr.caltech.edu> In-Reply-To: <20000630170905.A27488@manatee.mammalia.org>; from rjoseph@mammalia.org on Fri, Jun 30, 2000 at 05:09:05PM -0700 References: <20000630170905.A27488@manatee.mammalia.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 30, 2000 at 05:09:05PM -0700, R Joseph Wright wrote: > First, how can I find out whether an inode has more than one filename > associated with it? If you know one filename, ls -l shows the link count as the field right after the permissions. If you only know the number, one way is to use fsdb in read-only mode: $ fsdb -r /dev/rda0a ** /dev/rda0a (NO WRITE) Examining file system `/dev/rda0a' Last Mounted on / current inode: directory I=2 MODE=40755 SIZE=1024 MTIME=Jun 30 11:57:27 2000 [0 nsec] CTIME=Jun 30 11:57:27 2000 [0 nsec] ATIME=Jun 30 17:29:07 2000 [0 nsec] OWNER=root GRP=wheel LINKCNT=27 FLAGS=0 BLKCNT=2 GEN=76c87c41 fsdb (inum: 2)> inode 896 current inode: regular file I=896 MODE=100555 SIZE=2301194 MTIME=Jun 25 12:34:06 2000 [0 nsec] CTIME=Jun 25 12:34:06 2000 [0 nsec] ATIME=Jun 25 23:19:16 2000 [0 nsec] OWNER=root GRP=wheel LINKCNT=1 FLAGS=0x20000 BLKCNT=11a0 GEN=4761b8ff ^^^^^^^^^ (This happens to be /kernel on my machine.) A slower approach is to use find(1) with the "-inum" flag, but then you'll know the filenames too. > Second, can I delete a file by specifying the inode rather than the > filename? You could combine find(1)'s "-inum" and "-delete" flags, or use clri or fsdb (and then fsck). -- Matthew Hunt <mph@astro.caltech.edu> * Inertia is a property http://www.pobox.com/~mph/ * of matter. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000630173648.A15414>