moosefs / moosefs

MooseFS Distributed Storage – Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System / Software-Defined Storage
https://moosefs.com
GNU General Public License v2.0
1.69k stars 207 forks source link

[feature] tools to access trash files #102

Open danielblues opened 6 years ago

danielblues commented 6 years ago

Is it possible to implement a better way to browse and restore files from trash?

The initial hash list with the files from the same directory separated in it is not very practical, is it possible to add a option to browse the original directory tree?

[root@mst1 trash]# ls -l /mnt/mfsTrash/trash/ drwx------. 3 root root 0 Apr 12 15:52 000 drwx------. 3 root root 0 Apr 12 15:52 001 [...] drwx------. 3 root root 0 Apr 12 15:52 FFD drwx------. 3 root root 0 Apr 12 15:52 FFE drwx------. 3 root root 0 Apr 12 15:52 FFF d-w-------. 4098 root root 0 Apr 12 15:52 undel

Thank you

jkiebzak commented 6 years ago

+1

richarson commented 6 years ago

There is a way, from the manual:

"If you use MooseFS 3 and you want to see the old trash structure, known from MooseFS 2 (because you e.g. don’t have a lot of files in trash and you like old, simple structure), you should mount the trash with a specific mfsflatrash parameter, e.g.:

mfsmount -H master . host . name -o mfsmeta , mfsflattrash /mnt/ mfsmeta "

danielblues commented 6 years ago

Thank you, that helps if you don't have many files. The original tree, would be a bit better, I think you can't beat mv trashedDir undel for practicality.

richarson commented 6 years ago

@danielblues Sorry, when you said "original directory tree" I understood it as what MooseFS used to do in earlier versions. Now I realize you mean the original tree as you see it in the client.

In principle that would be nice but there will be name collisions, for example if you delete a file and create another with the same name in the same directory and then delete it too, you'd loose one of them.

A versioning system might be too much for a trash bin, but I'll leave it to the developers to consider :)

acid-maker commented 6 years ago

Files in the trash are recognized by their inode numbers, not names, so there are no name collisions there. You can recreate and redelete the same file couple of times and then "undel" each of them - the only problem is that if you want to "undel" them all then you need to change the name of recently undeleted file before you recover the next one - because in standard filesystem name collisions are forbidden.

Usually flat trash is what you want, but sometimnes (case of our company) you may have millions of files in the trash (currently we have 8mln files there) and just listing them all in one directory causes network issues - this is why we decided to split trash into 4k "subtrashes".

Currently we are working on tools to access trash files - it should be much more practical than current special "meta" mount.