Plesk panel, backup strategy when low in space

Plesk backup is a real pain in the backside, if your server disk space is limited, even when choosing to backup in a ftp repository. All the files are created locally and then send over via ftp.

Prerequisites

Note that in order to implement this backup strategy, one must have an external backup space available like rsync.net (which I use) so that you can use the “rsync” command to transfer your files.

Minimising disk usage

In order to exclude any gigantic compressed (or not) archives being stored in your local hard drive, here is a little guide to help you avoid filling your server disk.

The first thing to backup regularly is the Plesk server configuration, this backup will not save the websites/email/database data but the content/configuration of your Panel, which is the first thing to restore if your server packs up.

Backing up Plesk (11) configuration

  1. Open your Plesk Panel as Admin
  2. Choose Tools & Settings from the Server Management sub-menu
  3. Click on Backup Manager
  4. Select Scheduled Backup Settings
  5. Activate the scheduled backup
  6. Select Store backup in: Server repository (or you can chose ftp there also as the files aren’t big, a couple of MB’s)
  7. I have set the Maximum number of backups in repository to “3”, but you can choose another value here
  8. Under the Backup content section, select  “
  9. Press OK

Obviously the choice of Schedule and prefix is at your convenience, I personally back up every day at 00:10 and the prefix is set to “configuration”.

If you aren’t using ftp, the content of this backup is stored in the /var/lib/psa/dumps/ directory. So in order to backup this on another server, simple rsync this location with a command that could be:

rsync -avz /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps

If you don’t want to keep aggregated data add the –delete option:

rsync -avz --delete /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps

To automate

To automate all this simply stick it in a cron (one can use the “Scheduled Tasks” under “Tools & Settings” (select root user) with a command that could look like this:

nice -20 rsync -avz --stats --delete /var/lib/psa/dumps/ user@domain.rsync.net:var/lib/psa/dumps 2>&1 | mail -s "backups dir rsync report" you@youremail

Databases

I will refer to MySQL databases in this section.

Database content is important, and you must back them up regularly, be it incrementally or not. I have Perl scripts that are in charge of dumping the content of the entire dataset and compress it. The file for my setup ends up being about 300MB, which is acceptable. I proceed to dump the content of the dataset via a “schedule” (root cron) and another cron simply “rsync’s” this file over to the backup server.

Email

All the email accounts are in /var/qmail/mailnames, the process is the same as above, use a rsync via a cron:

rsync -avz /var/lib/qmail/mainames/ user@domain.rsync.net:var/qmail/mailnames

Website content

Same as email but the directory is /var/www/vhosts/ so:

rsync -avz /var/www/vhosts/ user@domain.rsync.net:var/www/vhosts

There you have it, obviously I am providing this entirely as guidance and will in no way be liable for any loss you may get using these instructions. Even if you are on a cloud server (like me) it is a good idea to be able to extract files, especially databases or web content should a mistake be made that a cloud server cannot prevent like deleting a site by mistake etc…

Feel free to comment if you have any questions or if I have missed some important bits to backups that a Plesk backup may make which aren’t in this article.

Enable Grub multi-boots after re-installing Windows

My current working PC is a Dell Studio 1537 Laptop. This Laptop is configured with two Operating Systems; the first is Windows XP Pro, the second is Linux, more precisely Kubuntu.

Kubuntu is my [favourite] working OS, however the rest of my family “prefer” Windows for “Gaming”, I occasionally need to be able to use Windows in native mode for my work (I am a Webmaster for several Websites) so I need to see how they work using Internet Explorer :-(, mind you I usually use Virtualbox on Kubuntu to achieve this [but it’s a little slow], so I have a Dual boot which is managed by Grub. I have been playing with different versions of Windows on this Computer, the pre-installed OS was Windows Vista, which quite frankly, sucks. So I tried to install Windows XP Pro pretty much straight away. I gave up when I encountered the Blue Screen Of Death (BSOD) and subsequently installed the 90 days Windows 7 Enterprise trial.

This Version worked very well, only to shut down every hour as it was,after all, a trial version. So I had to find a solution to this, I finally decided to retry installing Windows XP Pro as there was no way that I’d re-install that joke of an Operating system called Vista.

The other problem, is that MS Operating System overwrites the MBR (Master Boot Record) and therefore prevents me from having Grub giving me the options of which partition I want to boot from.

So here is walk through of how to:

  1. Backup the MBR (which is always a good idea by the way)
  2. Change the BIOS “Onboard Devices>SATA Operation”
  3. Install Windows XP Pro on the first Partition
  4. Install [almost] all the missing Drivers
  5. Re-install the backed up MBR and reconfigure Grub afterwards

In the past, every time I was re-installing [any] Windows, I never managed to figure out how to overcome the MBR being overwritten, the HowTo’s where very daunting and I always resolved the problem by re-installing the Linux OS afterward due to lack of spare time, as a side note, one of the recommendation I have is that: it is always a good idea to have a home (/home) partition separated from the root (/) partition*.

Linux is more forgiving than Windows (and, shall I say, less monopolistic) by gladly allowing several OS’es living side by side on the same Hardware and thus performs a multi-boot initialisation operation after each fresh install.

The other challenge is that this particular version of Hardware [Studio 1537] is not supported by Dell to run Windows XP Pro. That makes work just a little more difficult.

So here are the steps in more details…

1) Backup the MBR

To backup the MBR of a Disk with Linux is really simple. Open a terminal window and type:

sudo dd if=/dev/sda of=/media/External/sda.mbr count=1

Where /media/External can be an external Hard drive or USB stick etc… It’s best to have this file saved out-with the Hard Disk Drive that will be worked on, just to be on the safe side.

2) Change the BIOS

At boot. press F2 and go to the Onboard Devices>SATA Operation and change AHCI to ATA. Save the configuration then reboot. (this operation is only needed once, subsequent re-installs do not require this step)

3) Install Windows XP Pro on the first Partition

My System has a couple of Partitions:

  • sda1 = Windows + MBR
  • sda5 = Linux / + Grub
  • sda6 = Linux /home
  • sda7 = swap

Obviously Windows must be installed on the first Partition and that’s where the MBR is.

Simply insert the Windows XP Pro installation CD, tell it to use the first Partition (optionally format it as NTFS) and follow the installation instructions. This will install a working version of windows with minimal functions.

4) Install all the missing drivers

Once windows has finished being installed, all the drivers [that have not been already installed, and that’s quite a few] must be installed. This is where it is getting a little tricky. Due to the futile nature of the web, it is like looking for a needle in a haystack in most parts, not to mention the huge amount of websites that try to entice you to install their rogueware.  The first descent source of information regarding the required drivers I have come across is Dell Studio 1535 converted to XP Professional  (this link is now rotten) by “Wickman Studios”. Most of the drivers are available here. For my particular configuration, it’s been trials and errors, as I haven’t kept tab on the different drivers’ executables I tried, it is kind of difficult to be specific.

The last few drivers I needed that Wickman Studio Post did not have were the “unknown” device which I managed to solve with I found on Dell Studio 1537 Windows XP Drivers / Downgrade (this link is now rotten) written by “AZ cloud tech” which is also a good source of information.

I still had issues with the ITECIR Driver which I eventually found on the Lenovo website (this link is now rotten) (the link from the Wickman Studios was throwing a “zip file corrupted” error during install).

The final problem I still have is the 1394 Firewire Network adapter not being recognised, but I have disabled it as I don’t really need it, if you have any idea let me know 🙂

Once I got [almost] everything working, I installed all the Windows Updates and the [free!?] Microsoft Security Essentials (MSE) which is the only thing I will ever recommend to use from Windows, that’s rare coming from me, trust me.

 5) Re-install the MBR and reconfigure Grub

For this part, I wish to thank John S. Denker for his information regarding  How to Reinstall Grub Onto Your MBR which was extremely useful and the first clear and concise Howto I managed to follow and recover my Dual boot system with.

After a few lots of trials and errors I managed to get the Dual boot working. Here’s the final order I used:

  1. Back up the MBR before anything else
  2. Restore the MBR without disturbing the current partition table
  3. Get the system to boot, note: my $partition on point 6 is sda5 but it might be something else for your System, So I am not responsible if your system fails!

In my first atempt to install Windows, I had a fail due to a problem with the sda1 Partition, there was a formatting issue (probably due to the fact I installed winXP without reformatting the old Win7 Partition first), so when I tired to do a Follow up I got a “Stage 1 error”  this problem got fixed when I did a full NTFS format prior to installing Windows XP again.

I also played with Using Grub Command Directly as before the re-install I was faced with the grub> command prompt at boot :-(, so just for the record, my root device is /dev/sda5. In addition as I had grub 2 installed, the correct command went from root (hd0,<tab> to:

set root='(hd0,<tab>

which in full is (don’t ask! It’s for the Record):

set root='(hd0,msdos6)'

Subsequently, the next command looks like:

linux /boot/vmlinuz-... root=/dev/sda5

Well, that’s it in a nutshell, I hopefully will not need to perform any of this again, as I made an disk image of sda1 with partimage and dd which is safely stored on an external USB Hard Disk Drive, I also have a complete backup of all the web pages, Zip archives and exectuables mentionned in this post just in case. One knows the elusive nature of the Web these days… So I hope this was worthwhile and may prove useful to someone else, in which case, good luck and let me know how you did.

*That way I can format / without losing all my stuff and simply mount my home Partition as /home after my install. This is also very useful when doing an upgrade as I know that none of my Data will be overwritten, I also do regular backups, that goes without saying.