LinuxQuestions.org
Help answer threads with 0 replies.
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, 03:58 PM   #1
Altiris
Member
 
Registered: Mar 2013
Posts: 555

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, 05:30 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
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, 05:57 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
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, 06:14 PM   #4
Altiris
Member
 
Registered: Mar 2013
Posts: 555

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, 06:26 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
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, 07:48 PM   #6
Altiris
Member
 
Registered: Mar 2013
Posts: 555

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, 10:24 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,388

Rep: Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416Reputation: 1416
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, 10:51 PM   #8
Altiris
Member
 
Registered: Mar 2013
Posts: 555

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, 02:16 AM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
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, 10:08 AM   #10
Altiris
Member
 
Registered: Mar 2013
Posts: 555

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, 09:11 PM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

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

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, 06:55 PM   #13
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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, 12:49 PM   #14
Altiris
Member
 
Registered: Mar 2013
Posts: 555

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 03:45 PM.
 
Old 10-26-2013, 04:59 PM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

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


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

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

All times are GMT -5. The time now is 07:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration