суббота, 29 марта 2014 г.

How to Check your Hard Disk for Bad Blocks in Ubuntu

Взято отсюда, спасибо автору.


If your system regularly does disk checks on boot up and if it often finds errors during the check, its highly possible that you have bad sectors on your hard disk.  In such cases its highly recommended to do a disk check to detect if you have bad sectors on the disk.

What is a bad sector? A bad sector is a sector on a computer’s disk drive or flash memory that cannot be used due to permanent damage (or an OS inability to successfully access it), such as physical damage to the disk surface (or sometimes sectors being stuck in a magnetic or digital state that cannot be reversed) or failed flash memory transistors.
The simplest way to do a check on a disk is to use the badblocks command from the command line in Linux. To check a disk partition(in this case /dev/sdc1) use the following command:
 sudo badblocks -v /dev/sdc1
 The output will be in the following format:
sudo badblocks -v /dev/sdc1
Checking blocks 0 to 130954239
Checking for bad blocks (read-only test): 5621828 done, 3:37 elapsed
5621860 done, 8:43 elapsed
5621861 done, 13:25 elapsed
5621862 done, 17:57 elapsed
done
Pass completed, 4 bad blocks found.
If you find bad sectors it usually means its time to change your disk. The situation will most probably get worse over time, but there is a tiny possibility that these are false positives(mostly coz of problems elsewhere in the system). The alternative option is to mark these blocks as badblocks and tell your system to not write any data there. This will surely buy you some more life of the disk.
Note: The second option is cheaper(takes a bit of time though) and effective way of finding over time if your disk really had errors but if your data is very important to you, please back it up elsewhere or you risk losing it.
First we have to write the location of the bad sectors into a file.
 sudo badblocks /dev/sdc > /home/hacks/bad-blocks
After that, we need to feed the file into the FSCK command to mark these bad sectors as ‘unusable’ sectors.
 sudo fsck -l bad-blocks /dev/sdc

среда, 19 марта 2014 г.

Ovirt и его странности.

Ovirt и его странности.

1)Backup/Restore

1.1 До 3.6
Бэкап базы - скриптом engine-backup --mode=backup

1.2 В версии 3.6 пример:

engine-backup --mode=backup --scope=all --archive-compressor=gzip --files-compressor=None --db-compressor=None --file=<filename>.tgz --log=<filename>.txt

На выходе будет tgz архив, внутри которого БД в формате custom и свернутые tar каталоги с конфигами, сертификатами и прочим.


1.3 Полная процедура восстановления:
- поставить ovirt-engine
- сделать engine-setup, ответы на вопросы давать такие же, как и при начальной установке
- остановить engine
- drop database engine / create database engine owner <your db owner>
- engine-backup --mode=restore --scope=all --file=<your archive file> --log=<log file> --change-db-credentials --db-host=<your host> --db-user=<your db user> --db-name=<your db name> --db-password='<you can watch it in /etc/ovirt-engine/engine.conf.d/10-setup-database.conf>' --restore-permissions
- внести изменения в  /etc/ovirt-engine/aaa/internal.properties
- запустить engine


2) Upgrade 3.4 to 3.5

2.1) Small bug when upgrading existing data centers from oVirt 3.4 to 3.5.

There is a bug filed on this that will likely be resolved in the next minor version upgrade. As a work-around, navigate to the Storage tab, click your VM’s storage domain, in the sub-tab at the bottom click Storage Profile, and add a default storage profile for your VM’s storage.
You will now be able to add disks to VMs again.

3) Инсталляция сервера - хоста.

  3.1) Перед запуском инсталляции присоединить репозиторий ovirt
yum localinstall  http://resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm
  3.2) Если устанавливаем на сервер, загружающийся с usb flash, то необходимо провести следующие манипуляции:
     3.2.1) /var/log монтируем как tmpfs
     3.2.2) Настроить rsyslog на отправку сообщений на сервер централизованного сбора журналов работы
     3.2.3) при каждой загрузке сервера необходимо создавать структуру каталогов в /var/log, для этого:

cat /usr/local/bin/create-log-dirs.sh
#!/bin/bash
        /usr/bin/mkdir -p /var/log/zabbix
        /usr/bin/chown zabbix:zabbix /var/log/zabbix


/usr/bin/mkdir -p /var/log/vdsm                                                                                                                                                                                                               
/usr/bin/mkdir -p /var/log/libvirt                                                                                                                                                                                                            
/usr/bin/mkdir -p /var/log/glusterfs
/usr/bin/touch /var/log/vdsm/upgrade.log                                                                                                                                                                                                      
/usr/bin/chown -R vdsm:kvm /var/log/vdsm

cat /etc/systemd/system/create-log-dirs.service
[Unit]
After=local-fs.target

[Service]
ExecStart=/usr/local/bin/create-log-dirs.sh

[Install]
WantedBy=default.target

  systemctl daemon-reload
 

4)  USB устройства хоста внутри VM

На сегодня все должно работать из GUI ovirt-engine, немного про глюки: http://lists.ovirt.org/pipermail/users/2015-December/036808.html

На всякий случай то, что было до 3.6: 

Теория:

http://www.ovirt.org/VDSM-Hooks/hostusb

Практика (взято отсюда):
First you have to install hostusb hook on the host machine. Then you have to run this command  
on engine to define 'hostusb' as a custom 
property:

sudo engine-config -s UserDefinedVMProperties='hostusb=[\w:&]+'

You can check out using:

sudo engine-config -g UserDefinedVMProperties. 
 Then editing your virtual machine, go to the 'Custom Properties' tab. There, select 
'hostusb' and in the right textbox, put the id. Example: 0x1234:0xbeef.

You can define several ids, putting '&' between them: 
0x1234:0xbeef&0x2222:0xabaa.
5) Memory page sharing management on hosts.
KSM From RH RHEV documentation




6) Утечка памяти в VDSMD у Ovirt 3.5

На данный момент не решена проблема (обновился до 3.5.2) с утечкой памяти в vdsmd, что в общем-то признано разработчиками, есть многостраничный "плач ярославны" на багтрекере ovirt, но воз и ныне там.
Поэтому обходимся пока рестартом vdsmd по cron 2 раза в неделю.

7)Привязка сетевого интерфейса ovirt к fake network, например tun interface.

Источник
I suspect the problem is that VDSM isn't told by default to pass dummy
NICs on to the engine. Have a look at the following file (exact path
might vary):

/usr/lib64/python2.7/site-packages/vdsm/config.py

Search for a variable called "fake_nics", it should exist for 3.2. By
default it is empty, but you may define a pattern for fake NIC names to
be passed to the engine (in your case probably "dummy*"). Restart the
vdsm daemon and everything should be fine. Maybe you'll have to move the
host to maintenance and then reactivate just to refresh the UI.

8) reset/change admin password.

ovirt-aaa-jdbc-tool user password-reset admin –password-valid-to=’yyyy-MM-dd hh:mm:ssZ’

9) Remove DWH


 
remove related rpms
 
# su - postgres
psql
drop database ovirt_engine_history;
drop database ovirt_engine_reports;
 
remove the folders /var/lib/ovirt-engine-reports,
/var/lib/ovirt-engine-dwh, /etc/ovirt-engine-reports and
/etc/ovirt-engine-dwh manually. Then engine-backup works again.
Otherwise nothing has struck me. 


10) Create a windows template

11) Ошибки и способы их исправления.


11.1 "Host (hostname) is installed with VDSM version (4.14) and cannot join cluster (clustername) which is compatible with VDSM versions [4.13, 4.9, > 4.11, 4.12, 4.10]."
yum clean all, yum update ovirt-release, yum update
(выполнить на ovirt-engine)

11.2 "Could not retrieve mirrorlist http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=6.0 error was
14: PYCURL ERROR 22 - "The requested URL returned error: 504 Gateway Time-out"
Error: Cannot find a valid baseurl for repo: ovirt-jpackage-6.0-generic"
[root@colove01 yum.repos.d]# cat /tmp/jp.txt
# No local mirror detected - defaulting to adding them all
http://sunsite.informatik.rwth-aachen.de/ftp/pub/Linux/jpackage/6.0/generic/free

redirect /etc/yum.conf.d files to /tmp/jp.txt:
...
#mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=6.0
mirrorlist=file:///tmp/jp.txt
источник: http://www.mail-archive.com/users@ovirt.org/msg18008.html


11) Debian ovirt-guest-agent.

apt-get install ovirt-guest-agent
chmod +x /usr/share/ovirt-guest-agent/ovirt-guest-agent.py
systemctl restart ovirt-guest-agent 
проверить права на каталог /var/log/ovirt-guest-agent