понедельник, 30 марта 2009 г.

Converting Fedora 10 single drive installation to RAID1

Look like there is no straight forward instructions regarding the topic. I used two of them

http://togami.com/~warren/guides/remoteraidcrazies/

http://m.linuxjournal.com/article/10217

I already installed mdadm package during the initial system setup, so I went directly to the step of copying partition table to the second (clean) disk (manual #2, Converting a Server to RAID1, 2nd step)

# sfdisk -d /dev/sda | sfdisk /dev/sdb
# fdisk /dev/sdb
> t
> 1
> fd
> t
> 2
> fd
> t
> 3
> fd
> w

I have 3 partitions (root, swap and synchronized with drbd), so I converted them all to raid fs type.

Then I created a raid 1 with single disks for all of my 3 partitions.

 

# mdadm -C /dev/md0 -n2 -l1 missing /dev/sdb1  # root
# mdadm -C /dev/md1 -n2 -l1 missing /dev/sdb2  # swap
# mdadm -C /dev/md2 -n2 -l1 missing /dev/sdb3  # drbd
# cat /proc/mdstat
# mdadm --detail --scan >> /etc/mdadm/mdadm.conf

 

As you can see I do everything like in the second manual. But now the most interesting part of this manipulations begins – you should boot from your newly created raid1.

I did everything like in the next step of the 2nd manual – copied the boot config and specified “root=/dev/md0” and (hd1,0) instead of (hd0,0).

Then the second manual suggests to rebuild initrd image with debian tool. But I don’t have it in fedora. So I followed instructions about creating initrd manually.

Unfortunately they didn’t help – my system couldn’t mount /dev/md0 device (“couldn’t mount /dev/root device” at the boot screen).

So, I googled and found old Russian article about doing the same sort of things, most of step in this article are outdated, but luckily there was a step that saved me

mkinitrd --with=raid1 --preload=raid1 --fstab=/mnt/md0/etc/fstab [image filename] [kernel version]

before that I mounted md0 raid drive to “/mnt/md0”, I also modified fstab on the raid disk – instead of local partitions I mounted raid ones (/dev/md0, /dev/md1).

Don’t forget also to change fstab on your original system – for some reasons grub could load partitions via their IDs after a reboot, so I couldn’t boot to any system.

Then I synchronized content from the /dev/sda1 to /dev/md0. installed grub onto both disks (see article #2) and used solution in the first article to boot into the second option once a time.

It finally did the trick – I stuck with the creation of initrd image – you have to specify new fstab, otherwise mkinitrd won’t know that your root partition is on the raid drive, thus initrd won’t mount raid at the very beginning, so grub won’t be able to load the kernel.

Once I booted from the raid drive I added the original one to the raid array and synchronized the array.

OK, so I will continue with creating of failover cluster, I need to configure drbd and heartbeat. Will let you know if I face any issues.

среда, 11 марта 2009 г.

Наша Раша

Оставил тут машину на выходные на парковке у торгового центра “Купеческий Двор”, сегодня утром приехал забрать.

Перед тем как оставлял – специально проверил – никаких знаков предупреждающих/запрещающих – нет. Сегодня утром парковка была закрыта! :(

Очень сильно было желание открутить болты у цепи которая перекрывает проезд, проехать и прикрутить их обратно (порчи имущества – нет, знаки повесить не потрудились – получайте) – жалко времени было – переезжал через паребрик, но это ещё повезло что лёд намёрз у паребрика и я спуститься смог (машинка то маленька) – в следующий раз (а он обязательно будет раз они знаков не вешают) обязательно откручу болты, заварят – откручу ещё что-нибудь, думаю у меня есть право и на порчу их имущества ибо они без права на то – перекрывают мне выезд. П…сы.

понедельник, 2 марта 2009 г.

Провайдинг

Столкнулся тут с обустройсвом сети одного провайдера в центре города. Оказалось достаточно интересно. За моих два визита удалось немного разгрести биллинговый сервак и настроить резервное подключение к интернету через Корбину – ну и задачка же это.

Выяснилось (ну я то корбиной ни разу не пользовался) что она даёт инет через ВПН (не новость хотя) пришлось настраивать этот ВПН.

Для начала встретил сопротивление от резервной сетевеой карты – что-то очень она сопротивлялась работать с тем процом, дровами и… корбиной. На следующий день поставил новые дрова – и о чудо – сетевуха заработала way more лучше.

Потом беда пришла негаданно – после установки pptp клиента выяснилось что в ядре не хватает поддержки mschap v2 – точнее шифрации для него, пришлось искать модули которые это фиксят – наконец pptp клиент заработал – но впниться активно отказывался.

После небольшого рисёрча выяснилось что этот роутер (ну как ему и следовало) набит файервольными правилами которые блокируют доступ по pptp. Погуглил – выяснил что надо открыть – открыл – инет заработал.

Потом блин так обидно – провёл несколько часов выясняе почему ДНС не работает – оказалось в NAT правилах для файервола я ошибся в номере подсети для внутрених серверов – из-за чего внутренний ДНС сервер не мог вйти наружу.

Ну теперь то вроде заработало.

Работа с этим провайдером оказалось интересной – поработаем, возможно удастся их сеть развить и сделать более надёжной и устойчивой – у меня ктати же давно зреет мысль об провайдинге VoIP телефонии, может и выйдет чего :)

UPDATE:

В момент написания статьи выяснилось что интернет с корбиной падает через час после работы. Погуглил – убрал буфферизацию на ppp устройстве – заработало стабильнее, кроме того добавил автоматический подъём соединения после обрыва. Однако напрягает что очень много потеряных пакетов на ppp соединении – хотя вроде на самом качестве связи это не отражается. В инете пишут что проблема есть с размерами MTU MRU, да и корбина на это в своих конфигах намекает, вобщем посмотрим – думаю удасться с этой проблемой справиться. Другой вариант – юзать l2tp – но там проблемы быдут с установкой – у меня ядро и сама операционка достаточно старая – много чего придётся доставлять и обновлять.

воскресенье, 1 марта 2009 г.

Asterisk + Skype

Recently discovered that it is possible to create an asterisk to skype gateway. Well, I’ve implemented this by doing the following (everything was installed on the asterisk server):

  • Installed jdk
  • installed skype client on asterisk server, in it is a gui applications so I installed Xming on my desktop PC – this allowed me to configure skype without sitting in front of asterisk server. For those who doesn’t know hot to do this, here you are (don’t forget to allow connections to your Xming from external sources)-

export DISPLAY=IP_of_your_desktop_PC:0.0

skype

  • So, I configured Skype on the asterisk server, so that it will be started minimized. Then Skype could be launched by “skype &”
  • Then I installed SipToSis software http://www.mhspot.com/sts/siptosis.html
  • I had to recompile skype4java (but you probably do not need this option). Also I added direct paths for java applications.
  • Once I started SiptoSis software (don’t forget to export DISPLAY again) Skype asked me if I would like to allow access from external program – I allowed this.

Installation is done, now I configured SiptoSis and Asterisk configs:

SipToSis SkypeToSisAuth.props (substitute EXT with a valid asterisk extension):

*,sip:EXT@localhost:5060

SipToSis siptosis.cfg:

host_port=5070

username=skypeusername

passwd=skypepassword

Asterisk sip.conf:

[skype]

type = peer

context = your_asterisk_context

secret = skypepassword

username = skype

host = IP_address_of_asterisk_server

port = 5070

qualify = yes

That’s it, I need to mention that I was only interested in incoming calls from Skype to my Asterisk system, so I didn’t investigate SkypeOut and other features of SipToSis package.

And now – major this in my post – you have to link this SkypeIn line to a certain extension on your asterisk system (conference room or something), because there is no way to dial numbers or input any PINs via Skype client :)

So, the bottom line – It is cool but without interactive dialpad in Skype this thing can’t do much. I have a thought of implementing voice recognition for this line, so that users can say which extension they would like to dial, but this is going to be pretty complicated. I let you know if I make this, deal? :)