How to use virtio-scsi with opennebula

to use virtio-scsi instead of virtio or emulated scsi just

* add the following line to /etc/one/vmm_exec/vmm_exec_kvm.conf

RAW    = „<devices><controller type=’scsi‘ model=’virtio-scsi’/></devices>“

* switch your device prefix to „sd“

DEV_PREFIX = „sd“

That’s it.

Now you should be able to trim f.e. your thin-provisioned storage and avoid wasting a lot of space.

Workaround for Dell Latitude E64310 UMTS Modem (Dell D5540) – Linux Systemd Suspend Resume

just a short note about how to workaround a small issue I had with this umts-modem after suspend / resume with debian jessie which is already using systemd.

The main problem is the ModemManager which should automatically detect your modem and forward this information to NetworkManager.

It looks like the kernel-module cdc_acm is creating new device-files during resume (f.e. ttyACM3/4 instead of ttyACM1/2) because ModemManager is still keeping the old file-handles active/open.

To workaround this you may:

* stop ModemManger => close file-handles
* unload cdc_acm => disable kernel-module
* load cdc_acm => enable kernel-module creating ttyACM0-3
* start ModemManager => detects modem and everything is fine.

There is also a small bug in the umts-modem. It will now respond for a while after loading the kernel module, so just add a small „sleep 10“ prior to starting ModemManager.

[ https://bugzilla.suse.com/show_bug.cgi?id=901122 ]

Here my files to automate this with systemd

* /usr/local/sbin/reset-modem.sh

#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin

case $1 in
resume)
modprobe cdc_acm
sleep 10
systemctl start ModemManager
;;
suspend)
systemctl stop ModemManager
modprobe -r cdc_acm
;;
esac

* Add execute-bit

chmod +x /usr/local/sbin/reset-modem.sh

* /etc/systemd/system/mm-sleep.service

[Unit]
Description=ModemManager sleep hook
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/local/sbin/modem-reset.sh suspend
ExecStop=-/usr/local/sbin/modem-reset.sh resume

[Install]
WantedBy=sleep.target

* Execute

systemctl enable mm-sleep

* Done

create dm-cache backed logical volume in 3 easy steps!

  1. Create a new/Find your old logical volume
    This volume may already contain data/filesystems and should be placed on slow(er) storage.

    #
    # lvcreate -n home -L100G vg_orange
    #
  2. Create your CachePool aka Backend
    A CachePoolLV contains a CacheDataLV and a small CacheMetaLV, both will be created automatically. Place this CachePoolLV on your fast SSD

    #
    # lvcreate --type cache-pool -n home_cache -L 30G vg_orange /dev/sda
    #

  3. Convert your Origin into a CacheLV

    #
    # lvconvert –type cache –cachepool home_cache vg_orange/home
    #

Now you may access your Origin just like you did before, but should become faster after a while (because cache needs to be filled)

fstrim doesn’t zero blocks – instead it just generates random data

This is may happen if you are using dm-crypt and correctly enabled „TRIM“ on all layers (fs, lvm, dm-crypt, ..), because the phy blockdevice correctly zeroed all blocks, but the crypt-layer tries to decrypt these and this will result generate random-data in upper layers.

Nothing to worry about, it’s not a bug – it’s a feature 😉

I found this while mkfs.ext4 filled my spares-images. I just created the filesystem with „-E nodiscard“ again and now qemu-img and dd are able to transfer only the used blocks.

Didn’t test it, but creating and deleting a huge file (filled with zeros) within an already existing file-system should also fix this.

ISPConfig – bug in handling of mail alias domains

Just got banned from T-Online.de-Mailservers, because someone spammed an alias-domain of my primary domain and postfix accepted every mail, but was unable to deliver to a suitable mailbox, so my mailserver bounced back to the fake-sender and this triggered the t-online.de-protection-system and my system got banned.

After taking a look I would assume it’s caused by an error in virtual-mailbox handling and found some suitable active bugreport.

Here my workaround which teaches postfix to only accept mails for existing boxes.

— /etc/postfix/mysql-virtual_forwardings.cf —

user = ispconfig
password = xXx
dbname = dbispconfig
hosts = 127.0.0.1
query = SELECT COALESCE( mailboxes.email, destination ) AS target FROM mail_forwarding LEFT JOIN ( SELECT email FROM mail_user UNION SELECT source FROM mail_forwarding WHERE TYPE = ‚alias‘ AND destination IN ( SELECT email FROM mail_user)) AS mailboxes ON ( mail_forwarding.destination = CONCAT( ‚@‘, SUBSTRING_INDEX( mailboxes.email, ‚@‘ , -1 ) ) ) WHERE active = ‚y‘ AND mail_forwarding.server_id =1 AND COALESCE(CONCAT(SUBSTRING_INDEX(mailboxes.email,’@‘,1),source), source) = ‚%s‘ UNION SELECT destination FROM mail_forwarding WHERE source = ( SELECT destination as d1 FROM mail_forwarding WHERE destination IN ( SELECT source FROM `mail_forwarding` WHERE type = ‚catchall‘ ) AND source = ‚%s‘)

Well, it’s not the best solution, but works for me. Maybe soneone else finds this usefull.

Bugreport: http://bugtracker.ispconfig.org/index.php?do=details&task_id=3021