Auto Mount Partitions on Boot (also Windows partitions)

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
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 intoxicant1 » Mon Feb 07, 2011 4:46 pm

Thanks very much altair4,
should have thought of that myself.
corrected the fstab and got my partition to auto mount correctly.

very much appreciated!

User avatar
Fandangio
Level 4
Level 4
Posts: 367
Joined: Fri Dec 10, 2010 2:20 am
Location: Manchester, UK

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

Postby Fandangio » Tue Feb 22, 2011 2:17 am

Thank you Fred,

a very useful and easy to follow guide!
AMD Phenom (tm) II x4 965 | 4GB DDR3 | NVIDIA GTS 450 4GB DDR3 | ASUS M4A88T-M

impressme
Level 1
Level 1
Posts: 1
Joined: Tue Apr 12, 2011 4:47 am

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

Postby impressme » Tue Apr 12, 2011 4:56 am

What would be the best method to auto mount SMB shares on boot? There appear to be two options, either 'smbfs' or 'cifs'. My concern though is that authentication is required when accessing my SMB shares, and it looks like I have to enter my required username and password in plain text in the fstab file! That's a big concern. Is there a way to do this securely?

An example SMB share I'd like to auto mount:

smb://WHS/Common

Thanks for any suggestions, great thread!

Regards.

altair4
Level 17
Level 17
Posts: 7827
Joined: Tue Feb 03, 2009 10:27 am

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

Postby altair4 » Tue Apr 12, 2011 7:25 am

@impressme, this HowTo does not cover remote Samba shares. You really should start your own thread for this. I can offer you some things to consider though.
There appear to be two options, either 'smbfs' or 'cifs'.

THe "smbfs" thing is kind of complicated. Once upon a time there used to be a filesystem / protocol named smbfs and if you are looking at very old howto's they will use that in their fstab entries. It has been replaced by cifs. The confusing part is that in the repositories there is a package named smbfs which is a meta-package that contains a lot of stuff that makes cifs work and should be installed. Like I said it's confusing.
My concern though is that authentication is required when accessing my SMB shares, and it looks like I have to enter my required username and password in plain text in the fstab file!

Yes and no. You could for example have a statement like this:
//WHS/Common /media/Common cifs username=altair,password=secret,uid=1000 0 0

You're right, the credentials are in plain text in fstab.
But you could also do it this way:
//WHS/Common /media/Common cifs credentials=/path_to/.creds,uid=1000 0 0

The "/path_to/.creds" would be set up first as a hidden file accessible only to root and contain the username and password. It will have more security but it will still be in plain text - just not in fstab.

The other method which is the most secure is gvfs. With that the password is kept in an encrypted file ( Gnome Keyring ) by the OS itself. Here's two HowTo's on that method:
Auto Mount Samba Shares on Boot ( GVFS Method ): viewtopic.php?f=42&t=42713
HowTo: Using Gigolo to Mount Remote Samba Shares: viewtopic.php?f=42&t=52144
Gigolo is the easiest to use since it's all graphical and has other benefits.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

AlbertP
Level 16
Level 16
Posts: 6703
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

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

Postby AlbertP » Wed Apr 13, 2011 5:00 am

An NTFS partition on the same harddisk failed to mount during boot using its UUID, but when mounting with /dev/sda3 instead of UUID was no problem.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.

mythicalmonster
Level 1
Level 1
Posts: 8
Joined: Sat Jul 16, 2011 10:33 pm

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

Postby mythicalmonster » Tue Jul 19, 2011 11:11 pm

Hi Fred,

Please help! I followed this tutorial, and have now stuffed up my hard-drive thing! I am a beginner, and I'm afraid this is not mycomputer so kinda screwed. I tried the CLI to mount the drive, no joy so then I tried the GUI. THe hard drive is now completely unaccessible! HELP

m

altair4
Level 17
Level 17
Posts: 7827
Joined: Tue Feb 03, 2009 10:27 am

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

Postby altair4 » Wed Jul 20, 2011 6:39 am

mythicalmonster wrote:Hi Fred,

Please help! I followed this tutorial, and have now stuffed up my hard-drive thing! I am a beginner, and I'm afraid this is not mycomputer so kinda screwed. I tried the CLI to mount the drive, no joy so then I tried the GUI. THe hard drive is now completely unaccessible! HELP

m

Please post the output of the following commands so we can all determine the source of the problem:

Code: Select all

sudo blkid -c /dev/null

Code: Select all

cat /etc/fstab

Code: Select all

mount
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

gosa
Level 4
Level 4
Posts: 302
Joined: Mon Nov 01, 2010 5:12 am
Location: Spain

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

Postby gosa » Sat Sep 10, 2011 4:10 pm

Hi all,

I kind of ran into a problem following this guide, and I'm not sure on how to "get out of it"...

I have - among a few other - one 1,5TB hard drive partitioned into three parts labeled "files" (sdd1), storage (sdd2) and backup (sdd3). My idea was to "move" the location of "Downloads", Music" & Videos" from /home to the "files"-partition by mounting "files", creating the corresponding folders and putting symlinks in /home.
- This works perfectly.

I also want the partition "storage" which is an ntfs volume to automount at boot, and my plan is for that volume (being almost 800GB large) to be the "storage space that my install of Windows 7 shares with LMDE (hence the ntfs, otherwise I would've made it into ext4)

This is where I fail. I created a mount point in /home with the help of the instructions in the OP of this thread.
I made sure I (gosa) have the rights to read and write to the volume by running:

Code: Select all

sudo chown -R user /media/files

(got it from this thread, have no idea if it is correct http://forums.linuxmint.com/viewtopic.php?f=47&t=44756&start=0)

My problem is that when rebooting the computer, and opening Nautilus I can't find the volume "storage" as an available drive. If I navigate to /media I do see it, but the folder icon has an X in it, and I can't open it (message says "You do not have the permissions necessary to view the contents of "storage".)

If I right-click the folder icon for "storage" and look at the permissions thay still say that the only one with right to the folder/volume is "root".

So what now? What did I miss?

Here is the output when I run sudo blkid:

Code: Select all

/dev/sda1: LABEL="EFI" UUID="70D6-1701" TYPE="vfat"
/dev/sda2: UUID="cdcd9028-452b-32a8-be06-876f1692a786" LABEL="Snow Leopard" TYPE="hfsplus"
/dev/sda3: LABEL="Virtualbox" UUID="F0E652F1E652B814" TYPE="ntfs"
/dev/sdb1: LABEL="swap" UUID="7c429524-3fa2-4022-9ca1-ccf9d651b9f3" TYPE="swap"
/dev/sdc1: UUID="489CB4C19CB4AAB8" TYPE="ntfs"
/dev/sdc2: UUID="E870B0B970B09034" TYPE="ntfs"
/dev/sdc3: LABEL="Win 7 Storage" UUID="96C4C259C4C23AEF" TYPE="ntfs"
/dev/sdb2: UUID="25311594-ef13-45b1-8c1e-414e37c522c1" TYPE="ext4"
/dev/sdb3: UUID="3e9ad51d-a502-4d0b-b790-c2fb79252f98" TYPE="ext4"
/dev/sdd1: LABEL="files" UUID="4a5e3e59-d65a-455b-b3db-3b90c1ca6572" TYPE="ext4"
/dev/sdd2: LABEL="storage" UUID="58DBE5CB2F80A2DF" TYPE="ntfs"
/dev/sdd3: LABEL="backup" UUID="595239EE18A59F3C" TYPE="ntfs"
/dev/sde1: LABEL="Transition" UUID="2C62-01CD" TYPE="vfat"
/dev/sdm1: LABEL="Transition HD" UUID="5DCDC7535F26C2D7" TYPE="ntfs"
/dev/sdl1: LABEL="TV" UUID="264246FD4246D16B" TYPE="ntfs"
/dev/sdn1: LABEL="New Volume" UUID="277E-F194" TYPE="vfat"


And here is my fstab:

Code: Select all

proc   /proc   proc   defaults   0   0
# /dev/sdb1
UUID=7c429524-3fa2-4022-9ca1-ccf9d651b9f3   swap   swap   sw   0   0
# /dev/sdb2
UUID=25311594-ef13-45b1-8c1e-414e37c522c1   /   ext4   rw,errors=remount-ro   0   0
# /dev/sdb3
UUID=3e9ad51d-a502-4d0b-b790-c2fb79252f98   /home   ext4   rw,errors=remount-ro,user_xattr   0   0

/dev/sdd1 /media/files ext4 defaults,noatime 0 2
/dev/sdd2 /media/storage ntfs defaults,umask=007,gid=46 0 0


Bonus question - Why does my terminal say this when I right-click and choose "open in terminal" when in /media:
(look at the lmde meiia #)

Code: Select all

gosa@lmde /media $ sudo su
[sudo] password for gosa:
lmde meiia #



Thanks in advance,
/gosa

altair4
Level 17
Level 17
Posts: 7827
Joined: Tue Feb 03, 2009 10:27 am

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

Postby altair4 » Sat Sep 10, 2011 4:33 pm

I couldn't quite follow all of that but I think I can help you with one problem:
My problem is that when rebooting the computer, and opening Nautilus I can't find the volume "storage" as an available drive.

You won't see it on the left side panel of Nautilus because it's mounted. Only unmounted partitions show up there. If you want to see it there then Bookmark it.
If I navigate to /media I do see it, but the folder icon has an X in it, and I can't open it (message says "You do not have the permissions necessary to view the contents of "storage".)

This HowTo was written with Ubuntu based Mint in mind not LMDE. There is nothing wrong with this line in fstab:
/dev/sdd2 /media/storage ntfs defaults,umask=007,gid=46 0 0

Except that in Ubuntu-Mint all new users are members of the plugdev group ( gid=46 ) by default. In Debian they are not. So if you can add yourself to the plugdev group:

Code: Select all

sudo gpasswd -a gosa plugdev

Then logout and login again for the group membership to take affect it should work.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

gosa
Level 4
Level 4
Posts: 302
Joined: Mon Nov 01, 2010 5:12 am
Location: Spain

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

Postby gosa » Sat Sep 10, 2011 4:38 pm

altair4 wrote:This HowTo was written with Ubuntu based Mint in mind not LMDE. There is nothing wrong with this line in fstab:
/dev/sdd2 /media/storage ntfs defaults,umask=007,gid=46 0 0

Except that in Ubuntu-Mint all new users are members of the plugdev group ( gid=46 ) by default. In Debian they are not. So if you can add yourself to the plugdev group:

Code: Select all

sudo gpasswd -a gosa plugdev

Then logout and login again for the group membership to take affect it should work.


And that worked like a charm...

Thanks a lot for your quick help.

/gosa

DeanoBravo2zero
Level 1
Level 1
Posts: 9
Joined: Sun Sep 11, 2011 5:15 am
Location: UK

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

Postby DeanoBravo2zero » Sun Sep 18, 2011 4:38 am

Hi

I have run the following cli recently to auto mount my windows partition ( witch was win7 32bit)

mkdir /home/me/Windows

sudo su

echo "/dev/sda2 /home/me/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab

The above commands worked like a dream for the win7 32bit.
Then two days ago i upgraded win7 32bit to win7 64bit and carried out a fresh install of mint 11 (katya)
and ran the above commands again.

The windows partition auto mounted on my Home, but when i try to read the contents of the win partiton. i get nothing.

Code: Select all

me@me-System-Product-Name ~ $ sudo blkid -c /dev/null
[sudo] password for me:
/dev/sda1: LABEL="System Reserved" UUID="50B4C36DB4C3545E" TYPE="ntfs"
/dev/sda2: UUID="8E4EDC344EDC1735" TYPE="ntfs"
/dev/sda5: UUID="e0816cb8-23eb-45cf-803c-76e7608dc420" TYPE="ext3"
/dev/sda6: UUID="30a47fd4-c169-4483-851c-b9596f18b18e" TYPE="ext3"
/dev/sda7: UUID="c9fe47c2-85ff-4393-86a4-773f81861bcb" TYPE="ext3"
/dev/sda8: UUID="31b05315-b9f3-4a32-89e0-efe697ca0e01" TYPE="ext3"
/dev/sda9: UUID="a014c50a-056c-4851-9f5f-954b81a5f669" TYPE="ext3"
/dev/mapper/cryptswap1: UUID="d5162753-6078-492f-abf6-59a98e10cd06" TYPE="swap"


Code: Select all

me@me-System-Product-Name ~ $ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda6 during installation
UUID=30a47fd4-c169-4483-851c-b9596f18b18e /               ext3    errors=remount-ro 0       1
# /boot was on /dev/sda5 during installation
UUID=e0816cb8-23eb-45cf-803c-76e7608dc420 /boot           ext3    defaults        0       2
# /home was on /dev/sda9 during installation
UUID=a014c50a-056c-4851-9f5f-954b81a5f669 /home           ext3    defaults        0       2
# /tmp was on /dev/sda7 during installation
UUID=c9fe47c2-85ff-4393-86a4-773f81861bcb /tmp            ext3    defaults        0       2
# /usr was on /dev/sda8 during installation
UUID=31b05315-b9f3-4a32-89e0-efe697ca0e01 /usr            ext3    defaults        0       2
# swap was on /dev/sda10 during installation
#UUID=6b5b59a5-2403-4353-a8fa-7e58c3bb4584 none            swap    sw              0       0
/dev/mapper/cryptswap1 none swap sw 0 0
/dev/sda2 /home/me/Windows ntfs defaults,umask=007,gid=46 0 0
/dev/sda2 /home/me/Windows ntfs defaults,umask=007,gid=46 0 0


Code: Select all

me@me-System-Product-Name ~ $ mount
/dev/sda6 on / type ext3 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
/dev/sda7 on /tmp type ext3 (rw,commit=0)
/dev/sda5 on /boot type ext3 (rw,commit=0)
/dev/sda9 on /home type ext3 (rw,commit=0)
/dev/sda2 on /home/me/Windows type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sda8 on /usr type ext3 (rw,commit=0)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/home/me/.Private on /home/me type ecryptfs (ecryptfs_check_dev_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs,ecryptfs_sig=528f9ff1e9f185bb,ecryptfs_fnek_sig=7165aac9fcd192d2)
gvfs-fuse-daemon on /home/me/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=me)


Thanks
Dean

altair4
Level 17
Level 17
Posts: 7827
Joined: Tue Feb 03, 2009 10:27 am

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

Postby altair4 » Sun Sep 18, 2011 7:52 am

[1] You have a double listing of the windows entry in fstab which you should fix by placing a # sign in front of the last line like this:
From /etc/fstab:
/dev/sda2 /home/me/Windows ntfs defaults,umask=007,gid=46 0 0
#/dev/sda2 /home/me/Windows ntfs defaults,umask=007,gid=46 0 0

[2] Having said that it looks like it's mounting it exactly where you told it to mount. From "mount":
/dev/sda2 on /home/me/Windows type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)

EDIT: I think I may see a problem here.
You've encrypted your home directory. I know nothing about an encrypted home directory but your current fstab line will mount the partition as accessible to you but not owned by you. I don't know how encryption works or where in the boot process it mounts the encrypted partition so the following 2 options could be pure rubbish:

[a] Change the fstab line to this:
/dev/sda2 /home/me/Windows ntfs defaults,uid=1000,umask=007,gid=46 0 0

Then unmount the partition:

Code: Select all

sudo umount /home/me/Windows

Then run the following command to mount the partition this time with you as owner:

Code: Select all

sudo mount -a

[b]OR, Put the mount point outside your /home directory:

Code: Select all

sudo mkdir /media/Windows

Then change the fstab line to this:
/dev/sda2 /media/Windows ntfs defaults,umask=007,gid=46 0 0

Then unmount the partition and do the "sudo mount -a" as in option [a].

Sorry, just don't know enough about an encrypted home directory to know if that will work. You may have to wait for someone who does.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

4hya
Level 1
Level 1
Posts: 8
Joined: Thu Jul 14, 2011 1:19 am

Auto Mount Partitions on Boot (also Windows partitions)

Postby 4hya » Sun Sep 18, 2011 9:07 am

install storage device manager.

altair4
Level 17
Level 17
Posts: 7827
Joined: Tue Feb 03, 2009 10:27 am

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

Postby altair4 » Sun Sep 18, 2011 9:38 am

4hya wrote:install storage device manager.

Your post is a non-sequitur. This is a HowTo not a request for help. It's presented in the traditional way by someone who knows quite a bit on the subject. Someone posted a support question using this Howto. If this had been a normal post started in it's own topic your post would make more sense but here it's just rude.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

DeanoBravo2zero
Level 1
Level 1
Posts: 9
Joined: Sun Sep 11, 2011 5:15 am
Location: UK

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

Postby DeanoBravo2zero » Mon Sep 19, 2011 3:12 pm

Ok altair4 i auto mounted outside my home directory in media instead,

Which auto mounts just fine on every boot up.

Many Thanks
Dean

LusoFresh
Level 1
Level 1
Posts: 2
Joined: Thu Sep 29, 2011 2:22 pm

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

Postby LusoFresh » Thu Sep 29, 2011 2:30 pm

Hi, im starting with linux and i need a little help undoing these commands that i made to automount a partition

To auto mount an ntfs Windows partition in /media open a terminal and type:

sudo mkdir /media/Windows

sudo su

echo "/dev/sdxx /media/Windows ntfs defaults,umask=007,gid=46 0 0" >> /etc/fstab


since it didnt work as i expected i found another way to do it with pysdm, so i would like to undo this, can someone help me? Thank You :D

AlbertP
Level 16
Level 16
Posts: 6703
Joined: Sun Jan 30, 2011 12:38 pm
Location: Utrecht, The Netherlands

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

Postby AlbertP » Thu Sep 29, 2011 2:56 pm

You can open the fstab with:

Code: Select all

gksudo gedit /etc/fstab

There you can remove the line, most likely at the bottom. Then save & exit.
Please don't remove any other lines from the file.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.

LusoFresh
Level 1
Level 1
Posts: 2
Joined: Thu Sep 29, 2011 2:22 pm

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

Postby LusoFresh » Thu Sep 29, 2011 3:29 pm

It worked, Thank You :)

tokyo-joe
Level 1
Level 1
Posts: 3
Joined: Sun Jun 26, 2011 12:11 am

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

Postby tokyo-joe » Sat Mar 17, 2012 10:53 pm

I have successfully auto mounted my partitions, but have a minor problem.

When the system boots up and mount partitions, the messages pop-up asking how to handle mounted folders (open or unmount). Because I have about 10 partitions mounted, it's very annoying (the messages pop-up for each partitions).

How can I disable message pop-ups?

altair4
Level 17
Level 17
Posts: 7827
Joined: Tue Feb 03, 2009 10:27 am

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

Postby altair4 » Sun Mar 18, 2012 7:59 am

The best thing to do is post the output of these commands so we can see how you are set up:

Code: Select all

sudo blkid -c /dev/null

Code: Select all

cat /etc/fsatb
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.


Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 4 guests