how to manually empty moosefs trash folder to save space

1.7k views Asked by At

I found that moosefs trash take too much of my disk space. according to moosefs documentation, it will keep it for a while in case user want it back. But How to clean it up manually to save space?

1

There are 1 answers

0
prk On BEST ANSWER

In order to purge MooseFS' trash, you need to mount special directory called "MooseFS Meta".

Create mountdir for MooseFS Meta directory first:

mkdir /mnt/mfsmeta

and mount mfsmeta:

mfsmount -o mfsmeta /mnt/mfsmeta

If your Master Server Host Name differs from default mfsmaster and/or port differs from default 9421, use appropriate switch, e.g.:

mfsmount -H master.host.name -P PORT -o mfsmeta /mnt/mfsmeta

Then you can find your deleted files in /mnt/mfsmeta/trash/SUBTRASH directory. Subtrash is a directory inside /mnt/mfsmeta named 000..FFF. Subtrashes are helpful if you have many (e.g. millions) of files in trash, because you can easily operate on them using Unix tools like find, whereas if you had all the files in one directory, such tools may fail.

If you do not have many files in trash, mount Meta with mfsflattrash parameter:

mfsmount -o mfsmeta,mfsflattrash /mnt/mfsmeta

or if you use Master Host Name or Port other than default:

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

In this case your deleted files will be available directly in /mnt/mfsmeta/trash (without subtrash).

In both cases you can remove files by simply using rm file or undelete them by moving them to undel directory available in trash or subtrash (mv file undel).

Remember, that if you do not want to have certain files moved to trash at all, set "trash time" (in seconds) for these files to 0 prior to deletion. If you set specific trash time for a directory, all the files created in this directory inherit trash time from parent, e.g.:

mfssettrashtime 0 /mnt/mfs/directory

You can also set a trash time to other value, e.g. 1 hour:

mfssettrashtime 3600 /mnt/mfs/directory

For more information on specific parameters passed to mfsmount or mfssettrashtime, see man mfsmount and man mfstrashtime.

Hope it helps!

Peter