Automount NTFS Windows partition at boot

Hi guys,
I have a question for wich I did not found a solution yet!

On my OpenSuse 12.2 KDE I use Thunderbird email client with the profile folder located on a windows ntfs partition so it is synchronized, but every time I boot into OpenSuse I have to go into file manager, click the NTFS partition and enter root password in order to mount it, otherwise Thunderbird offcourse cannot access the profile folder.
I read that I can edit the fstab file to make the NTFS partition be automatically mounted at boot but I did not succeed.

Can you guys give me a hint ?

Open up terminal and type in the following command:

cat /etc/fstab

Copy the resulting text from terminal into a forum message here using the advanced forum message editor. Highlight the posted text from terminal into your message and press the code #. We can then modify the file to show what we would do. For refence only, here is my fstab file:

/dev/disk/by-id/ata-ST1000DM003-9YN162_S1D0FP65-part1               swap                 swap       defaults,noatime                                  0 0
/dev/disk/by-id/ata-ST1000DM003-9YN162_S1D0FP65-part2               /Backup              ext4       acl,user_xattr,noatime                            1 2
/dev/disk/by-id/ata-ST1000DM003-9YN162_S1D0FP65-part3               /home                ext4       defaults,noatime                                  1 2
/dev/disk/by-id/ata-ST1000DM003-9YN162_S1D0FP65-part4               /DataSafe            ext4       defaults,noatime                                  1 2
/dev/disk/by-id/ata-SSD2SC120GB1DA16T-T_PNY25120001032010052-part1  swap                 swap       defaults,noatime,discard,errors=remount-ro        0 0
/dev/disk/by-id/ata-SSD2SC120GB1DA16T-T_PNY25120001032010052-part2  /                    ext4       acl,user_xattr,noatime,discard,errors=remount-ro  0 1
/dev/disk/by-id/ata-ST31500541AS_9XW05PCT-part1                     /Multimedia          ntfs-3g    defaults,noatime                                  0 0
/dev/disk/by-id/ata-ST32000641AS_9WM0BWE8-part2                     /Windows             ntfs-3g    defaults,noatime                                  0 0
/dev/disk/by-id/ata-ST31500541AS_5XW14NDQ-part1                     /Software            ntfs-3g    defaults,noatime                                  0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

Notice how I have the kernel options for the ntfs-3g partitions of “defaults,noatime”. To make easy edits of the fstab file as root, check out my bash script SYSEdit you can find here: SYSEdit - System File Editor - Version 1.50 - Blogs - openSUSE Forums

Thank You,

This is the result of

cat /etc/fstab

/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part2 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part3 /                    ext4       acl,user_xattr        1 1
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
/dev/disk/by-id/usb-SanDisk_Cruzer_Micro_20060774201B3F60EAF1-0:0-part1 /tmp                 vfat       users,gid=users,umask=0002,utf8=true,nofail 0 0

On 2013-04-17 00:46, robertot5 wrote:
>
> This is the result of
>
> cat /etc/fstab
> Code:
> --------------------
> /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part2 swap swap defaults 0 0
> /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part3 / ext4 acl,user_xattr 1 1
> proc /proc proc defaults 0 0
> sysfs /sys sysfs noauto 0 0
> debugfs /sys/kernel/debug debugfs noauto 0 0
> usbfs /proc/bus/usb usbfs noauto 0 0
> devpts /dev/pts devpts mode=0620,gid=5 0 0
> /dev/disk/by-id/usb-SanDisk_Cruzer_Micro_20060774201B3F60EAF1-0:0-part1 /tmp vfat users,gid=users,umask=0002,utf8=true,nofail 0 0
>
> --------------------

We also need the identifier of the ntfs partition. You obtain it like this:


> Telcontar:~ # blkid
> /dev/sda1: LABEL="a_boot_1" UUID="93f0311e-2a93-49ca-b836-d362ffc84486" TYPE="ext2"
> /dev/sda2: LABEL="a_boot_2" UUID="5135ab82-1374-4c30-b9d0-4b56d6d6d6c6" TYPE="ext2"
> /dev/sda3: LABEL="a_boot_3" UUID="9d0e53fd-25ba-4136-b276-3e13b8407008" TYPE="ext2"
> /dev/sda5: LABEL="a_one" UUID="9404bbbd-9eeb-4fb9-96b1-1c42b0f776ff" TYPE="reiserfs"
....

Actually, we only need lines which type is vfat or ntfs.

I must warn you of a problem: you are mounting an external disk in /tmp.
That could pass, but it is of type “vfat”, which means that you can not
assign linux permissions, no hardlinks nor symlinks… Sooner or later
you will have strange problems.

Undo that.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

Suggestion number 1, don’t use the tmp folder. Number 2, lets create a new folder and give all permission to it. Open up terminal and execute the following command:

sudo mkdir /Windows
sudo chmod 777 /Windows

Next, replace your old fstab file with the following file. It will no longer use the folder /tmp for your Windows files:

/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part2         swap        swap       defaults,noatime               0 0
/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part3         /           ext4       acl,user_xattr,noatime         1 1
/dev/disk/by-id/usb-SanDisk_Cruzer_Micro_20060774201B3F60EAF1-0:0-part1 /Windows    vfat       defaults,user,noatime,nofail   0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

Don’t forget, you can use my SYSEdit bash script to edit this file if you wish. Restart openSUSE and see what you get.

Thank You,

This is the output of blkid

/dev/sda1: LABEL="HDD1" UUID="549EB48E9EB46A5E" TYPE="ntfs" 
/dev/sda2: UUID="faaacf8a-36d8-4838-aeff-07b2a67ab77c" TYPE="swap" 
/dev/sda3: UUID="eb52b6a8-b699-441e-8cce-8be81aa6e345" TYPE="ext4"

Actually that “usb-SanDisk_Cruzer_Micro” entry is of an old flash drive I don’t use anymore.

The windows partition is mounted as HDD1 in my file manager and is located in /media/HDD1

On 2013-04-17 06:16, robertot5 wrote:
>
> This is the output of blkid
>
>
> Code:
> --------------------
> /dev/sda1: LABEL=“HDD1” UUID=“549EB48E9EB46A5E” TYPE=“ntfs”
> /dev/sda2: UUID=“faaacf8a-36d8-4838-aeff-07b2a67ab77c” TYPE=“swap”
> /dev/sda3: UUID=“eb52b6a8-b699-441e-8cce-8be81aa6e345” TYPE=“ext4”
> --------------------
>
>
> Actually that “usb-SanDisk_Cruzer_Micro” entry is of an old flash drive
> I don’t use anymore.
>
> The windows partition is mounted as HDD1 in my file manager and is
> located in /media/HDD1

Ok.

For convenience, first install package “mc”.

Then, log out from any graphical users you may have in use. Type
[ctrl][alt][f1]. There log in (text mode) as root (yes, in text mode it
is advisable to do so instead of log in as user then “su -”). Issue the
command “init 1” - I hope this still works with systemd, but I’m not
sure. If it doesn’t, stop and we’ll find out what to use instead.

The system will probably ask you to log in again, do so as root (text
mode).

Type:


umount /tmp

If the system refuses, we will have to devise another procedure. Stop
here in that case.

Open an editor, in text mode. I suggested to install ‘mc’ because then
you can use the editor ‘mcedit’, it has a menu. Otherwise you can use ‘joe’.


mcedit /etc/fstab

Comment out the line with “usb-SanDisk_Cruzer_Micro” in it. This is done
by writing a ‘#’ as the first character.

Now, create another line like this:


> LABEL=HDD1 /windows/C   ntfs-3g   users,uid=YOUR_LOGIN_NAME,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8   0 0

(there are other possibilities, that is simply one combination I use)

Save. Run this:


mkdir /windows
mkdir /windows/C
touch /windows/C/not_mounted
mount /windows/C
ls /windows/C/

You should see the contents of the Windows partition. If the mount
command above failed, investigate why. If you can not mount the
partition, then edit again fstab and comment out that /windows/C line,
else your system may boot to emergency mode next time, and ask here.

Finally:


init 5

and you can log in back as graphical user. Done.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

Hi,
I did what you said

ctrl + alt +f1 > log in as root > typed “init 1” > logged in again as root and typed “umount /tmp” wich gave

umount: /tmp : not mounted

then it automatically logged my user in KDE, so I stopped as instructed.

So as far I undestand, I have to get rid of that obsolete entry of the Sandisk Cruzez flash drive and then set the windows to be automounted, is that correct ?

What I also forgot to mention was that my SUSE was installed after Windows 7 and that at boot I first get the windows default loader, then if I select OpenSUSE I get the GRUB one (the green background one). I think this is messed up isn’t it ?

On 2013-04-17 17:46, robertot5 wrote:
>
> Hi,
> I did what you said
>
> ctrl + alt +f1 > log in as root > typed “init 1” > logged in again as
> root and typed “umount /tmp” wich gave
>
>
> Code:
> --------------------
> umount: /tmp : not mounted
> --------------------

Ah, I did not expect that, but it is an error you can ignore completely.
You could have continued the procedure.

> then it automatically logged my user in KDE, so I stopped as
> instructed.

I do not understand how you could be logged automatically in KDE, when
using runlevel 1 that is impossible. But I could be mistaken, systemd
has changed things.

Well, as “/tmp” is not mounted separately, you do not need to do all
that in runlevel 1. You can do it all from inside KDE, using a terminal
and “su -”. Umounting /tmp on a live system was the reason for going to
level 1.

> So as far I undestand, I have to get rid of that obsolete entry of the
> Sandisk Cruzez flash drive and then set the windows to be automounted,
> is that correct ?

Yep.

> What I also forgot to mention was that my SUSE was installed after
> Windows 7 and that at boot I first get the windows default loader, then
> if I select OpenSUSE I get the GRUB one (the green background one). I
> think this is messed up isn’t it ?

No, it is not a problem.

You can change it if you want, but there is no need. It has some
advantages: Windows is happier, service pack updates work without doing
tricks.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

I edited the fstab with SYSedit to this:

/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part2 swap                 swap       defaults              0 0
 /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part3 /                    ext4       acl,user_xattr        1 1
 proc                 /proc                proc       defaults              0 0
 sysfs                /sys                 sysfs      noauto                0 0
 debugfs              /sys/kernel/debug    debugfs    noauto                0 0
 usbfs                /proc/bus/usb        usbfs      noauto                0 0
 devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
 #/dev/disk/by-id/usb-SanDisk_Cruzer_Micro_20060774201B3F60EAF1-0:0-part1 /tmp                 vfat       users,gid=users,umask=0002,utf8=true,nofail 0 0

I also tried “umount /tmp” as root in KDE and I get the same “umount: /tmp : not mounted” error.

I then continued and added the line in fstab using mcedit like this:

/dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part2 swap                 swap       defaults              0 0
 /dev/disk/by-id/ata-WDC_WD1600AAJS-00L7A0_WD-WMAV2L467048-part3 /                    ext4       acl,user_xattr        1 1
 proc                 /proc                proc       defaults              0 0
 sysfs                /sys                 sysfs      noauto                0 0
 debugfs              /sys/kernel/debug    debugfs    noauto                0 0
 usbfs                /proc/bus/usb        usbfs      noauto                0 0
 devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
 #/dev/disk/by-id/usb-SanDisk_Cruzer_Micro_20060774201B3F60EAF1-0:0-part1 /tmp                 vfat       users,gid=users,umask=0002,utf8=true,nofail 0 0
 LABEL=HDD1 /windows/C   ntfs-3g   users,uid=myusername,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8   0 0

and ran the commands in terminal as root then logged out and back in and VOILA, it works great !

Thank you very much for your support !
I really like this community.

Just saw this thread.
Congrats on getting it working. FYI another <much> easier approach which also minimizes the possibility of all sorts of errors is to simply configure in YAST > parted.

All disks and found partitions are found, and you’re guided through creating or modifying mount points, automatically creating the correct fstab entries.

HTH,
TSU

Yes, that was the first thing I tried, I did not find an option for “auto mount at startup” though, only “do not mount at startup” and did not really understand what for example “no access time” option means.
I’m still a newbie yet :wink:

You might now understand “do not mount at startup” is opposite what you wanted so you’d want to not make that setting.

Believe “no access time” refers to a setting that writes a timestamp with each write. This is useful on data partitions but often turned off on the OS partitions to decrease writes for something that isn’t useful.

TSU

On 2013-04-17 23:46, tsu2 wrote:
>
> Just saw this thread.
> Congrats on getting it working. FYI another <much> easier approach
> which also minimizes the possibility of all sorts of errors is to simply
> configure in YAST > parted.

Ah, possibly… I tend to forget that method. Each one has his own
preferred methods :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

The thing is, the option “Do not mount at startup” was not checked, I was confused.

Anyways, it is perfect now.