外付けHDDのゴミ箱を有効にする

猫がキーボードの上を歩くことがよくあります.いつの間にかCapsLockとかNumLockとかが掛かってしまったりします.
その程度ならいいのですが,先日ファイラーが開いた状態でDel key を押されファイルが消えてしまいました.外付HDD でゴミ箱も設定していなかったのでゴミ箱からの復活もできません.

外付けHDDのゴミ箱を有効にしました.

freedesktop.orgに文章がありそうです.

It MAY also choose to provide trashing in the “top directories” of some or all mounted resources. This trashing is done in two ways, described below as (1) and (2).
(1) An administrator can create an $topdir/.Trash directory. The permissions on this directories should permit all users who can trash files at all to write in it.; and the “sticky bit” in the permissions must be set, if the file system supports it.
:
(2) If an $topdir/.Trash directory is absent, an $topdir/.Trash-$uid directory is to be used as the user’s trash directory for this device/partition. $uid is the user’s numeric identifier.
:

自分しか使わないので,HDDのrootに,.Trash-$uid というディレクトリを作っておけば良さそうです.

$ cd /run/media/matoken/6f12b6e0-e167-4afc-b30b-ad30c2c9f446 (1)
$ sudo install -d -m 700 -o "$(id -u)" -g "$(id -g)" ./.Trash-"$(id -u)" (2)
$ ls -A | grep .Trash-
.Trash-1000
$ id --user
1000
  1. 対象のHDDのtop dirに移動

  2. 自分用ゴミ箱ディレクトリを作成

この状態でファイラー(今回はPCManFM-Qt)でHDD内のファイルを削除するとゴミ箱に移動するようになりました.
これでまた猫にファイルが消されても復旧しやすくなりました🐈🐾

環境
$ dpkg-query -W pcmanfm-qt*
pcmanfm-qt	2.3.0-1
pcmanfm-qt-l10n	2.3.0-1
$ lsb_release -dr
Description:	Debian GNU/Linux forky/sid
Release:	n/a
$ arch
x86_64

Likes

Reposts

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)