Backup your website over FTP

One of my customers is being hosted at a crappy hosting provider, which I do not trust at all. In fact, I have actually seen that I made changes to the website, which were reverted a couple of days later.

To never lose any data on the FTP, I wrote a script to make backups of the FTP, while not wasting too much bandwidth or disk space. I based this script on the principle that rsnapshot uses: hardlinks and rotation.

for i in `seq 100 -1 2`; do
        if [ -d $i ]; then
                echo mv $i $((i+1))                                                                 
                mv $i $((i+1))
echo cp -al 1 2
cp -al 1 2
mkdir -p $LCD            
lftp -c "set ftp:list-options -a;
set ftp:ssl-force;
open ftp://$USER:$PASS@$HOST;
lcd $LCD;
cd $RCD;
mirror --verbose \
       --delete \
       --exclude-glob __old \
       --exclude-glob phpmyadmin

In this example the directory __old is not copied, nor is phpmyadmin. What is does, is move the directory 99 to 100, then it moves 98 to 99, 97 to 98 etc until 2 is moved to 3. It then hardlinks the directory 1 to 2. This way, a 100Mb file that is not modified can exist in all 100 directories while only using one single block of 100Mb of disk space.

Finally, the script uses lftp to download all modified files from the remote ftp server. Luckily, lftp doesn't just open a local file to modify its contents: instead remotely modified files are first unlinked locally, then re-downloaded. This way, lftp does not interfere with the hardlink system.

Database backup

This method does NOT backup your database. Don't forget to backup your database!

© GeekLabInfo Backup your website over FTP is a post from You are free to copy materials from, but you are required to link back to

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

PXE Boot with old-style dhcp and tftp

In this article I'm covering the use of old-style dhcp and tftp, which is useful for company networks that have/need a complete dhcp server running. Personally, for smaller setups, I now prefer dnsmasq to do the job.

Booting from PXE

With most modern onboard and PCI network interface cards (NICs), it's possible to boot from the network. This system is called PXE.

Why would I want to boot from the network?

  • For installation of a computer without using CDs/DVD's
  • For thin clients
  • For booting diagnostic software
  • What is needed for PXE Boot?

  • a network card that supports PXE
  • a bios that supports plugin boot cards
  • a DHCP server
  • a TFTP server
  • some (open source) software you want to run
  • How to set up PXE boot?

    As I'm running (a variant of) RedHat Linux, I only cover how to set up PXE boot using Linux components. But there are Windows solutions as well. (Google it!)

    Step 1: set up DHCP

    When the NIC boots, it needs to get IP settings. Setup dhcp as usual. Now add these lines to the configuration:
    filename "/pxelinux.0";

    In the place of, you need to enter your own tftp server address.

    On my RH system, I installed the dhcp server using yum install dhcp, then configured /etc/dhcpd.conf as follows:

    ddns-update-style ad-hoc;
    log-facility local0;
    default-lease-time 86400;
    max-lease-time 86400;
    subnet netmask{
    range; #limited range
    option subnet-mask;
    option broadcast-address;
    option routers;
    option domain-name-servers;
    option domain-name "lan";
    filename "/pxelinux.0";

    Step 2: set up TFTP

    Download and install a tftp server. Most Linuxes ship their own, which you can install using yum (RedHat), yast (SuSE), apt-get (debian/ubuntu) or similar.

    On my RedHat, I install a tftp server by running yum install tftp-server. Then I enable it using /sbin/chkconfig tftp on and reload xinetd: /sbin/service xinetd restart.

    Step 3: download and install syslinux

    On my RedHat system, I install syslinux by running yum install syslinux. I then copy the syslinux.0 file to /tftpboot: cp /usr/lib/syslinux/pxelinux.0 /tftpboot

    Optional: Firewall

    On a default RedHat installation, the firewall is enabled. You may need to open port 67-69 for dhcpd and tftp to function and port 53 for DNS.


    More details are described on

    © GeekLabInfo PXE Boot with old-style dhcp and tftp is a post from You are free to copy materials from, but you are required to link back to

    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)