Wednesday, July 22, 2015

Failed to create domain from - qemu error


 I run out of space on /var/lib/libvirt/images , so need to change the path where qcow2 image is stored(/home)?.

Tried creating vm from new location but faced the following error.

[root@gant qemu]# virsh create fedora21_3.xml
error: Failed to create domain from fedora21_3.xml
error: Cannot access storage file '/home/test/qemu_images/fedora21_3.qcow2' (as uid:107, gid:107): Permission denied


 Fix is we need to change the permission of whole directory path.

[root@gant qemu]# chmod 777 /home/test/

[root@gant qemu]# chmod 777 /home/test/qemu_images/

[root@gant qemu]# chmod 777 /home/test/qemu_images/fedora21_3.qcow2

[root@gant qemu]# virsh create fedora21_3.xml
Domain fedora21_3 created from fedora21_3.xml

[root@gant qemu]#

This is for a  development machine , so not recommended for anything else.

Tuesday, July 21, 2015

Hardlinks - usecase


Hard link points to the same data on the storage device.
--
It has same inode.

You can check using:
ls -li  filename*
--

--
To check number of hardlinks present for a file:
ls -l filename
  Here, check third column count.
--

--
No hard link for directory / special device. only for regular files.

Also, files should be on the same file system(remember inode)

(with soft links, it is possible to create for directories/special files as well)
(with soft links, across file system possible)

• A hard link points a name to data on a (storage)device
• A soft link points a name to another name, that points to data on a (storage) device.

while using softlink for directory, your PWD will be softlink.
--

How hardlinks can be used?

Please refer reference mentioned below for complete details.
 ============================================
This is how many modern file system backup programs work.

On day 1 you make an rsync copy of your entire file system:

backup@backup_server> DAY1=`date +%Y%m%d%H%M%S`
backup@backup_server> rsync -av -e ssh earl@192.168.1.20:/home/earl/ /var/backups/$DAY1/


On day 2 you make a hard link copy of the backup, then a fresh rsync:

backup@backup_server> DAY2=`date +%Y%m%d%H%M%S`
backup@backup_server> cp -al /var/backups/$DAY1 /var/backups/$DAY2
backup@backup_server> rsync -av -e ssh --delete earl@192.168.1.20:/home/earl/ /var/backups/$DAY2/


“cp -al” makes a hard link copy of the entire /home/earl/ directory structure from the previous day, then rsync runs against the copy of the tree.

If a file remains unchanged then rsync does nothing — the file remains a hard link. However, if the file’s contents changed, then rsync will create a new copy of the file in the target directory. If a file was deleted from /home/earl then rsync deletes the hard link from that day’s copy.

In this way, the $DAY1 directory has a snapshot of the /home/earl tree as it existed on day 1, and the $DAY2 directory has a snapshot of the /home/earl tree as it existed on day 2, but only the files that changed take up additional disk space. If you need to find a file as it existed at some point in time you can look at that day’s tree. If you need to restore yesterday’s backup you can rsync the tree from yesterday, but you don’t have to store a copy of all of the data from each day, you only use additional disk space for files that changed or were added.
============================================

Ref:
http://earlruby.org/2013/05/creating-differential-backups-with-hard-links-and-rsync/

Sunday, July 19, 2015

python script check for erros


want to check python script for errors without running?

flake8  src/main.py

ofcourse you need to install flake8 first :)

secure connection failed error in firefox

secure connection failed error in firefox

check:
https://support.mozilla.org/en-US/questions/1028755


install acroread adobe pdf reader on fedora


cd /tmp

## English version ##
wget http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i486linux_enu.rpm


## Fedora 22 ##
## English version ##
dnf install AdbeRdr9.5.5-1_i486linux_enu.rpm

## Install other needed packages on Fedora ##
dnf install nspluginwrapper.i686 libcanberra-gtk2.i686 adwaita-gtk2-theme.i686 PackageKit-gtk3-module.i686


link:http://www.if-not-true-then-false.com/2010/install-adobe-acrobat-pdf-reader-on-fedora-centos-red-hat-rhel/


PS:
Also, we need to add this line(below) in /usr/bin/acroread:
ldconfig /opt/Adobe/Reader9/Reader/intellinux/lib





 Then, you can launch acroread like :
sudo acroread &

This may be a recommended option, please use with caution.