andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.63k stars 177 forks source link

trash-empty does not work with btrfs #245

Closed andreafrancia closed 2 years ago

andreafrancia commented 2 years ago

I don't know if this problem is apt in this thread but recently I switched my file system from ext4 to btrfs. In ext4 I used to use crontab to auto delete my trash using trash-empty 14 command and it worked well there. But after moving to btrfs it wasn't working. While I ran trash-empty command manually is showed me a prompt to confirm if I wanted to delete a specific trash directory. After going through the manual I couldn't find a "--no-confirm" or some option to avoid the confirmation prompt. So is there any way to automatically delete trash using trash-empty in my system? Edit: I couldn't find anything in the docs but trying the "f" flag trash-empty 14 -f worked, is this the correct way to do it?

Originally posted by @lladeebll in https://github.com/andreafrancia/trash-cli/issues/242#issuecomment-1229185319

andreafrancia commented 2 years ago

Hi @lladeebll, please send me the output of these two commands:

$ trash-list --version
$ trash-list --debug-volumes

Thank you

0xadeeb commented 2 years ago

Hi @lladeebll, please send me the output of these two commands:

$ trash-list --version
$ trash-list --debug-volumes

Thank you

$ trash-list --version
/usr/bin/trash-list 0.22.8.21.16
$ trash-list --debug-volumes
physical ->
[sdiskpart(device='/dev/sda4', mountpoint='/tmp', fstype='btrfs', opts='rw,noatime,compress=zstd:3,space_cache=v2,commit=120,subvolid=257,subvol=/@tmp', maxfile=255, maxpath=4096),
 sdiskpart(device='/dev/sda4', mountpoint='/var', fstype='btrfs', opts='rw,noatime,compress=zstd:3,space_cache=v2,commit=120,subvolid=256,subvol=/@var', maxfile=255, maxpath=4096),
 sdiskpart(device='/dev/sda4', mountpoint='/home', fstype='btrfs', opts='rw,noatime,compress=zstd:3,space_cache=v2,commit=120,subvolid=258,subvol=/@home', maxfile=255, maxpath=4096),
 sdiskpart(device='/dev/sdb1', mountpoint='/boot', fstype='vfat', opts='rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro', maxfile=1530, maxpath=4096),
 sdiskpart(device='/dev/sdb5', mountpoint='/', fstype='btrfs', opts='rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvolid=256,subvol=/@', maxfile=255, maxpath=4096),
 sdiskpart(device='/dev/sdb5', mountpoint='/.snapshots', fstype='btrfs', opts='rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvolid=258,subvol=/@.snapshots', maxfile=255, maxpath=4096),
 sdiskpart(device='/dev/sdb5', mountpoint='/opt', fstype='btrfs', opts='rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvolid=257,subvol=/@opt', maxfile=255, maxpath=4096)]
virtual ->
[sdiskpart(device='binfmt_misc', mountpoint='/proc/sys/fs/binfmt_misc', fstype='binfmt_misc', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='bpf', mountpoint='/sys/fs/bpf', fstype='bpf', opts='rw,nosuid,nodev,noexec,relatime,mode=700', maxfile=255, maxpath=4096),
 sdiskpart(device='cgroup2', mountpoint='/sys/fs/cgroup', fstype='cgroup2', opts='rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot', maxfile=255, maxpath=4096),
 sdiskpart(device='configfs', mountpoint='/sys/kernel/config', fstype='configfs', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='debugfs', mountpoint='/sys/kernel/debug', fstype='debugfs', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='dev', mountpoint='/dev', fstype='devtmpfs', opts='rw,nosuid,relatime,size=8121052k,nr_inodes=2030263,mode=755,inode64', maxfile=255, maxpath=4096),
 sdiskpart(device='devpts', mountpoint='/dev/pts', fstype='devpts', opts='rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000', maxfile=255, maxpath=4096),
 sdiskpart(device='efivarfs', mountpoint='/sys/firmware/efi/efivars', fstype='efivarfs', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='fusectl', mountpoint='/sys/fs/fuse/connections', fstype='fusectl', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='gvfsd-fuse', mountpoint='/run/user/1000/gvfs', fstype='fuse.gvfsd-fuse', opts='rw,nosuid,nodev,relatime,user_id=1000,group_id=1000', maxfile=1024, maxpath=4096),
 sdiskpart(device='hugetlbfs', mountpoint='/dev/hugepages', fstype='hugetlbfs', opts='rw,relatime,pagesize=2M', maxfile=255, maxpath=4096),
 sdiskpart(device='mqueue', mountpoint='/dev/mqueue', fstype='mqueue', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='proc', mountpoint='/proc', fstype='proc', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='pstore', mountpoint='/sys/fs/pstore', fstype='pstore', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='run', mountpoint='/run', fstype='tmpfs', opts='rw,nosuid,nodev,relatime,mode=755,inode64', maxfile=255, maxpath=4096),
 sdiskpart(device='securityfs', mountpoint='/sys/kernel/security', fstype='securityfs', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='sys', mountpoint='/sys', fstype='sysfs', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096),
 sdiskpart(device='systemd-1', mountpoint='/proc/sys/fs/binfmt_misc', fstype='autofs', opts='rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=15515', maxfile=255, maxpath=4096),
 sdiskpart(device='tmpfs', mountpoint='/dev/shm', fstype='tmpfs', opts='rw,nosuid,nodev,inode64', maxfile=255, maxpath=4096),
 sdiskpart(device='tmpfs', mountpoint='/run/user/1000', fstype='tmpfs', opts='rw,nosuid,nodev,relatime,size=1626324k,nr_inodes=406581,mode=700,uid=1000,gid=1000,inode64', maxfile=255, maxpath=4096),
 sdiskpart(device='tracefs', mountpoint='/sys/kernel/tracing', fstype='tracefs', opts='rw,nosuid,nodev,noexec,relatime', maxfile=255, maxpath=4096)]
Filesystem     1024-blocks    Used Available Capacity Mounted on
dev                8121052       0   8121052       0% /dev
run                8131632    1248   8130384       1% /run
/dev/sdb5         36700160 6599876  29814972      19% /
tmpfs              8131632   24052   8107580       1% /dev/shm
/dev/sdb5         36700160 6599876  29814972      19% /.snapshots
/dev/sdb5         36700160 6599876  29814972      19% /opt
/dev/sda4        104857600 9040400  94077472       9% /tmp
/dev/sdb1           262144  156312    105832      60% /boot
/dev/sda4        104857600 9040400  94077472       9% /var
/dev/sda4        104857600 9040400  94077472       9% /home
tmpfs              1626324      40   1626284       1% /run/user/1000
andreafrancia commented 2 years ago

I've just marked the btrfs filesystem as physical. Now it should be listed in trash-list --volumes