Difference between revisions of "HOWTO: Automount NTFS partitions as read/write"

From Sabayon Wiki
Jump to: navigation, search
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{I18n| [[HOWTO:_Automount_NTFS_partitions_as_read/write|en]] [[Pl:HOWTO:_Montowanie_partycji_NTFS|pl]]}}
+
{{I18n| [[HOWTO:_Automount_NTFS_partitions_as_read/write|en]] [[Pl:HOWTO:_Montowanie_partycji_NTFS|pl]] [[Tr:HOWTO:_Automount_NTFS_partitions_as_read/write|tr]]}}
 
{{Template:Note | Actually all Sabayon Linux Distros from 3.4+ use SATA imaging. Which means that all drives appear as sd*. An example is /dev/sda/ [[User:Element|Element]] 22:34, 24 September 2007 (UTC)`}}
 
{{Template:Note | Actually all Sabayon Linux Distros from 3.4+ use SATA imaging. Which means that all drives appear as sd*. An example is /dev/sda/ [[User:Element|Element]] 22:34, 24 September 2007 (UTC)`}}
 
This will show you how to automount your root Window's parition so that you can read and write to it.
 
This will show you how to automount your root Window's parition so that you can read and write to it.
Line 5: Line 5:
 
Perform the following commands to create a mountpoint and open up fstab to edit
 
Perform the following commands to create a mountpoint and open up fstab to edit
 
<pre>$ su
 
<pre>$ su
# mkdir /media/Windows
+
# mkdir /mnt/Windows
 
# nano -w /etc/fstab
 
# nano -w /etc/fstab
 
</pre>
 
</pre>
  
  
Now add the following to the bottom:
+
Assuming That Windows is installed on the first Harddisc, and first Partition:
<pre>/dev/hda1 /media/Windows ntfs-fuse auto,user_xattr,unmask=000 1 1</pre>
+
  
 +
add the following to the bottom:
 +
<pre>/dev/sda1 /mnt/Windows  ntfs-3g  defaults  0  0</pre>
  
Change /hda1 to sda1 if you have sata. /media/Windows is our new mountpoint (where you go to see the files after boot time).  ntfs-fuse is telling it its a ntfs parition and fuse is needed to write to it.  The rest just mounts it automatically and for all users to read and write to it.
+
{{Note|The spaces are important they are in columns.}}
 +
/mnt/Windows is our new mountpoint (where you go to see the files after boot time).  ntfs-3g is telling it is a ntfs parition and is needed to write to it.  The rest just mounts it automatically and for all users to read and write to it.
  
  
 
If you have a mutliple user system and only want certain users to read/write to it, do the following:
 
If you have a mutliple user system and only want certain users to read/write to it, do the following:
  
<pre># addgroup ntfs
+
<pre># groupadd ntfs
# adduser <username> ntfs</pre>
+
# usermod -a -G ntfs YOUR_USER_NAME
 +
or
 +
# gpasswd -a YOUR_USER_NAME ntfs</pre>
 +
  
  
Line 33: Line 38:
 
and do this instead for fstab:  
 
and do this instead for fstab:  
  
<pre>/dev/hda1   /media/Windows    ntfs-fuse   auto,gid=1002,unmask=0002    0    0</pre>
+
<pre>/dev/sda1   /mnt/Windows    ntfs-3g   auto,gid=1002,unmask=0002    0    0</pre>
  
 
You will need to change the gid and umask to equal that of whatever your ntfs usergroup is.  
 
You will need to change the gid and umask to equal that of whatever your ntfs usergroup is.  
  
There you have it.  Save and exit.  Then reboot and you'll have read/write access to it from /media/Windows
+
There you have it.  Save and exit.  Then reboot and you'll have read/write access to it from /mnt/Windows
  
There is more than one way to skin this cat and one of them is ntfs-3g, however I personally favor the above as its worked for me 100% of the time
+
There's no need to reboot!
  
EDIT:
+
Once /etc/fstab is modified, apply modifications, and exit your editor.
  
the ntfs-3g way. This worked for me :) newbies like me might prefer it. It is the newer way.
+
As root, type:
 
+
1.
+
Perform the following commands in a konsole terminal to create a mountpoint and open up the fstab (file system table) to edit (you will need to be root, the command su means super user, and elevates you, so when it asks - type your ROOT password).
+
{{Console| <pre class="clear">$ su
+
# mkdir /media/Windows #this will be where you will find your ntfs disk. (also it will still show up as before mounted in storage media -it's a twofer! or nonefer!)
+
#sudo kate /etc/fstab
+
</pre>}}
+
Kate is a pretty, more windowsy editor, you need sudo to open the file. fstab(file hidden by default) is where the mount settings are kept (any session button will do, if you are going to have more than one file open then this keeps them neatly)
+
 
+
2. On the last line of fstab paste EITHER
+
{{File| (etc/fstab)| <pre class="clear">
+
/dev/disk/by-id/whatever /media/windowsntfs ntfs-3g defaults 0 0
+
</pre>}}
+
The spaces are important they are in columns, people don't tell you that..
+
OR
+
{{File| (etc/fstab)| <pre class="clear">
+
/dev/sdwhatever /media/windowsntfs ntfs-3g defaults 0 0
+
</pre>}}
+
if you are more used to the sda, sdb disk partition listing. (most of us are) You will see hda on a lot of how to's it used to be that way. sda refers to 1st disk to boot from in bios. sdb 2nd disk..
+
So sdb3 would mount only the 2nd disk(b) 3rd partition. But you can remove the number and get the lot or change the number...
+
Now save the file... and exit kate. konsole may complain or hang type - exit
+
 
+
3. back at the konsole prompt - no need to reboot!
+
 
{{Console| <pre class="clear">
 
{{Console| <pre class="clear">
#edit /etc/fstab #apply modifications, yes you need the "#" before edit
+
mount -a</pre>}}
mount -a # mount all the not mounted partitions in /etc/fstab
+
(mount all the not mounted partitions in /etc/fstab)
</pre>}}
+
Done :lol:
+
 
+
For more detail I mixed http://gentoo-wiki.com/HOWTO_NTFS_write_with_ntfs-3g
+
with
+
http://www.linuxquestions.org/questions/linux-hardware-18/ntfs-write-in-opensuse-613549/ look out :roll: opensuse is different somehow
+
 
+
EDIT:
+
 
+
A different way is the following, this way does not use fstab.
+
Post Mounting NTFS partitions in a safe way, without /etc/fstab
+
I want to explain you how to configure HAL to let users mount NTFS partitions without any /etc/fstab hack or shell contorsion.
+
 
+
Fire up your favorite terminal and become root. then copy the lines below in /usr/share/hal/fdi/policy/10osvendor/99-ntfs-policy.fdi:
+
+
<pre> <?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
+
<deviceinfo version="0.2">
+
 
   
 
   
<!-- Mount external ntfs drives with user privileges -->
+
Done.
<device>
+
  <match key="block.is_volume" bool="true">
+
  <match key="volume.fsusage" string="filesystem">
+
    <match key="@block.storage_device:storage.no_partitions_hint" bool="false">
+
    <match key="volume.partition.msdos_part_table_type" exists="true">
+
      <match key="volume.partition.msdos_part_table_type" int="0x07">
+
      <merge key="volume.mount_option" type="string">umask=0222</merge>
+
      </match>
+
    </match>
+
    </match>
+
  </match>
+
  </match>
+
</device>
+
</deviceinfo>
+
</pre>
+
 
+
Now, always as root, just run this command:
+
+
<pre> sed -i '/# echo "options =/s/#/MOUNTOPTIONS="$MOUNTOPTIONS,$HAL_PROP_VOLUME_MOUNT_OPTION"\n\n#/'/usr/share/hal/scripts/hal-system-storage-mount
+
</pre>
+
 
+
Now, just reboot or, for the bravest:
+
+
<pre> /etc/init.d/hald restart
+
</pre>
+
 
+
...and you are done
+
 
+
  
 
--[[User:Sabayon|cvill64]] 21:28, 6 November 2006 (PST)--cvilll64  
 
--[[User:Sabayon|cvill64]] 21:28, 6 November 2006 (PST)--cvilll64  
  
 
[[Category:Filesystems|Automount NTFS partitions as read /write]]
 
[[Category:Filesystems|Automount NTFS partitions as read /write]]

Latest revision as of 22:07, 11 December 2012

i18n: en pl tr
Question.png
Actually all Sabayon Linux Distros from 3.4+ use SATA imaging. Which means that all drives appear as sd*. An example is /dev/sda/ Element 22:34, 24 September 2007 (UTC)`

This will show you how to automount your root Window's parition so that you can read and write to it.

Perform the following commands to create a mountpoint and open up fstab to edit

$ su
# mkdir /mnt/Windows
# nano -w /etc/fstab


Assuming That Windows is installed on the first Harddisc, and first Partition:

add the following to the bottom:

/dev/sda1 /mnt/Windows   ntfs-3g   defaults   0   0
Question.png
The spaces are important they are in columns.

/mnt/Windows is our new mountpoint (where you go to see the files after boot time). ntfs-3g is telling it is a ntfs parition and is needed to write to it. The rest just mounts it automatically and for all users to read and write to it.


If you have a mutliple user system and only want certain users to read/write to it, do the following:

# groupadd ntfs
# usermod -a -G ntfs YOUR_USER_NAME
or
# gpasswd -a YOUR_USER_NAME ntfs


The output should look something like this:

Adding group `ntfs' (1002)... 
Done


That number is your gid an umask number to use.

and do this instead for fstab:

/dev/sda1    /mnt/Windows    ntfs-3g    auto,gid=1002,unmask=0002    0    0

You will need to change the gid and umask to equal that of whatever your ntfs usergroup is.

There you have it. Save and exit. Then reboot and you'll have read/write access to it from /mnt/Windows

There's no need to reboot!

Once /etc/fstab is modified, apply modifications, and exit your editor.

As root, type:

mount -a

(mount all the not mounted partitions in /etc/fstab)

Done.

--cvill64 21:28, 6 November 2006 (PST)--cvilll64