Trashcan support on NTFS volumes: Difference between revisions
mNo edit summary |
|||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 4: | Line 4: | ||
[[Category:201201]] | [[Category:201201]] | ||
To enable '' | To enable ''Trashcan'' support on an NTFS partition you need to associate a user-id with the partition. | ||
== 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> | |||
id -u | |||
</syntaxhighlight> | |||
Show your group-id: | |||
<syntaxhighlight lang=bash> | |||
id -g | |||
</syntaxhighlight> | |||
To find the correct drive-UUID: | |||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| Line 27: | Line 39: | ||
</blockquote> | </blockquote> | ||
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> | ||
< | <syntaxhighlight lang=bash> | ||
... | ... | ||
UUID=45645645645645645 | UUID=45645645645645645 /media/DATA ntfs-3g defaults,umask=077,fmask=177,uid=1000,gid=1000,noatime,nofail 0 0 | ||
... | ... | ||
</ | </syntaxhighlight> | ||
</blockquote> | </blockquote> | ||
The partition will be mounted after you start your machine. If you don't want automatic mount you should add 'noauto': | |||
<blockquote> | <blockquote> | ||
< | <syntaxhighlight lang=bash> | ||
... | ... | ||
UUID=45645645645645645 | UUID=45645645645645645 /media/DATA ntfs-3g defaults,umask=077,fmask=177,uid=1000,gid=1000,noauto,noatime,nofail 0 0 | ||
... | ... | ||
</ | </syntaxhighlight> | ||
</blockquote> | </blockquote> | ||
| Line 68: | Line 80: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
sudo mkdir /media/DATA | sudo mkdir /media/DATA | ||
sudo mount /dev/sda3 /media/DATA -o defaults, | sudo mount /dev/sda3 /media/DATA -o defaults,umask=077,fmask=177,uid=1000,gid=1000,noatime,nofail | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Other settings explained == | |||
{| class="wikitable" | |||
|- | |||
! Header text !! Header text | |||
|- | |||
| /media/DATA || mount point | |||
|- | |||
| ntfs-3g || volume type | |||
|- | |||
| 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 want user-mounting, not automatic | |||
|- | |||
| exec || user implies noexec, add this if you still want to execute things | |||
|- | |||
| nofail || if you want the boot proces to continue after mounting fails | |||
|} | |||
Latest revision as of 11:30, 4 September 2025
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 ntfs-3g defaults,umask=077,fmask=177,uid=1000,gid=1000,noatime,nofail 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 ntfs-3g defaults,umask=077,fmask=177,uid=1000,gid=1000,noauto,noatime,nofail 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,umask=077,fmask=177,uid=1000,gid=1000,noatime,nofail
Other settings explained
| Header text | Header text |
|---|---|
| /media/DATA | mount point |
| ntfs-3g | volume type |
| 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 want user-mounting, not automatic |
| exec | user implies noexec, add this if you still want to execute things |
| nofail | if you want the boot proces to continue after mounting fails |