May 25 2012

umounting and deleteing array

umount /dev/md0
mdadm –stop /dev/md0
mdadm –zero-superblock /dev/sda1
mdadm –zero-superblock /dev/sdb1
mdadm –zero-superblock /dev/sdc1
mdadm –zero-superblock /dev/sdd1

May 9 2012

rsync on Windows – example

rsync -av –delete –delete-excluded –exclude-from=/cygdrive/c/docume~1/rafrom/putty/rsync_exclude –chmod u+rwx -e “ssh -p 22 -i /cygdrive/c/docume~1/rafrom/putty/id_rsa_rsync” “/cygdrive/c/Fox” rafrom@192.168.100.199:backup/

Apr 19 2012

software RAID repair (naprawa macierzy RAID)

1. In this example RAID  contents two disks (/dev/sda, /dev/sdb)  and 4 partitions ( md0, md1, md2, md3)
cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md1 : active raid1 sdb5[1] sda5[0]
 20979264 blocks [2/2] [UU]
md2 : active raid1 sda6[0] sdb6[1]
 20979968 blocks [2/2] [UU]
md3 : active raid1 sdb7[1] sda7[0]
 880264320 blocks [2/2] [UU]
md0 : active raid1 sdb1[1] sda1[0]
 20979648 blocks [2/2] [UU]
unused devices: <none>

2. If the RAID fail you will see

cat /proc/mdstat
 Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
 md1 : active raid1 sda5[0]
       20979264 blocks [2/1] [U_]
 md2 : active raid1 sda6[0]
       20979968 blocks [2/1] [U_]
 md3 : active raid1 sda7[0]
       880264320 blocks [2/1] [U_]
 md0 : active raid1 sda1[0]
       20979648 blocks [2/1] [U_]
 unused devices:

3. Disconnect failed hdd

4. Connect new hdd

5. Loook into dmesg for hdd letter

6. remove failed hdd from raid (usuniecie uszkodzonego dysku z macierzy)

mdadm /dev/md0 --fail detached --remove detached
mdadm /dev/md1 --fail detached --remove detached
mdadm /dev/md2 --fail detached --remove detached
mdadm /dev/md3 --fail detached --remove detached

7. copy partitions structure from old GOOD HDD to the new one ( kopiujemy strukture partycji z jednego dysku na drugi)

sfdisk -d /dev/sda | sfdisk /dev/sde

8. Add new hdd into RAID (# dodajemy nowo wsadzony dysk)

mdadm --add /dev/md0 /dev/sde1
mdadm --add /dev/md1 /dev/sde5
mdadm --add /dev/md2 /dev/sde6
mdadm --add /dev/md3 /dev/sde7

9. Rebuilding starts automaticaly, You can see RAID status by

cat /proc/mdstat

 10. and WHEN ALL PARTITIONS ARE REBUILDED run:

mdadm --detail --scan >> /etc/mdadm.conf
Apr 18 2012

raid1 on existing filesystem -> Example

Existing filesystem is on /dev/sda

/dev/root  /
/dev/sda5 /var
/dev/sda6 /usr
/dev/sda8  /home

Connect new disk (for example /dev/sdb)

Copy partition structure from sda to sdc:

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

or if disk has differ size

create the same size ( or bigger) partitions on sdb

end change type for fd (Linux raid autodetect)

change disk’s blkid

tune2fs -U random /dev/sdb

Next, create the single-disk RAID-1 array. Note the “missing” keyword is specified as one of our devices. We are going to fill this missing device later.

mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1

or

mdadm --create /dev/md0 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb1

and for other partitions

mdadm --create /dev/md1 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb5
mdadm --create /dev/md2 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb6
mdadm --create /dev/md3 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb7

cat /proc/mdstat shows just created raid

Use the file system of your preference here. I'll use ext4 for this guide.
mkfs -t ext4 -j -L RAID-ONE /dev/md0
mkfs -t ext4 -j -L RAID-ONE /dev/md1
mkfs -t ext4 -j -L RAID-ONE /dev/md2
mkfs -t ext4 -j -L RAID-ONE /dev/md3

Make a file system on the swap partition:

mkswap -L NEW-SWAP /dev/sdb2

The new RAID-1 array is ready to start accepting data! So now we need to mount the array, and copy everything from the old system to the new system

 mkdir /tmp/md0 /tmp/md1 /tmp/md2 /tmp/md3
 mount /dev/md0 /tmp/md0

 mount /dev/md1 /tmp/md1
 mount /dev/md2 /tmp/md2
 mount /dev/md3 /tmp/md3
 rsync -avxHAXS --delete --progress /home/ /tmp/md3
 rsync -avxHAXS --delete --progress /var/ /tmp/md2
 rsync -avxHAXS --delete --progress /usr/ /tmp/md1
 rsync -avxHAXS --delete --progress / /tmp/md0

edit /etc/fstab and change mounting points to appropriate /dev/md0 .. /dev/md3

and add line:

/dev/sdb2  swap swap defaults 0 0

reboot with opition  root=/dev/md0 (where my root filesystem was located).

telinit 1 ?

First, open /dev/sda with fdisk and change all the partittions you want to have added to the array to type fd – linux raid autodetection.

Then, for each degraded array, add the appropriate non-array device to it:

mdadm /dev/md0 -a /dev/sda1

(wait for finish recovery)

(umount/dev/sda5)
mdadm /dev/md1 -a /dev/sda5

(wait for finish recovery)

umount/dev/sda6
mdadm /dev/md2 -a /dev/sda6

(wait for finish recovery)

umount/dev/sda8
mdadm /dev/md3 -a /dev/sda8

(wait for finish recovery)

Ensure your /etc/lilo.conf has the correct setup:
boot=/dev/md0
raid-extra-boot=mbr-only
root=/dev/md0

and type:

lilo

LILO will write boot information to each of the individual raid devices boot sectors, so if either /boot or your root partition are on failed disks, you’ll still be able to boot.

Create /etc/mdadm/mdadm.conf.
in /etc/mdadm/mdadm.conf put line:
DEVICE /dev/sda* /dev/sdb*

and WHEN ALL PARTITIONS ARE REBUILDED run:

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

				
Feb 13 2012

pecl ERROR: `phpize’ failed

Solution from:  http://kagan.mactane.org/blog/2009/05/11/workaround-for-pearpecl-failure-with-message-error-phpize-failed/

If you’ve gotten an “ERROR: `phpize’ failed” message when trying to run a “pecl install” or “pear install” command, try running phpinfo() — if you see --enable-sigchild in the “Configure Command” section near the very top, then you’re most likely being bitten by this bug.

 

Potential Fixes and Workarounds

The PHP dev team recommends recompiling without the offending flag.

However, you may not be able to do that, for any of various reasons. (You may have installed from a binary package, for instance — like most people these days.) Or it may simply seem like an excessive hassle. I offer the following patch as-is, without any guarantee or support.

First, ensure that you have the latest version of PEAR::Builder. Look in your PEAR/Builder.php file — On most Linux and Unix installations, this is likely to be in /usr/lib/php/PEAR/Builder.php, or possibly /usr/local/lib/php/PEAR/Builder.php.

On Windows systems, PHP might be installed nearly anywhere, but supposing it’s in c:\php, then the file you’re looking for will be in c:\php\PEAR\PEAR\Builder.php (yes, that’s two PEARs in a row).

Check the “@version” line in the big comment block at the beginning of the file; the line you want should be around line 19 or so. If says it’s less than version 1.38 (the latest one, at the time I’m writing this post), then try upgrading. Running “pear upgrade pear” should work. Then you can install this patch file:

 

Download the patch file and place it somewhere on your machine. Log in and cd to the PEAR directory that contains the Builder.php file. Then run the patch command. In the following example, I’ve placed the patch file in root’s home directory:

root@finrod:~# ls
loadlin16c.txt loadlin16c.zip patch-pear-builder-1.38.txt
root@finrod:~# cd /usr/lib/php/PEAR
root@finrod:/usr/lib/php/PEAR# cp Builder.php Builder.bak.php
root@finrod:/usr/lib/php/PEAR# patch -p0 < /root/patch-pear-builder-1.38.txt
patching file Builder.php
root@finrod:/usr/lib/php/PEAR#

Naturally, if the patch file doesn’t work for some reason, or it breaks things, you can just cp the backup file back into place.

 

Jan 11 2012

SMS-y PREMIUM – wyłączanie

Jeżeli występują problemy – wyślij najpierw sms o tresci LISTA na numer 8888

smsy przychodzące z numerów :

7419 – wyłączamy sms’em o treści STOP na bezpłatny numer 8010
60444 – sms o treści Stop Vip ( również bezpłatnie na taki sam numer )
60128 – sms o treści STOP LOS (opłata jak za zwykłego SMS-a).
74500 – sms o treści STOP na nr 8043 (powiązany może być również z numerem 60444 )
60466 – sms o treści STOP TAK na numer 60466 (opłata jak za zwykłego SMS-a).
40666 – sms o treści STOP LIDER 7225 – sms o treści NIE na numer 80888
60328 – sms o treści STOP NAGRODA
7400 lub 7407 – SMS o treści USUN na numer 8074 ( bezpłatny )
7478 SMS o treści ANULUJ na 80478 ( wcześniej dzwoni automat że przyjdzie sms )
60228,55028,54028 – najpierw sms o treści – LISTA na numer 8888 a nastepnie dany temat np: STOP Tapety , stop chat itc w zależności jaki pakiet będzie uruchomiony i z danego numeru
7363 o treści QUIZ STOP na ten sam numer
7421 – ANULUJ na następujące numery darmowe: 80330 dla sieci Orange, Era, Play oraz 8048 dla sieci Plus GSM
60418 – o treści STOP TAK lub STOP OK
60566 – sms o tresci stop Fun
Powoli sukcesywnie będę dodawać w zależności przypadków
lub ewentualnie proszę o kontakt poprzez GG

Jeżeli wszystko jest juz w porządku wysłać sms o tresci START BLOKADA na numer 8888.

Jan 9 2012

OS X: Ten Boot Options for Leopard

To use these boot shortcuts or commands, hold down the bolded keypress while your system is booting up. If it does not work, you probably did not start holding down the key (or key combination) soon enough.

shift – Safe Mode

Booting with the shift key depressed starts OS X in Safe Mode with Account preferences ignored and unessential kernal extensions / kexts disabled.

option – Startup Manager

Booting with the option key depressed starts OS X with the Startup Manager which allows the user to select which OS or partition from which to boot.

Mouse button – Eject Media

When the user boots with the mouse key depressed, any media in the drive such as a DVD or CD is ejected.

cmd v – Verbose Boot

If this key command is held down when booting, all the startup messages that are typically hidden will be displayed. This is an excellent method for debugging booting issues.

c – Boot from CD/DVD

Booting with the “C” key held will tell the system to boot directly from a CD/DVD in the drive.

t – Target Mode

If the “T” key is held during the bootup, the computer will be placed in target mode. This basically allows the computer to be accessed by other systems as a FireWire drive. Other computers can read, write, or mount the target mode system just like any other FireWire drive.

Other Bootup Shortcuts —

cmd s – Single User Mode

x – OS X Force boot

r – PowerBook Display Reset

n – Boot up from NetBoot Server

Jan 9 2012

Postfix + Mysql + dovecot + Maildir

wpis w /etc/dovecot.conf.d/10-mail.conf
mail_location = maildir:/var/vmail/%d/%n/Maildir

auth-sql.conf.ext
passdb sql {
args = /etc/dovecot/dovecot-sql.conf
}

userdb static {
args = uid=5000 gid=5000 home=/var/vmail/%d/%n allow_all_users=yes
}

Nov 7 2011

Function ereg_replace() is deprecated

zamiast
$desc=ereg_replace(‘ +’,’ ‘,$desc); //reduce all multiple-space strings to single space
wpisujesz
$desc= preg_replace(‘/\s\s+/’, ‘ ‘, $desc); //reduce all multiple-space strings to single space

Sep 27 2011

Fujitsu Siemens Launch Manager and Windows 7 – enable Wireless

Solution from http://miloszikic.blogspot.com/2010/07/fujitsu-siemens-amilo-launch-manager.html

For all of you that have Amilo laptops which don’t have Launch Manager available for new Win 7 here is simple solution to run your wireless again!
I spent quite a time until finally managed to enable this card. I thought that enabling card just in bios will do the trick but cards have to be enabled from inside os as well and since Launch Manager will not work in default installation this will not work.

And hopefully running Launch Manager in compatibility mode did the trick.
So steps are:

  1. go to fsc support page
  2. find your laptop and downlod launch manager for Windows XP
  3. extract it and then right click go to compatibility view and select run as “windows xp (service pack 2)” – didn’t work for me with service pack 3
  4. enable “run as administrator” as well
  5. install it and reboot
  6. Voila! Press your launch key and it should work.