Throttle a Robocopy

You can throttle a Robocopy to avoid consuming all available network bandwidth by using the /ipg:n switch. This can be helpful if you need to perform a large data copy over a WAN.

To determine the inter-packet gap value to use for n, use the following formula:

D = (Ba-Bd) / (Ba*Bd) * 512 * 1000

Where Ba is available bandwidth in Kibibytes and Bd is the desired bandwidth in Kibibytes.

Also here is a handy calculator to help you test your values.

Continue reading

Quickly find files on macOS via the Terminal using mdfind

Spotlight Search

MacOS users can use Spotlight to help them find apps, documents, and other files on a Mac computer. Spotlight builds and maintains an index containing all this information which makes it easy to quickly find what you are looking for.

But did you know the Spotlight index is also used by mdfind, which is a command designed to be run from the terminal?

Continue reading

Encrypt a disk in Ubuntu Linux using Cryptsetup

LUKS Linux Unified Key Setup

Cryptsetup is a utility used to setup disk encryption and is based on the DMCrypt kernel module. It implements LUKS which is the standard for Linux hard disk encryption.

LUKS provides a standard on-disk-format and facilitates compatibility among distributions while also providing secure management of multiple user passwords. In contrast to existing solutions, LUKS stores all setup necessary setup information in the partition header, enabling the user to easily transport the data.

Today we will examine how to setup encryption on a 32GB SanDisk USB thumb-drive using Ubuntu Linux.

Continue reading

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