Montag, 30. Dezember 2019

Fix corrupt MailStore Home Database

If you get errors about data corruption when starting up MailStore Home, here's how you can fix it.

MailStore uses a Firebird Database for storage. Luckyily Firebird includes tools to repair databases. Lets get them here:

https://firebirdsql.org/en/server-packages/

Version 2.5 worked for me for Mailstore 11.2. On newer versions of MailStore you might want to try a later version.

This guide was perfect for the repair run
https://www.ibphoenix.com/resources/documents/how_to/doc_5

Notice: You'll need to add the switches to access and to restore the databases.
 -u SYSDBA and -p masterkey

Before you start, backup your corrupted database MailStoreFileGroup.fdb.
This is what I ended up doing:

(1) Fix the errors

gfix.exe -m -f -i -user SYSDBA -password masterkey MailStoreFileGroup.fdb

(2) Backup the database
gbak -b -v -i -user SYSDBA -password masterkey MailStoreFileGroup.fdb backup.fbk

(3) Restore the database
gbak -create -v -user SYSDBA -password masterkey backup.fbk MailStoreFileGroup_reborn.fdb

Finally, replace the MailStoreFileGroup.fdb by MailStoreFileGroup_reborn.fdb

Mittwoch, 15. August 2018

Replacing a drive by a bigger one on 2-bay Synology NAS

I have a Synology NAS 216play with two drives (2TB, 4TB) as individual drives.
I recently wanted to replace my 4TB HDD by a 8TB HDD. I wanted to keep my data in order to omit re-indexing all media. To my surprise I really couldn't find any decent tutorials or videos on how to do it excep for "back up the data, setup the NAS from scratch and restore it".

Well, I found a more elegant solution.
Notice: This tutorial only works if you have your volume setup as "Basic".








Here's the plan:

Prepare

  • Most importantly: Do a backup of your data. In case something goes wrong!
  • Remove all drives BUT the one you'd like to replace by a bigger one. Don't worry about the Operating system, it's mirrored to all drives. You station will boot up no matter which drive you remove. 
  • Add the bigger (empty) drive in the slot
  • Boot up the NAS 

Clone the drive

In order to clone the drive we'll just setup a RAID1 (mirroring)
  • open the storage manager
  • Open the Volume Manager Assistant by clicking "Manage"
  • Change the RAID type to RAID1
  • Select your empty drive to be added
This process can take a couple of hours

Remove the smaller drive

It's not as easy as it sounds as we need to tell Synology that this drive is no longer part of the RAID. If you just remove it, it will complain that the drive is missing.

Login via SSH as admin

sudo su 
fdisk -l



Now you need to identify the smaller drive, in my case it's /dev/sda
In order to remove the device from the RAID Array issue the following commands if /dev/sda is the smaller drive:

mdadm --fail /dev/md0 /dev/sda1 --remove /dev/sda1
mdadm --fail /dev/md1 /dev/sda2 --remove /dev/sda2
mdadm --fail /dev/md2 /dev/sda3 --remove /dev/sda3

or these if /dev/sdb is the smaller drive

mdadm --fail /dev/md0 /dev/sdb1 --remove /dev/sdb1
mdadm --fail /dev/md1 /dev/sdb2 --remove /dev/sdb2

mdadm --fail /dev/md2 /dev/sdb3 --remove /dev/sdb3

Three times because it needs to be done for every partion on the drive. There are two system partitions and one data partition. Now the disk station will start an alarm beep because it's missing the drive. Continue to tell synology that only one drive is expected:

mdadm --grow --force /dev/md0 -n 1
mdadm --grow --force /dev/md1 -n 1
mdadm --grow --force /dev/md2 -n 1

You can now shutdown and remove the smaller drive. It should boot up perfectly fine on the new drive. 

Expand the volume

  • open the storage manager
  • Open the Volume Manager Assistant by clicking "Manage"
  • Expand the volume with unallocated disk space
This will grow the volume to take all available disk space. It only takes a couple of minutes. 

Shutdown the disk station and put the other drive back in. 
Done!



Mittwoch, 4. Oktober 2017

Installing MQTT Server


sudo apt-get install mosquitto

Modify the config file at /etc/mosquitto/mosquitto.conf

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
#include_dir /etc/mosquitto/conf.d
allow_anonymous false
password_file /etc/mosquitto/pwfile
listener 51883



sudo mosquitto_passwd -c /etc/mosquitto/pwfile <username>

Donnerstag, 25. August 2016

Download Speed test as cron


To download a file regularly and log the speed in a file, add the following to a script and run the script with cron

wget -O /dev/null http://url.to/file.avi 2>&1 | grep --only-matching '\([0-9.]\+ [KM]B/s\)' | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }'  >> /home/user/download.log

Dienstag, 13. Oktober 2015

check_mk monitoring SMART values on debian

I was recently setting up check_mk as monitoring solution for my linux servers. It's a very conventient solution and installed in minutes. Now I wanted to go further and monitor the HDD S.M.A.R.T values of the HDD such as temperature.

Adding the plugin

For the additional check, a plugin is required. The plugin comes with the check_mk installation. Since I installed the OMD (Open Monitoring Distribution), the plugins can be found here:

/omd/versions/default/share/check_mk/agents/plugins/

Just copy the plugin called "smart" to the server you're monitoring into the agent plugins folder. I installed the agent using apt, my plugins folder is here
/usr/lib/check_mk_agent/plugins

Installing smartmontools

Since check_mk uses smartmontools, you'll need this package:

apt-get install smartmontools

Check the output

Run
/usr/bin/check_mk_agent | grep smart
and it should give you a line <<<smart>>> as output.

Reinventorize

Reinventorize your host and you'll see the new SMART values.
That's it. 

Donnerstag, 13. September 2012

Creating a secure user for home banking

People (like me) tend to use more and more useful applications like skype, dropbox and others that run as a service in the back. Additionally, a couple of addons are installed in the browser. Everytime I enter enter my homebanking account in my browser, my gut says: Do you really trust all of the sofware? It could easily log your banking PIN and forward it to some criminals.
To make my gut feel better, I created a separate windows user just for home banking. To be clear: If you're infected by a virus, this doesn't help. Always keep your antivirus updated! Benefits of this solution
  • No apps running in the back that could be nosey about my PIN
  • No addons in firefox that could grab inputs or modify outputs
  • Separate user data that can be secured
Step 1: Normal Accounts
First of all, your regular user account should not be an administrator. If you accidently download malware, it's very helpful if your account does not have admin permissions.

Step 2: Create new user
Create a new user account named "Homebanking". Make the accound a regular account, not administrator and set a password.

Step 3: Disable autostart
Login with the new user and run "msconfig" from the commandline. In the startup tab, you can see all autostart applications and the location they are configured to be started. Most of them are located in the windows registry in HKCU or HKLM. To disable the startup only for the homebanking user, there's a simple trick. Open startup the registry editor "regedit" as administrator. Navigate to the paths listed in the location column. In total, there are only 3 or 4 locations that should get you covered. All of them have a "run" folder. Right-Click the run folder in the regestry editor and change the permissions. Disable access for the "homebanking" user. This way, this user won't have any autostart.


Step 4: Encrypt the data
Logout the homebanking user. Login with an administrator account and navigate to C:\Users
Open the properties of the "homebanking" folder and enable encryption.

Step 5: Setup Browser
I prefer firefox. Install it (if not done, yet) and run it. You should have an empty profile now with no addons. If there are any addons, please carefully check, if you want them there or not. I'm okay with a addon from my antivirus software. Everything else will be uninstalled. Setup the bookmarks to your bank accounts or just set the default start page.

That's it!

I recommend not to use the homebanking account for anything else but home baning. I typically even don't visit any websites but my bank site.

Sonntag, 16. Oktober 2011

Installing Android on HP Touchpad

 

Cyanogen Mod 7.1 is released in an alpha version which you can install on the HP Touchpad. It’s a ported version of android gingerbread. The procedure will take you about 15-20 minutes overall. There are some issues with the alpha such as instable wifi, but I already like it much better than the WebOS.

 

What you need

 

Install Novacom

Run the setup of the SDK/PDK you downloaded. Select only the commandline interface tools

image

 

Copy the files to the Touchpad

  1. Connect the touchpad via USB. Tap the device notification on the touchpad to mount a drive in windows.
  2. Create a new folder called “cminstall” in the root directory of the tochpad.
  3. Copy the moboot, update-cm… and update-cwm_tenderloin… zipfiles into the folder
  4. Unmount the drive and unplug the USB for the touchpad to go back to normal operation mode

 

image

 

Start the installer

  1. Replug the USB cable, don’t connect as drive this time
  2. Reset the touchpad throuch Settings > Device Info > Reset
  3. When the screen turns dark, hold the volume-up key until the USB-Symbol appears
  4. After a few seconds, the PC should recognize the touchpad device
  5. Open a commandline window and navigate to the Novacom installatin location. In windows this is C:\Program Files (x86)\Palm\SDK\bin
  6. Unzip the acmeinstaller.zip and copy the ACMEInstaller file to the novacom location
  7. Run novacom boot mem:// < ACMEInstaller
  8. After a few seconds, the touchpad shows a linux terminal and executes the installatin procedure
  9. When done, it’ll boot into Android

 

Install the google applications

Cyanogen Mod 7.1 comes without any google applications such as Market, GMail, Maps, etc. Here’s how to install them.

  1. Boot the touchpad to android
  2. Connect it via USB to the PC
  3. in the android taskbar, enable the USB Storage
  4. In windows, copy the gapps-gb-full… file (you downloaded in the beginning) onto the touchpad
  5. Reboot the touchpad
  6. In the boot menu, select “Clockwork Mod” using the volume keys. Confirm with the home button
  7. select install zip from sdcard > choose zip from sdcard
  8. Select the gapps-gb-full… zipfile for installation
  9. Reboot
  10. Setup your google account

That’s it. You now have a market and you can install any apps you want. You have about 1.3 GB for apps, so don’t worry about the space Smiley

 

My Wifi hangs

The only issue I had so far was the wifi. Sometimes it doesn’t connect anymore and if you open the Wifi settings, it hangs.

If that happens,

  1. delete your wifi from the list (navigation in the settings is very slow, but it still works). If you don’t manage, reboot it and try then.
  2. Turn the touchpad off (reboot is not enough!). When it reboots after you selected “shutdown” (happened to me) just select shutdown again from the boot menu.
  3. Wait 30s, then startup the touchpad
  4. Once booted, configure your wifi connection again

After those steps, it instantly connected.