From owner-freebsd-questions Tue Dec 3 21:52:42 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB64A37B401 for ; Tue, 3 Dec 2002 21:52:36 -0800 (PST) Received: from mail.au.darkbluesea.com (mail.au.darkbluesea.com [203.185.208.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2CC4743EB2 for ; Tue, 3 Dec 2002 21:52:35 -0800 (PST) (envelope-from d.anker@au.darkbluesea.com) Received: (qmail 24756 invoked by uid 82); 4 Dec 2002 05:50:07 -0000 Received: from unknown (HELO ?10.0.0.188?) (10.0.0.188) by bandit.au.darkbluesea.com with SMTP; 4 Dec 2002 05:50:07 -0000 Subject: Re: using mount_union From: Duncan Anker To: "Marc G. Fournier" Cc: freebsd-questions@freebsd.org In-Reply-To: <20021204004113.P36076-100000@hub.org> References: <20021204004113.P36076-100000@hub.org> Content-Type: text/plain Organization: Dark Blue Sea Message-Id: <1038981158.4054.55.camel@duncan.au.darkbluesea.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 04 Dec 2002 15:52:38 +1000 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 2002-12-04 at 14:48, Marc G. Fournier wrote: > Evening all ... > > I just read through the man page a couple of times, and it sounded quite > straightforward, but I've obviously mis-understood ... > > My read of the man page is that I can create to directories (/d1 and > /d2), mount /d1 over /d2 (mount_union /d2 /d1) and if I create a file in > /d2, it won't show up in /d1, but if I create on in /d1, it will show up > in /d2 ... > Did you read this bit in the man pages? :-) THIS FILESYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK) AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM. USE AT YOUR OWN RISK. BEWARE OF DOG. SLIPPERY WHEN WET. Apart from that, my reading would be that if you mount_union /d2 /d1, then any files in /d2 would mask /d1. Hence if a file exists in both locations, you will never see the one in /d1. On the other hand, if you create the file in either location it will show up in the union. > But, when I tried it "in reality", it didn't matter which one I created > in, it showed up in the other one ... Sounds right to me. > > venus# mkdir d1 d2 > venus# mount_union /v1/test/d2 /v1/test/d1 > venus# touch /v1/test/d1/testfile > venus# touch /v1/test/d2/testfile2 > venus# ls -lR > total 4 > drwxr-xr-x 4 root wheel 512 Dec 3 22:45 d1 > drwxr-xr-x 2 root wheel 512 Dec 3 22:45 d2 > > ./d1: > total 0 > -rw-r--r-- 1 root wheel 0 Dec 3 22:45 testfile > -rw-r--r-- 1 root wheel 0 Dec 3 22:45 testfile2 > > ./d2: > total 0 > -rw-r--r-- 1 root wheel 0 Dec 3 22:45 testfile > -rw-r--r-- 1 root wheel 0 Dec 3 22:45 testfile2 > > > And when I umount the file system, d1 loses the files that were created on > it: Because they were really created in d2 - files are created in the upper layer, and searched for upper-to-lower. > > venus# umount /v1/test/d1 > venus# df -t union > venus# ls -lR > total 4 > drwxr-xr-x 2 root wheel 512 Dec 3 22:44 d1 > drwxr-xr-x 2 root wheel 512 Dec 3 22:45 d2 > > ./d1: > > ./d2: > total 2 > -rw-r--r-- 1 root wheel 28 Dec 3 22:46 testfile > -rw-r--r-- 1 root wheel 0 Dec 3 22:45 testfile2 > > So have I totally botched my read of the man page, or am I just doign > something wrong? :( Botching a read of the man page is not doing something wrong? :-) Did you try creating 2 different files with the same name in d1 and d2 *before* union mounting? Cheers, Duncan -- The information contained in this email is confidential. If you are not the intended recipient, you may not disclose or use the information in this email in any way. Dark Blue Sea does not guarantee the integrity of any emails or attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Dark Blue Sea. Dark Blue Sea does not warrant that any attachments are free from viruses or other defects. You assume all liability for any loss, damage or other consequences which may arise from opening or using the attachments. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message