LinuxQuestions.org
Review your favorite Linux distribution.
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 08-23-2013, 02:58 PM   #1
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Rep: Reputation: Disabled
Automatic Mount of Partitions on bootup?


In order to access my 2nd partition via Samba I have to first mount the partition manually and then type in the root password. After that I need to navigate to it and run the command "setsebool -P samba_export_all_rw on". THEN I can read/write to it on Samba.

I would like to make it so CentOS automatically mounts my 2nd partition. The partition name is /media/496GB_Filesystem
 
Old 08-23-2013, 04:30 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

you can have this file system automatically mounted by adding a line to your /etc/fstab. You should probably store the samba password in a credentials file.

Eg in your fstab
Code:
//192.168.1.111/media/496GB_Filesystem /mount/point/foo cifs credentials=/root/.cifs.conf 0 0
I'm just guessing an IP for the samba server and for the mount point. The credendials file should contain something like:
Code:
username=someuser
password=somepassword
Presumably you can configure selinux so that the explicit call to setsebool is not required, but don't use selinux so I can't help.

Evo2.
 
1 members found this post helpful.
Old 08-23-2013, 04:57 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You only need the "setsebool -P..." once. the -P option directs it to make existing configuration flags persistent across boots.
 
1 members found this post helpful.
Old 08-23-2013, 05:14 PM   #4
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
You only need the "setsebool -P..." once. the -P option directs it to make existing configuration flags persistent across boots.
Oh yes you are correct, I thought I had to do this on startup because (and I noticed now) that my Samba share command had -P on it but for my FTP it didnt, it just had the setseboll command. Alright so basically I need to write somethig on the fstab document? I just want it to simply mount on startup like the main partition does, how do I do this?
 
Old 08-23-2013, 05:26 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,
Quote:
Originally Posted by Altiris View Post
I just want it to simply mount on startup like the main partition does, how do I do this?
See my previous post.

Evo2.
 
Old 08-23-2013, 06:48 PM   #6
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by evo2 View Post
Hi,

See my previous post.

Evo2.
Okay, although I'm a bit confused. I need an IP in order to mount it? And then I don't understand the end part either, sorry I am a little new when it comes to commands.
 
Old 08-23-2013, 09:24 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,546

Rep: Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497Reputation: 2497
You indicate in your initial post that you want to mount your "2nd partition". Why are you using Samba? Samba is for networking different computers. If the partition is on the same drive and computer you just need to create a mount point for it and mount it. If it is an ntfs partition you can use the search function here at LQ which will show you numerous examples of entries in fstab for a windows partition.

If this isn't the case, same computer/same drive then explain what you are doing.
 
Old 08-23-2013, 09:51 PM   #8
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
You indicate in your initial post that you want to mount your "2nd partition". Why are you using Samba? Samba is for networking different computers. If the partition is on the same drive and computer you just need to create a mount point for it and mount it. If it is an ntfs partition you can use the search function here at LQ which will show you numerous examples of entries in fstab for a windows partition.

If this isn't the case, same computer/same drive then explain what you are doing.
I thought I was clear in OP but I shall restate again . So basically I want to be able to access my 2nd partition (which I use to backup my main PC) through Samba (meaning on my main windows PC, clicking "Network" and connecting to the CentOS Server). I can already do this except everytime at boot up on the CentOS computer I need to mount the 2nd partition manually. I just want a way to have CentOS to mount the 2nd partition automatically on bootip. If you still do not understand just forget about the whole Samba thing and just focus on "making CentOS mount a second partition on bootup.
 
Old 08-24-2013, 01:16 AM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The /etc/fstab is how you do this.

An entry something like:

UUID=<string-of-hex-digits> <mount-point> <filesystem-type> defaults 0 0

You can use the "blkid" utility to identify your "second partition", the <string-of-hex-digits>, and the <filesystem-type>

The UUID is used to identify the partition because the device name can change depending on what happens to be plugged in at boot time.
 
Old 08-24-2013, 09:08 AM   #10
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
The /etc/fstab is how you do this.

An entry something like:

UUID=<string-of-hex-digits> <mount-point> <filesystem-type> defaults 0 0

You can use the "blkid" utility to identify your "second partition", the <string-of-hex-digits>, and the <filesystem-type>

The UUID is used to identify the partition because the device name can change depending on what happens to be plugged in at boot time.
Okay so for me it would be
UUID=12345 /media/496GB_Filesystem ext4 defaults 0 0

12345 is the uuid for an example. If I don't do /media, so I do the /dev/sda2 instead?
 
Old 08-24-2013, 08:11 PM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
No, the second entry is the mount point, not a device name.
 
Old 08-25-2013, 11:36 AM   #12
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Original Poster
Rep: Reputation: Disabled
Alright I did it and I had a [FAILED] error on bootup saying that the partition was read-only (I set one of my accounts as the owner is this maybe why?). It then said I couldnt mount it as read-only.
 
Old 08-25-2013, 05:55 PM   #13
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Can you post what you actually put in your /etc/fstab? That might help to debug. What happens when you try to do "mount /media/496GB_Filesystem" from the command line?
 
Old 10-26-2013, 11:49 AM   #14
Altiris
Member
 
Registered: Mar 2013
Posts: 556

Original Poster
Rep: Reputation: Disabled
Sorry for the super late reply. Here is what I put in my fstab file between the first partition and then the swap. (I have 3 partitions total, two 495GB partitions and 8gb for swap).

UUID=UUIDHERE /dev/sda2 ext4
defaults 0 0

I forgot to mention this but centos requires that the root password be inputted when trying to mount any type of partition. This means that the partitWRT54Gion needs to somehow be mounted as root. I rebooted my centos box and I got an error on the login page saying that only the root could mount /dev/sda2 and that so it was only mounted as read only, the partition does not show up in the file browser and I also can't navigate to it.

I need fstab to mount the partition as root it seems.

Last edited by Altiris; 10-26-2013 at 02:45 PM.
 
Old 10-26-2013, 03:59 PM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
If you have the UUID specification you don't use the /dev/sda2 specification - it causes an error.
 
  


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
Retrieving partitions at bootup eddieparker38 Linux - Newbie 1 05-05-2011 05:57 PM
mem=512mb automatic at bootup linuxisgreat Linux - General 5 12-13-2008 04:44 AM
Can't mount partitions from HDA, But will mount partitions from HDB Colonel-1990 Linux - Hardware 13 08-09-2008 09:59 AM
FC-8, how to stop win partitions from automatic mount prabhatsoni Linux - Software 4 04-23-2008 01:15 AM
FYI: Automatic login works only one time after bootup taylorkh Ubuntu 2 03-05-2008 08:10 AM

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

All times are GMT -5. The time now is 09:41 AM.

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