Moving CrashPlan cache and log directories to new locations

As discussed in a previous post, the ReadyNAS might run out of disk space on the 4 GB root partition if you install software other than that provided by NetGear.

In my case it was CrashPlan’s cache and log files that were filling up the root partition, with warning emails every 10 minutes that 81% of the root partition was used, 82%… 83%…, so they needed a new home. Turns out it is not too hard:

ssh into the NAS, then su to become root. Stop CrashPlan (if it is running):

root@RN312:/home/admin# service crashplan stop
Stopping CrashPlan Engine … OK
root@RN312:/home/admin#

Make a copy of CrashPlan’s configuration file, in case something goes wrong:

root@RN312:/home/admin# cp /usr/local/crashplan/conf/my.service.xml /usr/local/crashplan/conf/my.service.xml.orig
root@RN312:/home/admin#

Take a look at CrashPlan’s cache directory:

root@RN312:/home/admin# ls -lah /usr/local/crashplan/cache/
total 40M
drwxr-sr-x 1 root staff  106 Sep 25 03:00 .
drwxr-sr-x 1 root staff  258 Sep 25 21:31 ..
drwxr-sr-x 1 root staff  170 Sep 25 21:31 42
-rw-r–r– 1 root staff 8.4K Sep 25 21:31 cpft1_42
-rw-r–r– 1 root staff 1.9K Sep 25 21:31 cpft1_42i
-rw-r–r– 1 root staff 2.1K Sep 25 21:31 cpft1_42x
-rw-r–r– 1 root staff  23M Sep 25 21:31 cpgft1
-rw-r–r– 1 root staff 8.8M Sep 25 21:31 cpgft1i
-rw-r–r– 1 root staff 7.9M Sep 25 21:31 cpgft1x
-rw-r–r– 1 root staff  986 Sep 25 03:02 cpss1
root@RN312:/home/admin#

Create cache directory in new location:

root@RN312:/home/admin# mkdir /home/admin/from_root/crashplan/cache

Change the config file to point to the new location (using your favourite editor, vim used here):

root@RN312:/home/admin# vim /usr/local/crashplan/conf/my.service.xml

Change
<cachePath>/usr/local/crashplan/cache</cachePath>
to
<cachePath>/home/admin/from_root/crashplan/cache</cachePath>

(Adjust as needed if you have selected some other place for the CrashPlan files.)

Now move the cache files:

root@RN312:/home/admin# mv /usr/local/crashplan/cache/* /home/admin/from_root/crashplan/cache/
root@RN312:/home/admin#

Time to move CrashPlan’s log files. They are originally stored in /usr/local/crashplan/log/, let’s move them to /home/admin/from_root/crashplan/log.

root@RN312:/home/admin# ls -lah /usr/local/crashplan/log/
total 111M
drwxrwxrwx 1 root staff  346 Sep 23 04:41 .
drwxr-sr-x 1 root staff  258 Sep 25 21:31 ..
-rw-r–r– 1 root root   33K Sep 25 21:31 app.log
-rw-r–r– 1 root root   23M Sep 25 21:31 backup_files.log.0
-rw-r–r– 1 root root   26M Jul 12 19:50 backup_files.log.1
-rw-rw-rw- 1 root root     0 Aug 15 15:21 engine_error.log
-rw-r–r– 1 root root  6.4K Sep 25 21:31 engine_output.log
-rw-r–r– 1 root root  180K Sep 25 21:31 history.log.0
-rw-r–r– 1 root root  501K Sep 17 13:47 history.log.1
-rw-r–r– 1 root root  501K Aug 25 08:10 history.log.2
-rw-rw-rw- 1 root root     0 Aug 15 15:24 restore_files.log.0
-rw-r–r– 1 root root   13M Sep 25 21:31 service.log.0
-rw-r–r– 1 root root   26M Sep 23 04:41 service.log.1
-rw-r–r– 1 root root   26M Sep 17 14:35 service.log.2
root@RN312:/home/admin#
root@RN312:/home/admin# mkdir /home/admin/from_root/crashplan/log
root@RN312:/home/admin#

Find the fileHandler tags (there are 4 of them dealing with log files), modify them so they point to the new log directory. So, once again edit /usr/local/crashplan/conf/my.service.xml.orig, part of mine looks like this after moving the log files. Change the paths as neeed for your choice of new directories:

<serviceLog>
    <fileHandler append="true" count="2" level="ALL" limit="26214400" pattern="/home/admin/from_root/crashplan/log/service.log"/>
  </serviceLog>
  <serviceErrorInterval>3600000</serviceErrorInterval>
  <historyLog>
    <fileHandler append="true" count="10" level="ALL" limit="512000" pattern="/home/admin/from_root/crashplan/log/history.log"/>
  </historyLog>

Start CrashPlan again:

root@RN312:/home/admin# service crashplan start
Stopping CrashPlan Engine … OK
root@RN312:/home/admin#

And finally check free disk space on /:

root@RN312:/usr/local/crashplan/log# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          4.0G  1.7G  1.8G  49% /
tmpfs            10M  4.0K   10M   1% /dev
/dev/md0        4.0G  1.7G  1.8G  49% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G  5.8M  2.0G   1% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           2.0G     0  2.0G   0% /media
/dev/md127      2.8T  1.1T  1.7T  39% /data
/dev/md127      2.8T  1.1T  1.7T  39% /home
/dev/md127      2.8T  1.1T  1.7T  39% /apps
root@RN312:/usr/local/crashplan/log#

49% – nice!