iDrive Logo

Background

If you’re anything like me, you want the best performance out of your system as possible. This includes not having things running in the background when you don’t need them to be.

It’s not just an annoyance when something you install decides to constantly eat tiny bits of resources, it could potentially be an issue with CPU and memory spikes that are hard to track down if you’re not aware of everything on your system.

IDrive

As part of the Linux install of IDrive, you’re given a bunch of pearl scripts that you manually configure and setup. This article is beyond how to set them up, but there are really good instructions on IDrive .

However, almost immediately, I noticed that CPU usage was up, taking up a whole core with a service that checks for changes to files and updates its own database. There is also another bunch of pearl scripts that run in the background and talk back to IDrive, to let the service know that your PC is available and ready to accept remote commands. As there’s no GUI app for IDrive on Linux, this is probably a good idea if it’s something you do frequently.

This post is all about stopping that behaviour and getting the CPU usage down to zero, when you’re not planning on backing up. If you run a Continuous Data Protection scheme for your backup, this probably isn’t for you. This is aimed at those who do a regular backup, maybe every day or week and also maybe have another onsite backup solution. You essentially don’t need the IDrive system running in the background whenever your PC is on.

Amending the Scripts and Services

When you’ve initially setup IDrive, it will be a bunch of scripts held in a directory of your choice. I’ve got a scripts directory in my home folder that contains these and other things I have running.

You can download the scripts from here and also read about them .

Remove constant checking for file changes

IDrive support gave me this tip to ensure your system isn’t always working a core to check for changes, even if you’ve turned off Continuous Data Protection.

To remove the system that’s checking for file changes, do the following:

In the IDriveForLinux folder from the tarball they provide, there is another folder called scripts that hold all the pearl scripts for the IDrive system.

  • Rename cdp_client.pl to cdp_client_orig.pl
  • Rename cdp_server.pl to cdp_server_orig.pl

run the command ps aux|grep IDrive

Kill the two processes named IDrive: CDP-server and IDrive: CDP-client

That’s it! This will dramatically reduce your CPU usage. It’s worth noting, of course, that if you update your scripts, you’ll have to repeat these steps to disable the Continuous Data Protection system once more.

Remove constant background checking

If you do your backups every day at the same time, or once a week, you know when this is. Why should you have the scripts running in the background, every two minutes, generating log entries and spiking your CPU when you’re not backing up? It’s easy to disable them, but it does involve messing with your systemd services a little.

If you’re not comfortable doing this or don’t notice any degradation to your system every two minutes, you can skip this section

The IDrive scripts install a service called idrivecron.service to /usr/lib/systemd/system and enables it, creating a link to /etc/systemd/system. This service starts on boot and runs in the background. We want to change that to only start when we need it to. We do this with timers.

A timer is a systemd file that starts a service according to a schedule. I used this functionality to only trigger the service an hour before I do my daily backup.

Before we start stop and disable the idrivecron service: sudo systemctl stop idrivecron.service sudo systemctl disable idrivecron.service

Navigate to usr/lib/systemd/system and take a backup of the idrivecron.service file. I named mine idrivecron.service.backup, to avoid making it available to systemd. You could argue nothing should be in there that isn’t a valid service. In which case if you feel strongly about that, move it somewhere sensible - the key is to make a backup.

Edit the idrivecron.service file. Towards the end you’ll see the following:

[Install]
WantedBy=multi-user.target

Remove this section and save the file.

Create a timer file called idrivecron.timer in the usr/lib/systemd/system folder as before. It’s important the name is the same as the service, just with the timer extension.

Add something similar to mine. I do my backup once a week at 3am, so I start this service at 2am, just to make sure it’s done any housekeeping it needs to in preparation for the backup:

[Unit]
Description=idrive start timer

[Timer]
OnCalendar=Sun *-* 02:00:00
Persistent=false

[Install]
WantedBy=timers.target

Breaking it down, the Unit contains a description, can be anything.

The Timer section is when you want it to start (Mine is Sunday morning, any date, at 2am). There’s a great section on the arch wiki that goes into detail on the timer and how to get the syntax correct.

Persistent means it won’t try to start if it’s unable at that time. For instance, if your PC was off when it was due to run, if persistent was set to true it would fire up on the next boot.

The last section, Install, tells systemd to install this as a timer.

Once this is done you need to enable the new timer:

sudo systemctl enable idrivecron.timer

That’s it! Now the backup scripts will only run when you need them.

There’s a few caveats with this approach, as you’d expect.

  1. You won’t be able to access your PC from the web interface online, to make changes to the backup. You’ll have to start the service and wait for a bit for the PC to talk to the IDrive online service before it shows up in the Dashboard.

  2. The IDrive service actually runs a pearl script, which in turn fires up other scripts. When the backup is finished, the scripts will still be running (as before). You’ll either need to kill them manually (pkill IDrive?) or reboot the computer to rid yourself of them. You could create another timer, using the methods above, that invoke a script to pkill IDrive at some time when you know the backup has been completed. I haven’t done this as I’m happy once a week to make sure the backup is done and then kill the pearl scripts manually.