LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-30-2009, 01:05 PM   #1
callasabra
LQ Newbie
 
Registered: Jan 2009
Distribution: Ubuntu 9.10
Posts: 15

Rep: Reputation: 0
fstab: How to mount specific directories to other partitions?


I thought I was fairly proficient with fstab but I have encountered an issue beyond me. Let me hear your thoughts.

in fstab I have a partitions mounted as such:

/dev/sda4 /media/storage vfat ...

/dev/sda2 /home ext3 ...

I want to mount /home/user/downloads to /media/storage/downloads

I have tried several combinations and suggestions from man, to no avail.

NOTE: I am also working on a tutorial for fstab and I want to cover this in the tutorial so your help will be greatly appreciated.

Thanks
 
Old 10-30-2009, 01:39 PM   #2
MQMan
Member
 
Registered: Jan 2004
Location: Los Angeles
Distribution: Slack64 14.1
Posts: 576

Rep: Reputation: 38
From the fstab man page:
Code:
       The bind mounts.
              Since  Linux  2.4.0  it  is possible to remount part of the file
              hierarchy somewhere else. The call is
                     mount --bind olddir newdir
              or fstab entry is:
                     /olddir  /newdir  none  bind

              After this call the same contents is accessible in  two  places.
              One can also remount a single file (on a single file).

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

              Note  that  the filesystem mount options will remain the same as
              those on the original mount point,  and  cannot  be  changed  by
              passing the -o option along with --bind/--rbind.
Cheers.
 
Old 10-30-2009, 02:29 PM   #3
callasabra
LQ Newbie
 
Registered: Jan 2009
Distribution: Ubuntu 9.10
Posts: 15

Original Poster
Rep: Reputation: 0
Thank you for your reply. I found that in the man pages but at first glance did not think it was relevant to what I wanted. I did try it:

/dev/sda2/home/user/downloads /media/storage/downloads none bind

however when I run mount -a I get this error:

/dev/sda2/home/user/downloads does not exist.

what am I doing wrong?

EDIT:

I figured out what I was doing wrong. I should not use "
/dev/sda2/home/user/downloads" instead only use "/home/user/downloads"

NOTE: that whatever is in /media/storage/downloads will be lost and the contents of /home/user/downloads copied to the new dir.

Thanks for your help.

Last edited by callasabra; 10-30-2009 at 02:34 PM. Reason: figured it out
 
Old 10-30-2009, 04:51 PM   #4
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Just for curiosity why not just use a link(hard or soft)?
 
Old 10-31-2009, 05:05 AM   #5
callasabra
LQ Newbie
 
Registered: Jan 2009
Distribution: Ubuntu 9.10
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lazlow View Post
Just for curiosity why not just use a link(hard or soft)?
Not sure what you mean by a link? If a link would work better I am up for it.

I am essentially wanting to "sync" download directories between two OSes (linux and windows). I have tried to point firefox to the "storage" partition as the download dir but it doesn't save there (my guess is a permission issue).

If a link would work better, how would I go about setting it up?

Thanks.
 
Old 10-31-2009, 05:37 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680Reputation: 680
Look at the mount manpage. For a fat32 partition you would use "uid" to change ownership, "gid" for group ownership, and "fmask" and "dmask" for setting the permissions. This is done when the partition is mounted and all files will have the same permissions. All directories will have the same permissions.

Also look at the manpage for link. You need to create a symbolic link in the Linux directory which points to the place the directory is mounted.

Another option is to simply mount the fat32 filesystem where you want it "/home/user/downloads". However you can't save to both filesystems.
You can use the Windows filesystem in Linux, mounted where you want to use it, and then when running Windows, you will have access to the files.

Last edited by jschiwal; 10-31-2009 at 06:14 AM.
 
Old 10-31-2009, 08:53 AM   #7
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
You can look at man link or man ln. In RH based systems (gnome) you can just right select the directory you want to make a "connection" to and select Make link. It will generate the link. You can then place that link wherever you like. It will appear just like any other sub directory. Think of it simply as a short cut. You can do the same thing with files.
 
Old 11-01-2009, 05:34 AM   #8
callasabra
LQ Newbie
 
Registered: Jan 2009
Distribution: Ubuntu 9.10
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks to everyone who as replied.

I always enjoy learning something new in linux
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Way to make autofs mount to specific USB flash drive to specific folder? utahnix Linux - Software 2 11-24-2010 05:27 PM
fstab entry to manually mount ntfs partitions james2b Linux - Newbie 11 12-17-2008 05:09 AM
mount directories of partitions, not partitions possible? kpachopoulos Linux - General 9 09-02-2007 07:25 PM
fstab will not mount partitions n926bb Fedora 29 06-14-2006 12:55 PM
Mount UFS partitions (not slices) from linux /etc/fstab JZL240I-U *BSD 6 04-26-2006 01:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:58 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