Wednesday, October 3, 2012

SGS I900 with MIUI Android: 4.1.1 / MIUI: 2.9.29 battery drain solved!

I've recently updated my SGS to Android 4.1.1 thanks to MIUI. In previous releases I had problems with any kind of thetering (USB/WiFi/Bluetooth). In newest version everything runs out of the box (for now I only noticed I just can't turn on phone with power adapter plugged in). The problem which I encountered imidiatelly was battery file. Fully charged in 100%, kept for about 4 hours or something close to one-third of what it supposed to... The solution was simple as go to: Settings (Tab 'All') -> Programmer Options -> 'Drawing' section options "Turn off HW overlay" turned to true, and "Render on GPU" should be also set true. Now the CPU is not connected with graphic calculation of launcher / desktop. And keep really low while on idle. Hope that helps someone! PS: MIUI which I use You can find here: MIUI Galaxy S.

Thursday, June 28, 2012

OVH: How to synchronize backup files using FTP backup account?

Alongside with dedicated server or VPS (?) in OVH you are getting FTP Backup Server (for now is 100 GB). For me space is enough to keep two copies of whole system.

There are many ways to do backup, currently I'm using dar to backup PROXMOX host-os (maybe someday I'll post my backuping script). To backup VM's I use lvm2 snapshots in RAM

The thing is How to synchronize backups files with your free OVH FTP Backup Account? Things You will need:

  1. FTP Backup Account - to create one follow http://help.ovh.co.uk/backupftp
  2. lftp - just use your package manager eg. sudo apt-get install lftp
  3. use script (see man lftp page to see what particular options do):
#!/bin/bash
HOST="ftpback*.ovh.net"
USER="***"
PASS="***"
LCD="/backup/"
RCD="/"
echo ftp://$USER:$PASS@$HOST;
lftp -c "set ftp:list-options -a;
open ftp://$USER:$PASS@$HOST;
lcd $LCD;
cd $RCD;
mirror -RL \
       --delete \
       --delete-first \
       --verbose"

Wednesday, June 20, 2012

Google Adwords Editor + wine + Ubuntu 12.04 (Precise) x64 bit + Unknown SSL protocol error


I've recenlty tried to run Google Adwords Editor under Ubuntu 12.04. Of course as always I had to dig a bit before it started to run smoothly...

  • install wine (I have 1.5.5 from proposed) and winetricks
sudo apt-get install winetricks wine
  • install vcrun2005
I used graphical menu from winetricks which is available from Programs > Wine > Winetricks on Ubuntu.
  • if You are on x64 and came to "can't find gnome-keyring-pkcs11.so" check this link
  • download Adwords Editor installer and run msiexec
msiexec /i adwords_editor_en-US.msi
  • if you are getting "[35] Unknown SSL protocol error in connection to www.google.com:443." two things to fix:
  1. "Can't find gnome-keyring-pkcs11.so" check this link - I guess it's only for x64 version of  Ubuntu12.04, x32 bit
  2. run Google Adwords Editor from command line instead of created link in Programs > Wine > Programs
wine ~/.wine/drive_c/users/lechup/Local\ Settings/Application\ Data/Google/Google\ AdWords\ Editor/adwords_editor.exe

Friday, June 15, 2012

I/O problems on OVH Proxmox LVM2 snapshots

I've recently gave a shot and moved my overloaded server to new one, which uses Proxmox virtualization. I've set up all VMs and put nginx reverse proxy on the top. All things were going nicely, even setting up my very first own firewall and allow some traffic between VM and Internet.

Then I thought I should make backups at least weekly. So I discovered Backups tab in Proxmox WebInterface, and  great vzdump tool! I just didn't realized that I need one more LV to store backup.

You just can't backup to the same Volume which You want to backup!


After getting this into mind, I quickly created backup LV (I needed to shrink existing pve/data LV):

lvcreate -L 800GB -n backup /dev/md2

After this I was able to run vzdump in snapshot mode without any fallback to suspend/stop mode. But short after creating snapshot system was unresponsive. It was a complete disaster!

Drives both on host and guest OS'es were 20x slower. My nginx reverse proxy kept showing 504 Gateway timeout errors...

How to cope with problem? There are two ways:
  • add additional physical drive to PV and create backup volume only on that drive - you can still use vzdump tool
  • create LV using ramdisk (for me 512MB are more than enough, I do not have lot of I/O) and set up snapshot of pve/data, copy files from snapshot to your pve/backup volume

Because, I didn't have additional HDD on my server (soft raid1 matrix /dev/md) I was left with second solution.

So, let's do this! Fistly modify Your grub to encrease /dev/ramX devices size (it will be consumed only if we put data to our volume). For me 512 MB were enough. To be sure, there will be no overflow of data I'm adding almost 1 GB.

edit /etc/default/grub that GRUB_CMDLINE_LINUX_DEFAULT will look like:

GRUB_CMDLINE_LINUX_DEFAULT="quiet ramdisk_size=512000"

Then run update_grub ... After reboot You will have 512 MB, in each /dev/ramX .

So now backup script:

#!/bin/bash
BACKUP_ID=`date -I`
BACKUPS_TO_KEEP=6

# setup
/sbin/pvcreate /dev/ram[0-1]
/sbin/vgextend pve /dev/ram[0-1]
/sbin/lvcreate -L 984MB -s pve/data -n ramsnap /dev/ram[0-1]
mount /dev/pve/ramsnap /backup/ramsnap

# backup
mkdir /backup/vm/$BACKUP_ID
rsync -rv /backup/ramsnap/ /backup/vm/$BACKUP_ID/

# clear
umount /backup/ramsnap
/sbin/lvremove /dev/pve/ramsnap -f
/sbin/vgreduce pve /dev/ram[0-1]
/sbin/pvremove /dev/ram[0-1]

# remove old backups
BACKUPS=`ls -lt /backup/vm/ | awk 'BEGIN{} {print $9}'`
I=1
for BACKUP in $BACKUPS
do
    if [ $I -gt ${BACKUPS_TO_KEEP} ]
    then
        echo "Usuwam katalog /backup/vm/"${BACKUP}"!"
# uncomment next line to really remove it ;)
#        rm "/backup/vm/"${BACKUP} -R
    fi
    I=$((1 + $I))
done


Now I'm able to backup with speed like 20 MB/s with no I/O delays at all! Only drawback is you need to cope with unwanted/old backup folders yourself...

Hope it helps someone!