Page 2 of 6

Automatically boot your Linux system using rtcwake and a cronjob

rtcwake is a program that is part of the util-linux package, was developed by David Brownell and improved by Bernhard Walle. This command is used to put a Linux computer to sleep and automatically wake it up at a specified time.

This can be useful for automating tasks while also conserving power. I combined this with two simple cronjobs so that my work computer will boot up and shut itself down automatically throughout the week.

To schedule tasks and kickoff scripts in Windows, Microsoft provides Task Scheduler however on Linux we use cronjobs. I am running an Asus Z170-pro motherboard and this process worked without having to tinker with any of the advanced power management settings. Below we will look at the steps that I took to get this configured.

Continue reading

Using dd to erase GUID Partition Tables (GPT)

Two disks that I had previously used on an mdadm mirrored raid were complaining about preexisting partition information and apparently thought they still belonged to a raid even though I had already zeroed out the superblocks.  These disks had also been formated with GPT. Mdadm alerted me to the remnants when trying to setup a new raid.

GPT stores its protective MBR, primary GPT header and primary GPT table within the first couple of logical sectors on a disk. Additionally a backup secondary GPT table and secondary GPT header are stored on the last few logical sectors .

Continue reading

Configure a RAID array using mdadm

Redundant Array of Independent Disks

Today we will  demonstrate how to create a mirrored raid using two identical 120GB hard drives. A quick lsblk will help us identify the devices that we will be working with.

lsblk
NAME    MAJ:MIN    RM    SIZE    RO    TYPE    MOUNTPOINT
sda       8:0       0    100G     0    disk
├─sda1    8:1       0     96G     0    part        /
├─sda2    8:2       0      1K     0    part
└─sda5    8:5       0      4G     0    part      [SWAP]
sdb       8:16      0    120G     0    disk
sdc       8:32      0    120G     0    disk
sr0       11:0      1   1024M     0     rom

As a best practice raw disks should be partitioned before creating an array. Additionally the partitions should be sized smaller than the max total size of the physical disk (a few megabytes will suffice). If the need arises to replace one of the disks in the future then this can prove to be useful since they may not be the exact same size and raid likes to deal with identical sizes.

Continue reading

Sorting with Linux

Lately I have been focused on e-mail archive migrations and often I find myself sifting through thousands of log files. The other day I needed to pull  entries from approximately  1500+ logs, roughly 8GB of data. Using grep I was able to pipe out the information that I was looking for into a file that I named execution_times.

grep -E -ron "Execution time:.{0,20}" > /media/RAMDISK-16GB/logs/execution_times

Continue reading

Creating a RAMdisk

RAMdisks are virtual partitions that reside in memory except all data is lost when power is removed from the system. Reads and writes are lighting fast in comparison to standard mechanical and NAND based storage. There can be real performance benefits when used correctly.

Today we will review how to create one on using a Debian-based distribution.

Continue reading

© 2019 revelset

Theme by Anders NorénUp ↑