CRON | how to pipe stderr to /dev/null

If you get a lot of mails to your root account with output from your cronjob then it can be solved by redirecting your output from the job to /dev/null by adding >/dev/null 2>&1 to the end of your crontab line.

Like this example from my /etc/crontab where i sync my nameservers during the day

*/30 5-23 * * * root /root/sync_dns >> /var/log/sync-dns.log >/dev/null 2>&1

How to Boot Raspberry Pi from USB Hard Drive

Raspberry Pi’s normally boots from a SD/Micro SD card. That also means that your root and home partitions lives on the SD card and there is a lower limit to how big it can be and how fast it is compared to normal Hard Drives and SSD drives. Sometimes it can be better to move all other but the /boot partition to an external Hard Drive.

Here is how to move allready existing partitions to an external drive.

1. First fdisk the drive and create an EXT4 filesystem

FDISK

fdisk /dev/sda
delete existing partitions
create new Primary Linux partition as /dev/sda1
write the system to disk with the command w
exit fdisk 

CREATE FILESYSTEM

mke2fs -t ext4 /dev/sda1

2. Mount the External Harddrive on your Raspberry Pi

sudo su
mount -t ext4 /dev/sda /mnt

3. Install rsync

sudo apt-get install rsync

4. Copy all the files from the microSD card to the external hard drive. By using rsync then all file permissions and ownership are keept intact.

sudo rsync -axv / /mnt

this will take a while to finish.

5. Then we need to modify the Raspberry Pi’s startup file, Your device will look for it on the SDCard in the /boot partition

nano /boot/cmdline.txt

We need to edit two parts of this line. Change the root= to /dev/sda, add rootdelay=5

It should look like this

6. Then we are adding the hard drive entry to “/mnt/etc/fstab” so the root folder in the external hard drive is automatically mounted at boot up.

nano /mnt/etc/fstab

Add this to the end of the file

/dev/sda1       /               ext4    defaults,noatime  0       1

Comment out the line with the SDCard with a # so it look like this

#PARTUUID=c1c4201a-01  /               ext4    defaults,noatime  0       1

After the changes, it should look like this (here is a screenshot from one of my Pi’s)

Reboot your Pi, and it should boot up and run from the external hard drive. One thing to note is that the microSD card needs to be in its slot, as the Pi needs to read the startup file from it before it boots up on the drive you wan’t

It is also possible to boot without the SDcard, but this way is how i prefer it to be done as it is very easy to switch back to the SDcard…just change the

Here is how the result can be with an External 1 TB USB Hard Drive.

Dedicated Raspberry Pi hosting

I have expanded my project with a Dedicated Raspberry Pi 3 hosted in Czechia.

My goal is to move my PHP Server Monitor, DNS and Mail backup services to the new server.

The first year will cost you 110 Euro with a Raspberry Pi 3 + 32 GB SD Card. The following year the cost will be 36 EURO and that makes it a very cheap dedicated server.

Watch the video below about their datacenter….

You will get 100mbit with unlimited bandwidth included.

Read more about this at https://raspberry-hosting.com/en

Adminer – MariaDB/MySQL/PostGreSQL/SQLite Database management in a single file

If you wan’t easy external access to a MariaDB/MySQL/PostGreSQL/SQLite and some other known databases that consist of a single php file that is easy to setup on any webserver with PHP then Adminer is a great and handy little solution to install.

Here is a small screenshot of the system, it allows the most basic SQL features as creating a database, handle table schema, insert, update, create an query a database.

Adminer is also faster and tidier than phpMyAdmin that would be the closest similar management system.

Read more and download Adminer here

Home Datacenter move to small room

Today i had to move my little datacenter due to noise and all the flashing lightsto a small room in the attic that i have. That also required a lot of cabling from my network router that had to stay in my living room because of the short coax cable it use from the wall.

I cause approx 30 minutes downtime, so my uptime for my sites are now 99,733% for the past 3 month (phpservermonitor is running drop1.mitdk.net), hoppefully i will catch up and this will be a permanent solution. There is plenty of room for more Raspberry Pi’s.

I have taken a new foto, only thing that is not used right now and running is the old Lenovo PC, but i will have that as extra capacity if the Raspberry’s can’t handle the workload.

Right now i’m happy about the low electricity costs for this small datacenter of mine 😉

The small black box in left side is a Raspberry Pi 2 with Nginx as reverse proxy, Postfix SMTP, Dovecot IMAP/POP3 server and loadbalancer,  3 Raspberry Pi 3’s in right side with Apache/PHP7 and one of them is running MariaDB and BIND DNS. They are using a QNAP NAS 269 PRO in my for NFS shares since the local SD cards are to slow and to prevent them to wear down too quickly. Has been running allmost without any downtime. I have one VPS server at Digitalocean as backup MX and primary DNS server.