Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mounting directories within mounted directories
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
frippz
Guru
Guru


Joined: 22 Aug 2002
Posts: 460
Location: Sweden

PostPosted: Sun Apr 27, 2003 3:00 pm    Post subject: Mounting directories within mounted directories Reply with quote

My friend and I are setting up an FTP server using ProFTPd. Now we're having some problems with mounted directories. Now, when you're mounting several directories, it can become quite confusing so I hope I'm getting through to everyone here. Ok, here we go. Let me first post my fstab and the results of "mount"
Code:

# /etc/fstab: static file system information.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.10 2002/11/18 19:39:22 azarah Exp $
#
# noatime turns of atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.

# <fs>                  <mountpoint>    <type>          <opts>                  <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1               /boot           ext3            noauto,noatime          1 2
/dev/hda3               /               ext3            noatime                 0 1
/dev/hda4               /home           ext3            noatime                 0 2
/dev/hda2               none            swap            sw                      0 0
/dev/hdb1               /mnt/sg20       ext3            noatime                 0 2
/dev/hdc1               /mnt/sg60       ext3            noatime                 0 2
/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro               0 0
proc                    /proc           proc            defaults                0 0


# Netmounts
# <fs>                  <mountpoint>                    <type>  <opts>                                                  <dump/pass>

//zax/pub4              /home/ftp/disk3                 smbfs   credentials=/home/chrillo/.zax,uid=chrillo,gid=users    0 0

# Mounted folders (mount --bind)

# NOTE: These are just examples of how it can be done. If you want mounted folders to survive
# a reboot, they must be in here. The syntax is quite simple, so you'll get the hang of it! ;)

# <fs>                          <mountpoint>                    <type>  <opts>

/mnt/sg20/disk1                 /home/ftp/disk1                 none    bind
/mnt/sg60/disk2                 /home/ftp/disk2                 none    bind
/home/chrillo/upload            /home/levi/upload               none    bind
/home/chrillo/upload            /home/madmartigan/upload        none    bind
/home/chrillo/upload            /home/cube/upload               none    bind
/home/ftp                       /home/levi/pub                  none    bind
/home/ftp                       /home/madmartigan/pub           none    bind


# NTFS mounts
# <fs>          <mountpoint>                    <type>  <opts>                                          <dump/pass>

#/dev/hdc1      /home/chrillo/mounts/vault2     ntfs    owner,uid=chrillo,gid=users,async,ro,umask=0    0 0


# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink). Adding the following
# line to /etc/fstab should take care of this:
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will use almost no
#  memory if not populated with files)

tmpfs                   /dev/shm        tmpfs           defaults                0 0

Code:

/dev/hda3 on / type ext3 (rw,noatime)
proc on /proc type proc (rw)
none on /dev type devfs (rw)
tmpfs on /mnt/.init.d type tmpfs (rw,mode=0644,size=2048k)
/dev/hda4 on /home type ext3 (rw,noatime)
tmpfs on /dev/shm type tmpfs (rw)
//zax/pub4 on /home/ftp/disk3 type smbfs (0)
/home/chrillo/upload on /home/levi/upload type none (rw,bind)
/home/chrillo/upload on /home/madmartigan/upload type none (rw,bind)
/home/chrillo/upload on /home/cube/upload type none (rw,bind)
/mnt/sg60/disk2 on /home/ftp/disk2 type none (rw,bind)
/dev/hdb1 on /mnt/sg20 type ext3 (rw,noatime)
/dev/hdc1 on /mnt/sg60 type ext3 (rw,noatime)
/mnt/sg20/disk1 on /home/ftp/disk1 type none (rw,bind)
/mnt/sg60/disk2 on /home/ftp/disk2 type none (rw,bind)
/home/ftp on /home/levi/pub type none (rw,bind)
/home/ftp on /home/madmartigan/pub type none (rw,bind)
/home/ftp on /home/cube/pub type none (rw,bind)

As you can see from the fstab, some directories get mounted within another mounted directory. When you enter for example /home/levi/pub/disk1, you're supposed to se the contents of of that directory. According to mtab /home/sg20/disk1 is mounted on /home/ftp/disk1. And /home/ftp/ is mounted on /home/levi/pub. Damn, I'm getting a headache from this. I don't think it is possible to mount like this, or is it?

I don't even know if you get the principles of it. I've must've missed something.

Edit: Oh damn... forgot to show you the problem itself. :roll:
Here's how it looks when you enter /home/ftp/disk1
Code:

server root # cd /home/ftp/disk1/
server disk1 # ls
films
server disk1 #

and here's how it looks when you enter /home/levi/pub/disk1 (wich should point to the same dir)
Code:

server root # cd /home/levi/pub/disk1/
server disk1 # ls
server disk1 #

It's empty! My first thought was that you can't mount dirs inside other dirs that already have been mounted themselves. Or can you...?

PS.
I can't use symlinks instead of mounting, since those won't work inside a chrooted environment on the FTP. Reference found here.

Please help me with this! :(


Last edited by frippz on Sun Apr 27, 2003 3:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
handsomepete
Guru
Guru


Joined: 21 Apr 2002
Posts: 548
Location: Kansas City, MO

PostPosted: Sun Apr 27, 2003 3:18 pm    Post subject: Reply with quote

What are you trying to do? If you're just wanting to make /home/ftp reference /home/levi/pub (or /mnt/sg20/disk1 reference /home/ftp/disk1), why not just use symlinks? That's what they're for, and you don't have to worry about what gets mounted when and in what order.
Back to top
View user's profile Send private message
frippz
Guru
Guru


Joined: 22 Aug 2002
Posts: 460
Location: Sweden

PostPosted: Sun Apr 27, 2003 3:27 pm    Post subject: Reply with quote

Updated my post with info regarding symlinks. Check the bottom... :wink:
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Mon Apr 28, 2003 12:12 am    Post subject: Reply with quote

Read read this form man mount:
Since Linux 2.4.0 it is possible to remount part of the file hierarchy
somewhere else. The call is
mount --bind olddir newdir
After this call the same contents is accessible in two places.

This call attaches only (part of) a single filesystem, not possible
submounts. The entire file hierarchy including submounts is attached a
second place using
mount --rbind olddir newdir

You might try "rbind" to mount the entire tree and submounts.
You could also try changing the order of your mounts to
Code:

/mnt/ftp               /home/levi/pub
/mnt/sg20/disk1   /home/ftp/disk1


Interesting though, it made me feel like my brain pan was going to fall out my trap door. :lol:
hielvc
Back to top
View user's profile Send private message
frippz
Guru
Guru


Joined: 22 Aug 2002
Posts: 460
Location: Sweden

PostPosted: Mon Apr 28, 2003 2:42 pm    Post subject: Reply with quote

Man! How did I miss that one! :D
Gonne give it a try ASAP. But you're right. The mere thought of this makes my head hurt... 8O
I've heard that virtual chrooting solves the symlink problem. But is it implemented i ProFTPd? I'd love to use symlinks instead of mounting dirs all over the system.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum