Archive

Archive for March, 2011

To be or not to be.

March 29th, 2011 No comments

Categories: Всичко друго Tags:

Gentoo software RAID

March 29th, 2011 No comments

Gentoo Software RAID

Software RAID massives

You can check your RAID/LVM support with this command

cat /boot/config-`uname -r` | egrep 'RAID|LVM'
CONFIG_RAID_ATTRS=m
CONFIG_BLK_DEV_3W_XXXX_RAID=m
CONFIG_SCSI_AACRAID=m
CONFIG_MEGARAID_NEWGEN=y
CONFIG_MEGARAID_MM=m
CONFIG_MEGARAID_MAILBOX=m
CONFIG_MEGARAID_LEGACY=m
CONFIG_MEGARAID_SAS=m
CONFIG_MD_RAID0=m
CONFIG_MD_RAID1=m
CONFIG_MD_RAID10=m
CONFIG_MD_RAID456=m

Kernel Config

 Device Drivers
 Multi-device support (RAID and LVM)
 Multiple devices driver support (RAID and LVM) (MD [=y])
 RAID support (BLK_DEV_MD [=y])

Load modules:

modprobe raid0
modprobe raid1
modprobe raid10

Partitions with “cfdisk”

cfdisk (util-linux-ng 2.13.1.1)
 
Disk Drive: /dev/sda
Size: 80025280000 bytes, 80.0 GB
Heads: 255   Sectors per Track: 63   Cylinders: 9729
 
Name               Flags             Part Type        FS Type                   [Label]                Size (MB)
-----------------------------------------------------------------------------------------------------------------------------
sda1               Boot               Primary         Linux raid autodetect                               115.16
sda2                                  Primary         Linux swap / Solaris                               4087.97
sda3                                  Primary         Linux raid autodetect                             75820.64

Put partiton table from /dev/sda to /dev/sdb /dev/sdc1 /dev/sdd1 (:

sfdisk -d /dev/sda | sfdisk /dev/sdb | sfdisk /dev/sdc | sfdisk /dev/sdd

Create MD devices

cd /dev
MAKEDEV md

!!! Linux can’t boot from software RAID 10 we make new BOOT partition with RAID1

# Create Boot partition
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

#Create Root partition

mdadm --create --verbose /dev/md1 --level=10 --raid-devices=4 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3

Watch our RAID creation

watch cat /proc/mdstat
watch -n1 'cat /proc/mdstat'

Update the mdadm config file.

mdadm --detail --scan >> /etc/mdadm.conf

# GRUB CONFIG

grub> find /boot/grub/stage1
(hd0,0)
(hd1,0)
(hd2,0)
(hd3,0)
grub>

#Install to drive 1

grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)

#Install to drive 2

grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)

#Install to drive 3

grub> device (hd0) /dev/sdc
grub> root (hd0,0)
grub> setup (hd0)

#Install to drive 4

grub> device (hd0) /dev/sdd
grub> root (hd0,0)
grub> setup (hd0)

Set grub menu.list

!!!!! change real_root=/dev/md???? whith your RAID ROOT configuration !!!!!!!!

echo -e "default 0\ntimeout 3\n\ntitle=Gentoo Linux (2.6.29-gentoo-r1-VHristev)\nroot (hd0,0)" > /boot/grub/grub.conf
echo "kernel `ls /boot/kernel*` root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/md1 udev" >> /boot/grub/grub.conf
echo "initrd `ls /boot/initramfs*`" >> /boot/grub/grub.conf
grep --invert-match rootfs /proc/mounts > /etc/mtab
Categories: Всичко друго Tags:

Mac OS X create ISO from DVD/CD

March 29th, 2011 No comments

You have DVD with software and you want to install with Parallels/VMware Fusion/Virtual Box but … you don’t want to use your old scribbled disk and we need to convert it to .iso.

 

[18:31]vhristev@coco-12:~$drutil status
Vendor   Product           Rev
MATSHITA DVD-R   UJ-868    KB19
 
Type: DVD-ROM              Name: /dev/disk1
Sessions: 1                  Tracks: 1
Overwritable:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Free:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Used:  348:05:15         blocks:  1566390 /   3.21GB /   2.99GiB
Writability:
Book Type: DVD-ROM (v1)
 
[18:31]vhristev@coco-12:~$diskutil umountDisk /dev/disk1
Unmount of all volumes on disk1 was successful
[18:31]vhristev@coco-12:~$dd if=/dev/disk1 of=Solaris_10.iso bs=2048

 

 

Categories: Всичко друго Tags:

Reinstalling the host management agents and HA agents on ESXi

March 28th, 2011 No comments

1. Right-click on the ESXi host and click Disconnect. This disconnects the ESXi host from the VirtualCenter Inventory.

2. Log in to ESXi Troubleshooting Mode. For more information, see Tech Support Mode for Emergency Support (1003677).

3. Uninstall the vpxa and aam components from the VMware ESXi host using the following commands:

/opt/vmware/uninstallers/VMware-vpxa-uninstall.sh

/opt/vmware/uninstallers/VMware-aam-ha-uninstall.sh

4. Right-click on the ESXi host and click Connect. This initiates a re-install of the vpxa agent.

5. Add the host to the appropriate cluster. This initiates a re-install of the aam agent.

If the agent fails to automatically install when connecting the ESX host in the vCenter Server:

1. Verify that /tmp/vmware-root exists on the ESX host. vCenter stages the vpxa RPM in this folder. To add this directory, execute:

 mkdir -p /tmp/vmware-root

Categories: ESX, ESX 4.x, VMware, Всичко друго Tags:

Console torrent client (rtorrent)

March 23rd, 2011 1 comment

I really like my rtorrent it is really easy to use it.

Install rtorrent on Mac os x (you need installed ports to use this feature)

[21:05]vhristev@g1r5:~$port search rtorrent
rtorrent @0.8.4 (net)
    console-based BitTorrent client
 
rtorrent-devel @0.8.5 (net)
    console-based BitTorrent client (development version)
 
Found 2 ports.
[21:05]vhristev@g1r5:~$sudo port install rtorrent
--->  Computing dependencies for rtorrent
--->  Cleaning rtorrent
[21:05]vhristev@g1r5:~$

How to start downloading torrent file.

My first advice is USE “screen” like me .I am in the office and want to start downloading something.
1.I run screen then i run my rtorrent and voala perfect console torrent client and i don’t have to worry about my connection between office and home (:
2. rtorrent TORRENT_FILE

 

Im lazy and download this pictures from internet (:

 

Basic keyboard shortcuts:

    ^q — closes rTorrent, done twice makes the program shutdown.
    Up, down arrows — highlight the downloads.
    Left arrow — returns to the previous screen.
    Right arrow — goes to the next screen.
    a|s|d — increase global upload speed about 1|5|50 KB/s
    A|S|D — increase global download speed about 1|5|50 KB/s
    z|x|c — decrease global upload speed about 1|5|50 KB/s
    Z|X|C — decrease global download speed about 1|5|50 KB/s
    ^S — starts download
    ^D — pauses and resumes the active download
    +|- — changes the download priority of selected torrent.
    Backspace — adds the specified .torrent. After pressing this button write full path or URL of .torrent file. You can use Tab and other tricks from bash.
Categories: Всичко друго Tags:

Проблем при инсталация на memcache pooling tool за Cacti

Опитах се да кача memcache tool за Cacti, който да проверява memcache сървърите.
При опит за инсалация, следвайки тези инструкции, се появи грешка:

root@home:/# python setup.py install
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    from setuptools import setup
ImportError: No module named setuptools

Решението е лесно:

root@home:/# apt-get install python-setuptools
Categories: Debian Tags:

Sysadmin’s Unixersal Translator

March 16th, 2011 No comments

One day I need to check something on AIX and I didn’t know the right command and this was the site who save my ass.
Here you can find differences in many OS (LInux,HP-UX,Mac OS X,AIX,IRIX,Solaris …etc )

OS differences

Categories: Всичко друго Tags:

Google Analytics код в vBulletin 4

При опит да поставим Google Analytics tracking pixel чрез редакция на template в админа се получава следната грешка:

Parse error: syntax error, unexpected '[' in /var/www/vhosts/path/to/includes/adminfunctions_template.php(4667) : eval()'d code on line 133

За да избегнем това, заграждаме GA кода следният таг < vb:literal >

<vb:literal>
<script type="text/javascript">
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-ХХХХХХХХ-У']);
  _gaq.push(['_trackPageview']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
 
</script>
</vb:literal>
Categories: JavaScript, vBulletin Tags:

VIM rc

March 11th, 2011 No comments

This is my VIM rc which I tune a little bit to have a better look

[17:45]vhristev@g1r5:~/Desktop$cat ~/.vimrc
iab _NAME Valentin Hristev
iab _URL http://hristev.com
iab _DATE =strftime("%A, %B %e %Y %I:%M:%S %p %Z")
 
" Configuration file for vim
set modelines=1         " CVE-2007-2438
set nu
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible        " Use Vim defaults instead of 100% vi compatibility
set backspace=2         " more powerful backspacing
"Vhristev tuning"
 
set history=5000 "Keep my history in order"
set ruler " I want to see my cursor position"
 
set title
filetype plugin on
 
set title
set nowrap
set ignorecase
set smartcase
"set wildmenu"
 
set clipboard+=nonnamed
set mouse=a
set noerrorbells
set hidden
set wildmenu
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,
\*.jpg,*.gif,*.png
set wildmode=list:longest " turn on wild mode huge list
 
syntax on
 
"set cursorcolumn"
 
set cursorline
set incsearch
set hlsearch
set magic
syn on
set laststatus=2
set lazyredraw
set linespace=0
 
set list
set report=0
set showcmd
set showmatch
set backspace=indent,eol,start
 
 
 
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup

You can find very useful information here –> VIMrc

Categories: Всичко друго Tags:

Как да преброим броя файлове в една директория?

За да проверим колко log файла има в конкретната директория използваме следната команда:

ls -l | grep .*.log | wc -l
Categories: Quick Tips Tags: