System Administration/Purging Backups

From FiranMUX

Jump to: navigation, search

Log into root on Firan.

Run df -k (the -k means show sizes in KB instead of blocks) to see how full the main partition is (the first line, mounted on /). It's like 87%. That's for reference. It's usually much lower. You don't have to be root to run df though.

Now cd to the backups directory: cd /firan/backups/game ...

Do an ls in there. Better, ls -lrt will show them in long (-l) form, and in order by reverse (-r) time (-t) with the newest files at the bottom. Or leave out the r and see the oldest files at the bottom. Those are the ones you want to deal with anyway.

Do an ls MONTHLY to see what we put in there. Note that it's only the "dawn" backups and only the first of each month (*01-dawn). The filename has the date in it: firan-saga-20061201-dawn.tar.gz is the 12/01/2006 (Dec 1) dawn backup.

If you do a ls *01-dawn* you will see two files in the game directory. January and February 2007's. Save those by moving them to the MONTHLY directory. I always use wildcards, but I do an ls of them first to make sure I get the right ones, before using the mv command to move them.

To move them, I use mv *01-dawn* MONTHLY ... In other words, the same wildcards I verified with the ls.

Once you have done that, then clean up older files. I save a week or two. Let's say we keep ten days, so we don't want to touch 2/15 - 2/25. Everything else can go.

Use rm to remove files. I use wildcards again, and verify with ls before rm'ing. * and ? mean what they mean in softcode: multiple characters and one character respectively. Furthermore, [0-3] means 0, 1, 2, or 3, so you can do things like rm firan-saga-2006* and rm firan-saga-200701* to get all of 2006 and all of January, respectively.

ls those wildcards first, verify that they're the files you want to delete, then hit Ctrl-P and replace ls with rm.

Then deal with the February files, but carefully, cuz you need to keep some of those. ls -lt firan-saga-2007020* will delete Feb 01-Feb 09.

Then deal with Feb 10-14: ls -lt firan-saga-2007021[0-4]*

There are more clever and faster ways to do this, but they're trickier.

Once you're done, do a df -k to see the impact!

Personal tools