When using a CF-card as the system disk, it is advisable to link permanent writing files to an external media to extend the lifetime of that flash memory. An external hard drive can be for example an USB stick or USB hard drive.

Preparation of the USB-media

Integrate the hard disk via Webinterface

The first step is to connect the device to one of IPFire's USB ports. Then the external media will be tethered by the service ExtraHD via the web interface in the menu --> Services --> ExtraHD. In the area below the new media /dev/sdb can then be integrated by clicking the red pencil with the "+" symbol.

Now the new media should be listed in the upper section of the ExtraHD site and may look similar to the following screenshoot:

UUID=abcd1234-1234-1234-abcd-1234567890     auto    /mnt/WhatEverYouEntered

Prepare IPFire over the shell

Connect to IPFire now via Putty, WinSCP or simply by the console via SSH .

You should enable the SSH service and log in with:

ssh -p 222 root@yourIPFromIPFire

Now the new target directory, where the logs should be placed on the new media, will be shown.

  1. Create the log directory for the USB-media:
mkdir /mnt/MyNewHD/log
  1. Copy the existing log file content to the new directory:
cp -a /var/log/* /mnt/MyNewHD/log/
  1. Investigate the UUID if it isn´t established yet:
[user@myipfire~]# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 2012-01-14 12:56 qwertzui-2af7-4729-qrst-123456789012 -> ../../sda4

lrwxrwxrwx 1 root root 10 2012-01-14 12:56 asdfghjk-1318-4239-mnop-123450987650 -> ../../sdb1

lrwxrwxrwx 1 root root 10 2012-01-14 12:56 yxcvbnmä-573a-4713-ijkl-567890543215 -> ../../sdb2

lrwxrwxrwx 1 root root 10 2012-01-14 12:56 üpoiuztr-9231-4524-efgh-098765432109 -> ../../sda1

lrwxrwxrwx 1 root root 10 2012-01-14 12:56 äölkjhgf-fb35-4922-abcd-222223334444 -> ../../sda3


Notes:

  • sda1 & 3 & 4 are the sectors of three partitions of the system on the CF Card
  • sdb1 is on the USB-media which will be used for the log directory*
  • sdb2 is a section on the USB-media which won´t be used in here*

Customize the FSTAB

  1. Now the FSTAB will be configured with the investigated UUID for e.g. sdb1:
nano /etc/fstab

Find some additional information how to use Nano here.

UUID=asdfghjk-1318-4239-mnop-123450987650 /var/log ext2 defaults 0 0
  1. Rename the log file:
mv log logold
  1. Secure remove of the log backup (e.g. with logged):
cd /var/
rm -rf logold

Note!
If you delete the directory, it is possible some functions are bugging out (e.g. cron/logwatch) and statistics may be wrong. So it should only be deleted if you are really sure that the USB-media is used for the log. This can be checked if the Firewall-Logs in the webinterface are up to date.

  1. Now create a symbolic link, otherwise the system will do it:
cd /var/
ln -s /mnt/MyNewHD/log/ /var/log
  1. Check if the symbolic link was created:
cd /mnt/MyNewHD/log
ls -al

The output should look like:

rwxrwxrwx 1 root root 10 2012-01-14 12:56 log -> /var/log

Now the system can be rebooted and from now on the logs should be written to the USB-media.

Note!
After updates the symbolic links will be overwritten and set back to default. Repeat the steps from mv log logold --> ln -s /mnt/MyNewHD/log/ /var/log and reboot the system to let the changes on the system take effect. That´s it.

Note!
Core Updates may cause issues. If there are update jumps over two or more versions, the log directory should be copied back to the original drive otherwise faults will be occur.

The IPFire team would like to say thanks to 5p9 for this wiki :-)