LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2007, 12:05 AM   #1
damiendusha
LQ Newbie
 
Registered: Jun 2006
Location: Brisbane, Australia
Distribution: Ubuntu 8.04
Posts: 21

Rep: Reputation: 15
Mounting two directories on a single device


Hello all,

I've been using Linux for about 2 years, but this feels like such a newbie question that I'm going to post it here. Actually, I still feel like a noob using it in general, but that's beside the point

I have a software RAID 5 array /dev/md0, and currently, I have /home mounted there. The remainder of the system is on a separate HDD (/dev/sda0).

However, what I would like to do is have a media directory (/media, for argument's sake) also on that RAID array. The idea being is that all the users in this house can consolidate our music collection and keep it backed up at the same time.

I was going to share using samba, because there's a mix of windows and linux boxes around the place.

What is the cleanest way to do this? Or better yet, I'm fully open to suggestions.

Cheers
Damien.
 
Old 07-14-2007, 12:17 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You have it backwords. You mount the filesystems found on a device on a directory, not the other way around.

Linux like Unix uses a hierarchal file structure. There is a root file system and all other filesystems are mounted on directories or subdirectories under root. So all you need to do is create a /media directory and use that. According to the LFHS (Linux Filesystem Hierarchy Standard), /media is used for mounting removable devices. /mnt is used for temporarily mounting devices. Most distro's are set up so that if you insert a usb or firewire drive, the udev and hal or udev and hotplug system will dynamically create a device node (i.e. /dev/sda ) for the device and any partition on the device (i.e. /dev/sda1, /dev/sda2 ).

You could create a directory under /home. You could call it /home/media and share that using samba.
Your distro may have a configuration program to help you, or you could use samba swat to configure in. Swat is a web based configuration tool that comes with samba.
If you have samba installed, look at the /etc/xinet.d/swat file.
Code:
# SWAT is the Samba Web Administration Tool.
service swat
{
        port            =  901
        socket_type     =  stream
        protocol        =  tcp
        wait            =  no
        user            =  root
        server          =  /usr/sbin/swat
        only_from       =  127.0.0.1
        log_on_failure  += USERID
        disable         =  no
}
Yours probably looks like this, but you may have the line "disable = yes". Change the yes to no. And restart the xinet.d service: "sudo /usr/bin/service xinet.d restart". After that, see if you can browse to "http://localhost:901".

Note: sometimes the xinet.d itself isn't started. You can use your services gui tool to enable xinet.d to run when you enable. Sorry but not using Ubuntu, I don't know if, and debian use runlevels 3 & 5. You can read your /etc/inittab file for the answer. Mine looks like this:
Code:
# /etc/init.d/rc takes care of runlevel handling
#
# runlevel 0  is  System halt   (Do not use this for initdefault!)
# runlevel 1  is  Single user mode
# runlevel 2  is  Local multiuser without remote network (e.g. NFS)
# runlevel 3  is  Full multiuser with network
# runlevel 4  is  Not used
# runlevel 5  is  Full multiuser with network and xdm
# runlevel 6  is  System reboot (Do not use this for initdefault!)
On some systems you can use "chkconfig" to check or set the runlevels that a daemon runs on:
Code:
/sbin/chkconfig -l xinetd
xinetd                    0:off  1:off  2:off  3:on   4:off  5:on   6:off
Also see if you have some pdf or postscript files in your samba documentation. /usr/share/doc/samba-<version>/ or /usr/share/doc/packages/samba/. It may contain 3 or 4 books that can help you configure samba. One of them is "Samba 3 by Example". On of the first example configurations may be what you want.

Different distro's package things differently, so you may have a samba-doc package that supplies these books. Also, you may need to install a separate package maybe named samba-swat to get swat.

Good Luck!

Last edited by jschiwal; 07-14-2007 at 12:33 AM.
 
Old 07-14-2007, 12:26 AM   #3
damiendusha
LQ Newbie
 
Registered: Jun 2006
Location: Brisbane, Australia
Distribution: Ubuntu 8.04
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal
You have it backwords. You mount the filesystems found on a device on a directory, not the other way around.

Linux like Unix uses a hierarchal file structure. There is a root file system and all other filesystems are mounted on directories or subdirectories under root. So all you need to do is create a /media directory and use that.
Wow... fast reply, thanks

My stuff-up with /media.... let's call it /music instead.

My / resides on /dev/sda1. If if mkdir /music, then it will be located on the single HDD, not the RAID array. I'd rather it reside on /dev/md0. But I already have /dev/md0 mounted at /home.

Is there a way to have my cake and eat it too?
 
Old 07-14-2007, 06:02 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Since you already are using md0 for the /home directory, you can create a /home/music directory and share that directory as [Music] in samba. This isn't a lot different then how some distro's setup a /home/samba share. When someone browses to your server, they will see a "music" shared directory.
Have fun eating your cake.
 
Old 07-14-2007, 07:12 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I think this has been covered, but:

You can mount (connect) a device to multiple directories (mount points). The device will be accessible from each mount point.

You can mount multiple devices to one directory. You can only access, however, the last device mounted.

Thus, you have unlimited opportunities to confuse your users---and yourself......
 
Old 07-14-2007, 11:58 AM   #6
ak_random
Member
 
Registered: Jun 2007
Location: Silicon Valley, CA
Distribution: Xubuntu
Posts: 83

Rep: Reputation: 15
If you want to avoid doing something like /home/media, I think your other choice is to use some sort of partition manager to make a little room on /dev/md0 in order to create a new partition (i.e., /dev/md1) that you can use for mounting /media or whatnot. That said, I think it would be easier to create /home/media and have a symlink at /media pointing to it.
 
Old 07-14-2007, 01:38 PM   #7
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by ak_random
I think it would be easier to create /home/media and have a symlink at /media pointing to it.
That is what I would do.

But I wouldn't name it "media" because many current distros use /media as a mounpoint directory for removable media.

Calling it "music" would be a better plan.
 
Old 07-16-2007, 04:57 AM   #8
damiendusha
LQ Newbie
 
Registered: Jun 2006
Location: Brisbane, Australia
Distribution: Ubuntu 8.04
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jiml8
That is what I would do.

But I wouldn't name it "media" because many current distros use /media as a mounpoint directory for removable media.

Calling it "music" would be a better plan.
Agreed. It's nice and easy to share homes using Samba.

Thank you all.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with portforwarding on a single device gambitrogue Linux - Networking 2 01-31-2007 05:28 AM
Copying a single file to multiple directories quest49 Linux - Software 6 12-04-2006 08:07 AM
single device - multiple icons on desktop pringle1944 Linux - Newbie 1 03-17-2006 06:09 PM
Mounting a single folder george_mercury Linux - General 2 07-06-2004 05:46 PM
Copying a single file to multiple directories tgolly Linux - Newbie 3 04-26-2004 03:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration