Trashcan support on NTFS volumes: Difference between revisions

From WickyWiki
mNo edit summary
mNo edit summary
Line 8: Line 8:
== Modify fstab ==
== Modify fstab ==


Associating a user-id with a partition can be done with an entry in the /etc/fstab file. You also need the drive's UUID, system's main user-id usually is 1000.
Associating a user-id with a partition can be done with an entry in the /etc/fstab file. You also need the drive's UUID, system's main user-id usually is 1000. The trash will be stored in a per-user folder on the drive ''/.Trash-<USER-ID>/''


To find the correct UUID:
Show your user-id:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
blkid
id -u
</syntaxhighlight>
 
Show your group-id:
 
<syntaxhighlight lang=bash>
id -g
</syntaxhighlight>
 
To find the correct drive-UUID:
 
<syntaxhighlight lang=bash>
sudo blkid
</syntaxhighlight>
</syntaxhighlight>


Line 27: Line 39:
</blockquote>
</blockquote>


Now edit fstab:
Edit fstab:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
Line 33: Line 45:
</syntaxhighlight>
</syntaxhighlight>


Add the following line:
Add or edit the following line to include ''uid=1000'':


<blockquote>
<blockquote>
<pre>
<pre>
...
...
UUID=45645645645645645  /media/DATA   ntfs-3g   defaults,uid=1000,locale=en_US.UTF-8  0   0
UUID=45645645645645645  /media/DATA  defaults,umask=077,fmask=177,uid=1000,gid=1000,noatime 0 0
...
...
</pre>
</pre>
</blockquote>
</blockquote>


When you followed the instructions the partition will be mounted after you start your machine. When you don't want that you should add 'noauto' as follows:
The partition will be mounted after you start your machine. If you don't want automatic mount you should add 'noauto':


<blockquote>
<blockquote>
<pre>
<pre>
...
...
UUID=45645645645645645  /media/DATA   ntfs-3g   defaults,noauto,uid=1000,locale=en_US.UTF-8  0   0
UUID=45645645645645645  /media/DATA  defaults,umask=077,fmask=177,uid=1000,gid=1000,noauto,noatime 0 0
...
...
</pre>
</pre>
Line 70: Line 82:
sudo mount /dev/sda3 /media/DATA -o defaults,noauto,uid=1000,locale=en_US.UTF-8
sudo mount /dev/sda3 /media/DATA -o defaults,noauto,uid=1000,locale=en_US.UTF-8
</syntaxhighlight>
</syntaxhighlight>
== The other settings explained ==
{| class="wikitable"
|-
! Header text !! Header text
|-
| uid=1000 || user-id 1000, check yours with 'id -u'
|-
| gid=1000 || group-id 1000, check yours with 'id -g'
|-
| umask=077 || causes files to be accessible only to you, not other users
|-
| fmask=177 || makes files non-executable
|-
| noatime || do not store accesstimes, advisable on SSD drives
|-
| user,noauto || if you don't want automatic mounting
|-
| exec || user implies noexec, add this if you still want execute
|}

Revision as of 09:59, 3 March 2018


To enable Trashcan support on an NTFS partition you need to associate a user-id with the partition.

Modify fstab

Associating a user-id with a partition can be done with an entry in the /etc/fstab file. You also need the drive's UUID, system's main user-id usually is 1000. The trash will be stored in a per-user folder on the drive /.Trash-<USER-ID>/

Show your user-id:

id -u

Show your group-id:

id -g

To find the correct drive-UUID:

sudo blkid

Returns:

...
/dev/sda2: LABEL="Ubuntu" UUID="12312312312312312" TYPE="ext4" 
/dev/sda3: LABEL="Data" UUID="45645645645645645" TYPE="ntfs" 
...

Edit fstab:

sudo gedit /etc/fstab

Add or edit the following line to include uid=1000:

...
UUID=45645645645645645   /media/DATA   defaults,umask=077,fmask=177,uid=1000,gid=1000,noatime 0 0
...

The partition will be mounted after you start your machine. If you don't want automatic mount you should add 'noauto':

...
UUID=45645645645645645   /media/DATA   defaults,umask=077,fmask=177,uid=1000,gid=1000,noauto,noatime 0 0
...

Now remount the partitions:

sudo umount -a
sudo mount -a

In this example the Trash can will be located in /media/DATA/.Trash-1000/.

Mount manually

You can also use the same options when manually mounting:

sudo mkdir /media/DATA
sudo mount /dev/sda3 /media/DATA -o defaults,noauto,uid=1000,locale=en_US.UTF-8

The other settings explained

Header text Header text
uid=1000 user-id 1000, check yours with 'id -u'
gid=1000 group-id 1000, check yours with 'id -g'
umask=077 causes files to be accessible only to you, not other users
fmask=177 makes files non-executable
noatime do not store accesstimes, advisable on SSD drives
user,noauto if you don't want automatic mounting
exec user implies noexec, add this if you still want execute