Configuration ============= In most situations Wattsworth should work well with the default settings. For more complex setups involving systems that may loose power, are connected through networks, or other special cases the reference material in this section shows how to fine tune the installation to meet these needs. Storage ------- Make sure you set up data journaling on the nilmdb partition. This will prevent data corruption if the computer looses power without properly shutting down. Edit ``/etc/fstab`` and add the ``data=journal`` option to the parition with the nilmdb database. .. code-block:: bash # /etc/fstab: static file system information. # # UUID=XXX / ext4 errors=remount-ro,data=journal 0 1 # add this --^ If the partition is the root partition you must add this option directly to the volume as well, otherwise the system will not boot properly. For example if your root partition is on ``/dev/sda2``: .. code-block:: bash $> sudo tune2fs -o journal_data /dev/sda2 Storage Setup

This section explains how to properly format and configure an extra hard drive for a NILM system. It is usually a good idea to place the Nilm Database on a seperate hard drive. This prevents the database from filling the primary drive to the point where the system become unusable and also makes it easy to retrieve collected data from an installation by simply swapping out the extra harddrive.

Formatting a drive After installing the drive and booting the system, the first step to use the drive is to place a usable filesystem on it. There are many tools that can be used for this but one of the easiest is GParted. This program must be run as root. From the command line type type the following:

Be very careful with gparted, formatting the primary drive will destroy the installation

Select the extra drive from the dropdown menu as shown. Generally the extra drive should be /dev/sdb but this is not always the case. If the drive already has multiple partitions this most likely means it is the primary drive.

<%=image_tag "hdd_gparted_1.png"%>
Carefully select the device node for the extra drive
<%=image_tag "hdd_gparted_2.png"%>
Create a new msdos partition table. This will erase the drive.

Select Device > Create Partition Table to bring up the Create Partition dialog. Select msdos and click Apply. Select Partition > New to bring up the New Partition dialog. Add a new ext4 partition to the drive and assign it the full extents of the disk (this is the default). Click Add to close the dialog. Finally click Apply to format the disk and then close the program.

<%=image_tag "hdd_gparted_3.png"%>
Add an ext4 partition to fill the disk

To use the drive for the Nilm database it must be mounted to the correct location in the filesystem. Edit /etc/fstab in a word processor and add the following line where /dev/sdX1 is the name of the drive you just formatted. The number one refers to the first (and only) partition. Note that you will need to run the word processor as root (sudo) in order to edit this file.

      /dev/sdX1 /opt/data ext4 errors=remount-ro 0 1 
When using an external drive as the primary storage volume, drive letters cannot be used since they change. The UUID is a unique drive partition identifier that should be used instead. Running sudo lsblk /dev/sdX1 will print out the UUID. The new line in /etc/fstab should resemble the following.
      UUID=XXXXXXXX-XXXXX-XXXX-XXXX-XXXXXXXXXXXX /opt/data ext4 errors=remount-ro 0 1 
Run the following commands to mount the drive and setup the permissions. Use df to verify the configuration:

The output from df should look similar to that below:

    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda1       1.8T  5.3G  1.7T   1% /
    ... other mount points ...
    /dev/sdc1       917G   72M  871G   1% /opt/data

If you have already configured your meters and want to start collecting data, run: