Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2002 21:45:49 +0300 (MSK)
From:      "."@babolo.ru
To:        brent@rcfile.org (Brent Verner)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: multiple mounts of single device
Message-ID:  <200201301845.VAA12224@aaz.links.ru>
In-Reply-To: <20020130032020.GA5077@rcfile.org> from "Brent Verner" at "Jan 29, 2 10:20:20 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Brent Verner writes:
> Hi,
>   
>   I've been searching for info regarding mounting the same device
> to multiple locations in the filesystem, i.e...
> 
> # mount /dev/ad0s1e /usr
> # mount -r /dev/ad0s1e /var/jail/AAAA/usr
> # mount -r /dev/ad0s1e /var/jail/BBBB/usr
There was a time I mounted the same _file system_ to multiple locations.
I made some part of disk with a lot of names and mount
different devices with the same file system to different mount point.

For example:
0garkin~(6)>disklabel ad0s3
# /dev/ad0s3c:
type: ESDI
disk: auto
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16128
sectors/unit: 16257024
rpm: 7200
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  b: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  c: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  d: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  e: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  f: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  g: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
  h: 16257024        0    4.2BSD     1024  8192    63   # (Cyl.    0 - 16127)
Warning, partition c is not marked as unused!
Warning, An incorrect partition c may cause problems for standard system utilities

More of that, you can mark partition (ad0s3 in this case)
with 0x05 type (extetded) and use 5 sets as the same fs:
ad0s3a..h, ad0s5a..h to ad0s8a..h
0garkin~(9)>fdisk ad0s3
******* Working on device /dev/ad0s3 *******
parameters extracted from in-core disklabel are:
cylinders=16128 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=16128 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 0, size 16257024 (7938 Meg), flag 80 (active)
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 767/ sector 63/ head 15
The data for partition 2 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 0, size 16257024 (7938 Meg), flag 0
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 767/ sector 63/ head 15
The data for partition 3 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
    start 0, size 16257024 (7938 Meg), flag 0
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 767/ sector 63/ head 15
The data for partition 4 is:
sysid 5,(Extended DOS)
    start 0, size 16257024 (7938 Meg), flag 0
        beg: cyl 0/ sector 1/ head 0;
        end: cyl 767/ sector 63/ head 15

and more, you can mark one of s5..s8 partitions with
0x05 type and use loop until s30.
But the last method is not safe for all kernels - some
just drop the error at loop end and work as expected,
some crush.

The dark side is that the only file system used
as different file systems - buffer cashe and
vnodes are different - memory exhaust.

Now I use null mount - it works now good enough
in jails ro mounts and is not so memory expansive

And one more trick:
0grimble~(7)>l -o /jail/pop1/usr/libexec/ld-elf.so.1 
 73 -r-xr-xr-x  24 root  wheel  schg,sunlnk 74352 18 ΑΧΗ  2000 /jail/pop1/usr/libexec/ld-elf.so.1*
                ^^
multiple used files - lot of jails use the same fs
with the only set of common files linked to different
jails hierarchies.

I cook now the helper package to set up light wait
jails (jail per function) in that techics.

Sorry, my English is bad.

>  [Warning: I /know/ I know next-to-nothing about filesystems... but]
> 
>   I recall seeing some traffic (IIRC, from early 2001) about this
> ability being in -current, but looking at 
> HEAD:/usr/sys/ufs/ffs/ffs_vfsops.c, I still see around line 571
> that EBUSY is still being returned if the device is already mounted.
> 
>   Not being familiar with the fbsd code... Am I even in the correct
> ballpark?  Or is this functionality already present in -current?
> If it is already in -current, where would I start digging around
> if I felt like (breaking a perfectly good 4.5 install and) trying
> to integrate the -current code into 4.5?
> 
>   I'd especially appreciate any two minute (or less) response to 
> any of the following questions -- I'm perfectly comfortable being
> told "go away and read," if I have some idea of what to read.
> 
>   0) Is this multiple mount point functionality even necessary,
>      or is there a better/existing mechanism to achieve the
>      same goal (aside from local nfs mount).
> 
>   1) What is the danger of not failing with EBUSY if the device
>      is already mounted?
> 
>   2) Would supporting multiple mounts require modifying any code
>      outside the filesystem (/usr/sys/src/ufs/ffs)?  If so, how 
>      much and where?
> 
> thanks.
>   brent
> 
> -- 
> "Develop your talent, man, and leave the world something. Records are 
> really gifts from people. To think that an artist would love you enough
> to share his music with anyone is a beautiful thing."  -- Duane Allman
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 


-- 
@BABOLO      http://links.ru/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201301845.VAA12224>