Auto Mount Partitions on Boot (also Windows partitions)

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby SpudGun on Wed Feb 24, 2010 4:24 am

I've just come out of the woodwork to suggest a crazy little utilitie, disk-manager from debian sid repo http://packages.debian.org/unstable/disk-manager
This tool will add new drives to fstab just by putting a tick in a box :D How cool is that. I was using it in debian lenny with no problems at all, and i was a bit disapointed not to find it in the mint/buntu repo, so i grabbed it from the sid repo and it installed fine, i didn't need any extras.

I think disk-manager is the answer to everyones prayers :wink:
SpudGun
 

Linux Mint is funded by ads and donations.
 

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby hemimaniac on Wed Feb 24, 2010 9:14 am

sounds like a small improvement over pysdm (gui disk manager from the repos), its a nice gui disk manager that edits the fstab, but there are still a couple places the absolute n00b can still go wrong with it
"Linux allows for one thing above all else - 'A user can truly be themselves!'"
Image
User avatar
hemimaniac
Level 5
Level 5
 
Posts: 508
Joined: Thu Feb 04, 2010 1:26 pm
Location: London ON

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Wed Feb 24, 2010 9:42 am

SpudGun wrote:
I've just come out of the woodwork to suggest a crazy little utilitie, disk-manager from debian sid repo http://packages.debian.org/unstable/disk-manager

Be careful doing this. The Ubuntu and Debian repos are not binary compatible. If the utility is written in an interpreted language like python and doesn't reference something that isn't there in Ubuntu or Mint then it will work. Mixing repos will get you a broken system if you aren't very careful. :-)

As far as why I suggest using the CLI to set up mounting, it always works correctly. There are lots of stand alone utilities and file managers that will provide this functionality, but most are buggy in one way or another. Using the CLI is universal to all the flavors of Mint, and others, and is proven to give consistent and flexible auto mounting.

Learning to do it from the CLI will serve you well in the long run. :-)

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby aelfinn on Tue Apr 06, 2010 11:12 am

I have a problem related to this topic. My partitions are mounted as follows.

Code: Select all
/dev/sda2 on / type ext4 (rw,errors=remount-ro,commit=5)
/dev/sda3 on /home type ext4 (rw,commit=5)
/dev/sda4 on /media/Data type ext4 (rw)

Thing is, I can't write anything to "Data" (Permission denied), except when using su privileges. The relevant line in fstab is

Code: Select all
/dev/sda4/ /media/Data ext4 defaults 0 0

Any pointers would be much appreciated! :)
LM15 C64
Acer Aspire 1810TZ
aelfinn
Level 3
Level 3
 
Posts: 188
Joined: Thu Dec 11, 2008 2:11 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Tue Apr 06, 2010 12:01 pm

All entries in fstab mount as owned by root. For windows filetypes ( FAT32 or NTFS ) you can change ownership and permissions in fstab itself. But for linux filesystems you have to change these things after they are mounted. You've got many choices depending on your setup.

For example:

Open Terminal
Type sudo chown -R altair:plugdev /media/Data

This will change owner:group from root:root to altair:plugdev.
Note: By default all local login users are members of the plugdev group.


OR,

Open Terminal
Type sudo chmod -R 0777 /media/Data

This will keep the owner:group as root:root but change permissions to allow everyone read / write access.

OR, an almost infinite combination of the above.

Please note that the "-R" option above stands for "recursive" meaning it will change ownership or permissions on all folders and files within that mountpoint. If it's truly just a Data partition then that may be what you want it to do. If it's another linux install then you just messed up the permissions on that install. If the Data partition holds a backup of your system and you wanted it to preserve permissions it also got messed up. In these cases you might want to leave off the "-R" options so the commands look like this:

sudo chown altair:plugdev /media/Data
sudo chmod 0777 /media/Data

This will change ownership and/or permissions of the mount point ( users will be able to add or delete within that mount point ) but preserve them on the enclosed files.

Did I say make any mistakes, Fred? :wink:
Last edited by altair4 on Tue Apr 06, 2010 6:25 pm, edited 1 time in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5925
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby aelfinn on Tue Apr 06, 2010 2:33 pm

altair4 wrote:All entries in fstab mount as owned by root.

And that cannot be influenced with the "user(s)" or "group" mount options?

Would the chmod changes have to be applied every time I log in? Or is there a way to mount the partition other than via fstab, so that the appropriate permissions can be set at mount time?
LM15 C64
Acer Aspire 1810TZ
aelfinn
Level 3
Level 3
 
Posts: 188
Joined: Thu Dec 11, 2008 2:11 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Tue Apr 06, 2010 2:44 pm

On Windows file systems you can use umask, uid and gid to set the permissions and ownership at mount time in fstab.

EDIT: For example using freds template for ntfs:
/dev/sdxx /home/fred/Windows ntfs defaults,umask=007,gid=46 0 0


umask=007 allows owner (first digit) and group (second digit) to have full read write access. All others (the third digit) will have no access.
gid=46 is the group id. 46 is plugdev and all local login users are in group plugdev.
What's not explicit is that the owner is root.
So if you combine them all you will mount an NTFS partition with owner = root, group = plugdev, with read / write permissions to owner and group and no one else.

Fred could have added one more option: uid=1000. That would have changed the default owner of root to fred (1000).
But since fred is also in plugdev it is not needed.


On Linux file systems they are done after you mount it with chmod and chown and they are persistent. So once you change ownership and / or permissions you don't have to do it again.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5925
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Fred on Tue Apr 06, 2010 6:15 pm

altair4,

Nicely put sir. :-)

+1

Fred
Insanity: Doing the same thing over and over and each time expecting a different result.

Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.
User avatar
Fred
Level 10
Level 10
 
Posts: 3356
Joined: Fri Jan 04, 2008 11:59 am
Location: NC USA

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby aelfinn on Tue Apr 06, 2010 6:51 pm

Thanks very much.
LM15 C64
Acer Aspire 1810TZ
aelfinn
Level 3
Level 3
 
Posts: 188
Joined: Thu Dec 11, 2008 2:11 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Chacalo on Sat Apr 24, 2010 10:39 pm

Thanks Fred! :)
User avatar
Chacalo
Level 1
Level 1
 
Posts: 6
Joined: Sat Apr 24, 2010 9:25 pm
Location: Buenos Aires, Argentina.

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby masoko on Tue May 25, 2010 11:56 pm

how to automount an ext4 partition?

masoko@masoko-desktop ~ $ sudo blkid
/dev/sda1: UUID="aa477409-4e71-42b9-9720-32d43956e57e" TYPE="ext4"
/dev/sda5: UUID="4375978c-7bcc-450f-8e8a-e1d4ccaf19c8" TYPE="swap"
[b]/dev/sdb1: LABEL="Slave" UUID="0d9fdc27-c4bc-4523-8b48-480d1dde1a20" TYPE="ext4"[/b] this is

Thanks in advance!
User avatar
masoko
Level 1
Level 1
 
Posts: 15
Joined: Thu Mar 25, 2010 4:06 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby mick55 on Tue May 25, 2010 11:59 pm

Read the tutorial and where it says ext3 put ext4 instead.
Things are more like they are now than they ever were before.

Dwight D. Eisenhower (1890 - 1969)
User avatar
mick55
Level 7
Level 7
 
Posts: 1507
Joined: Fri Sep 25, 2009 2:47 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby masoko on Wed May 26, 2010 1:41 am

It worked very well,thanks! and how do I give permission to this hard drive, so I can give it format when I need to? when I try to change permissions it just says "The permissions of "..." could not be determined" :(
User avatar
masoko
Level 1
Level 1
 
Posts: 15
Joined: Thu Mar 25, 2010 4:06 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby mick55 on Wed May 26, 2010 2:56 am

You don't need to change the drive permissions to format.

When you run a utility like the partition editor (gparted) you run it with elevated rights
so the permissions of the drive are irrelevant. You can format the drive/partition
in gparted as well as define partitiions.If you do not have gparted installed, you
can install it by running this command in a terminal
Code: Select all
sudo apt-get install gparted

After you install it, it will appear on your menu or press Alt+f2 and type gparted.
Things are more like they are now than they ever were before.

Dwight D. Eisenhower (1890 - 1969)
User avatar
mick55
Level 7
Level 7
 
Posts: 1507
Joined: Fri Sep 25, 2009 2:47 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Luposz on Thu Jan 27, 2011 12:26 pm

Hello =3
Thanks for this little tuto
My question is... How do you undo that?
I mess up the first time and everytime I restart it says that the device it's not ready to be mounted >_<
User avatar
Luposz
Level 1
Level 1
 
Posts: 9
Joined: Wed Jan 26, 2011 8:16 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Fri Jan 28, 2011 7:48 am

If you can still login into your Mint system edit the fstab file and comment out the line by placing a # sign in front of it:
gksu gedit /etc/fstab

And change something like this:
/dev/sda1 /media/WinC ntfs defaults,nls=utf8,umask=007,uid=1000,gid=46 0 0

To this:
#/dev/sda1 /media/WinC ntfs defaults,nls=utf8,umask=007,uid=1000,gid=46 0 0
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5925
Joined: Tue Feb 03, 2009 10:27 am

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby Luposz on Sat Jan 29, 2011 2:15 am

Thanks a lot =D!!
It worked =3
I can delete those lines, right?
User avatar
Luposz
Level 1
Level 1
 
Posts: 9
Joined: Wed Jan 26, 2011 8:16 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Sat Jan 29, 2011 8:26 am

Luposz wrote:Thanks a lot =D!!
It worked =3
I can delete those lines, right?

Yes, the only reason for the # was to "comment out" the offending line so it wouldn't execute on boot. Wasn't sure if you wanted to go back and fix the error or start over again.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5925
Joined: Tue Feb 03, 2009 10:27 am

re: messed up fstab

Postby intoxicant1 on Sat Feb 05, 2011 12:05 am

I messed up fstab, now mint will not boot. error message says partition not ready or not found. It asks if I want to Skip or Manually repair. Either option nets endless boot loader dots, never boots. I have been using mint for awhile but am not very adept at command line, use gui mostly. Any help would be greatly appreciated, I really don't want to reload O.S.
intoxicant1
Level 1
Level 1
 
Posts: 5
Joined: Tue Sep 22, 2009 9:38 pm

Re: Auto Mount Partitions on Boot (also Windows partitions)

Postby altair4 on Sat Feb 05, 2011 9:00 am

Boot into your Mint Install DVD and use it as a rescue DVD:

Select "Computer" from the desktop
Select the "Hard Disk" that holds your Mint OS.
Right click on /etc/fstab and select "Open as Administrator"
Edit fstab by placing a # sign in front of the offending line like I described above.
Save fstab, remove the Install DVD, and reboot your system.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
altair4
Level 15
Level 15
 
Posts: 5925
Joined: Tue Feb 03, 2009 10:27 am

Linux Mint is funded by ads and donations.
 
PreviousNext

Return to Tutorials / Howtos

Who is online

Users browsing this forum: Chriskmint and 7 guests