Harddisk Management

KnipselLinux has a tree structure for storage on hard disks. During installation of Ubuntu, the SSD harddisk is setup to be the top (first) drirectory on the system. The top directory is “/”. When the installation is finished, this disk, the SSD, becomes the highest level in the disk hierarchy being “/”. On the right a part of the main directory of hover is displayed.

The directory /media contains five directories. Four of these /media/d1, /media/d2, /media/d3 and /media/d4 are the harddisks where the data is stored. “/media/usb-drive” is used as mount point fot an eventual external disk. As an example the NextCloud data of the system is stored on /media/d1/nextcloud/.

Directory and filenames are case-sensitive. That is, media and Media, are different directories. Also for filenames one has to be careful to be precise in using directory and filenames, for instance in script files.

During boot, devices present in the /dev directory will fired up depending on configuration files. For the harddisks this is /etc/fstab. Harddisks are identified bij the letters sd. The first harddisk found is sda, the second sdb, to third sdc, and so on. The first partition of harddisk sda is called sda1, the second partition on sda is called sda2, and so on. At boot time, by means of fstab the deveces are mounted to a directory after “/”. This directory can be /mnt but also /media is often used. An example of the /etc/fstab file looks like:

KnipselHard disks are mounted using a file in a directory of “/”. Usually the / media directory is used for this. Actually it does not matter and you could also mount a hard disk in / dev or in / mnt. By default, however, is media. So during the “mount” command, a file is connected and used as the connection to the hard disk.

Ubuntu likes to identify equipment through UUID (Universally Unique Identifier). This makes sure that is a harddisk is wired up to an other SATA port it is still correctly identified. For that reason all harddisks are identified with an UUID.

All these matters can be arranged via WebMin. Use “Hardware / Partitions on Local Hard Disks” in the first instance. When the partition is created, the disk / partition can be permanently mounted via “System / Hard Disk and Network”. Webmin makes the correct changes in /etc/fstab so that after a reboot the disks are automatically mounted again.

Allowing harddisks to spindown (go idle)

When the discs have nothing to do, we can stop the motors. That saves 4-8 watts depending on the supplier and the design of the hard disk. To this end, we have to add a number of rules to the configuration file of the hard disks:

sudo nano /etc/hdparm.conf
Hard disks are indicated in Linux by sda, sdb, sdc etc. The SSD drive should not be stopped. Rotating harddisk however benefit from spindown. Add the following lines to the end of the file for each drive:

Knipsel

To test if, after a while, the harddisk is really stopped the following command can be given:

sudo hdparm -C /dev/sdb

Or combined:

sudo hdparm -C /dev/sdb /dev/sdc /dev/sdd /dev/sde

Reclaim reserved harddisk space

Standaard zal linux bij elke schijf een ruimte reserveren van 5% om eventuele systeem groei te kunnen opvangen. Aangezien wij in de NAS alleen data opslaan op de harddisks is dit niet nodig. We verkleinen de reserve ruimte naar 1%.
sudo tune2fs -m 1 /dev/sdb1
sudo tune2fs -m 1 /dev/sdc1

 

Last updated 27 september 2018

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *