From owner-freebsd-questions@FreeBSD.ORG Mon Jul 13 08:39:09 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6BFB106564A for ; Mon, 13 Jul 2009 08:39:09 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 6FED78FC15 for ; Mon, 13 Jul 2009 08:39:09 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 6EBF87E818 for ; Mon, 13 Jul 2009 00:39:08 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Mon, 13 Jul 2009 00:39:07 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-CURRENT; KDE/4.2.4; i386; ; ) References: <64c038660907130002i73a95d9bq9224373b5ff89f08@mail.gmail.com> <4A5AED8A.8050300@infracaninophile.co.uk> In-Reply-To: <4A5AED8A.8050300@infracaninophile.co.uk> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200907130039.07506.mel.flynn+fbsd.questions@mailing.thruhere.net> Subject: Re: Copy directory tree as hard links... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2009 08:39:09 -0000 On Monday 13 July 2009 00:17:14 Matthew Seaman wrote: > Modulok wrote: > > What is the easiest way to copy a directory tree as hard links? > > > > Linux has a nice little 'cp -al' flag combo to do this. The FreeBSD > > cp(1) manual page says to use pax or tar, but how do I get the ability > > to rename the file without first creating a destination file? I don't > > want an archive, just regular directory tree sitting right next to the > > original, but with a new name ... consisting of of hard links back to > > the original. For example on linux I could do something like: > > > > $ ls > > foo/ > > > > $ cp -al foo bar > > > > The result would be a new copy of foo, which takes up no additional > > space, as all files share the same inodes. Is there an easy way to do > > this on FreeBSD? > > cpio(1) > You might also consider using nullfs mounts. In /etc/fstab: > > /some/dir /other/dir nullfs rw 0 0 > > See mount_nullfs(8). There's one important difference there: rm bar/baz disconnects the hardlink, while with nullfs both foo/baz and bar/baz are gone (assuming rw mount). unionfs would replicate the hardlink behavior with quite a few caveats. -- Mel