2018年4月23日月曜日

cloning to smaller hard disk

i want to clone bigger HDD(sd1) to smaller HDD(sd0) 



1) boot pc by USB stick ( indtall53.fs)
2)chose install




3) acertain disks by !
4) exit







5) which disk is the root dik ? ---> sd0 












then formatting sd0




6)which disk do you want to initialize? --->sd1
   then
   controll + c 



7)mkdir -p /m1
   mkdir -p /m2
   mount /dev/sd1a /m1
   mount /dev/sd0a /m0


8) (cd m1 ; tar cvpf - .)|( cd /m0 ; tar xpf -) 

10) halt -p 
11) remove bigger HDD (namely smaller HDD only inserted)
12 ) reboot and then choose upgrade



13)mkdir /m0
     mount /dev/sd0a /m0










14) echo '/dev/sd0a / ffs rw,wxallowed 1 1' > /m0/etc/fstab


 at present namely , 10 days later
i think that
 In advance the fstab of the bigger hard disk
should be  /dev/sd0a / ffs rw,wxallowed 1 1  
this setting is more convinient 



15) then do upgrade again


all is done


but
this method require 2 times of USB memory booting .

so i write down only 1 time USB memory booting method on
https://qiita.com/tyokai/items/2aaac13642599b09dd68 

but 
both methods may change kernel by upgrade ,
in thi point growfs is superior . 
so they are  most usable at virsion grade up .



2018年4月19日木曜日

growfs (revision 18/05/03)













in order to know the true fact ,


both 
the master of the languages of that past 
and
the technique of the archaeology .

the politicians lack both of them.
so 
the politicians say often the fake history !
we should not learn  the cooking of the susi  from the politicians !






is  me  , fake fake fake !



i write down here that 
if you use both dd and growfs(6.3) ,
you can clone small hard disk drive to bigger one !

archlinux で openbsdをいれた
HDD1(80GB)を 
より大きな容量のHDD2(160GB)
へddしておきます。
dd if=/dev/sdS of=/dev/sdB bs=32k

なお openbsdでは 
a は  /  
in order to simplify ,  /etc/fstab is
5e6829d8a4741b1.a / ffs rw,wxallowed 1 1





このあとHDD2をつけ 電源をいれます。





boot bsd.rd で起動します




shell



fdisk -e sd0

here 、286749480-4=286749476 








disklabel -E sd0
b -> * -> c -> a



fsck -> growfs


fsck again


reboot is OK !
I'am so happy .




2018年2月27日火曜日

やさしく わかりやすい openbsd インストール & nfs



サーバーはセキュリティを危うくするようなものは一切いれません
したがって X つまりグラフィックユーザーインターフェース(GUI)は入れません


じゃあ
コピー&ペーストが不自由じゃないかと反論されますが
それは SSH で切り抜けられます

つまり
他の PC (自分の場合はGUIのある archlinux です)
から OpenBSD に SSH で入ってコピーアンドペーストしてます




本格的な構成で
hotplug
コンピューターや周辺機器の電源を入れた状態のままで接続し、そのまま使用できる機能。 
機器を接続するとシステムがデバイスを認識して、ドライバーの組み込みと必要な設定を自動的に行う。

hotspare
ホットスペアとは、システムの信頼性を高めるために用いられる代替コンポーネントである。 
ホットスペアは実行中のシステムに稼動状態で接続されている。 コンポーネントが壊れた時点で、壊れたコンポーネントの代わりとして動作を開始する。
をサポートしてるので サーバーのraidの勉強にいいです

$ dmesg | grep Xeon                                                            
cpu0: Intel(R) Xeon(TM) CPU 3.20GHz, 3200.57 MHz
cpu1: Intel(R) Xeon(TM) CPU 3.20GHz, 3200.12 MHz
cpu2: Intel(R) Xeon(TM) CPU 3.20GHz, 3200.12 MHz
cpu3: Intel(R) Xeon(TM) CPU 3.20GHz, 3200.12 MHz

$ dmesg | grep sd0  
sd0 at scsibus1 targ 0 lun 0: <HP, LOGICAL VOLUME, 2.36> SCSI0 0/direct fixed
sd0: 208378MB, 512 bytes/sector, 426759840 sectors
root on sd0a (2695cf717dc18c5e.a) swap on sd0b dump on sd0b

$ uname -ar
OpenBSD foo.my.domain 6.2 GENERIC.MP#134 amd64











HP のサーバーへのインストールです



 ここでF8押せば raidの設定にいきますが、 ふつうは 関係ない


まず linuxマシンで
dd if=install62.fs of=/dev/sdX 
で USBメモリにやきつけて
これを USBのスロットにつけて起動します
なお Xはそれぞれの環境でちがいます、b とか c とかです
























a つまり オートが 一番簡単 (なれたら C です)













ここ japanでなく Japanでした(大文字のJ)


 これで シャットダウンします。



再起動すると 
そこは openbsdの世界です。

1)初めての方は
経験のないssh-keygen -t dsa などはしないで

vi /etc/ssh/sshd_config
にて
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no
と 頭の#をとるだけにしてください。
そうすると openbsdのアドレスが192.168.188.3なら
他の LINUXから
ssh open@192.168.188.3
で openbsdにはいれます。



サーバー自体では セキュリィテイ的に問題をおこす 
Xアプリは動かさずに
他のPCからssh ではいって 操作およびメンテするのが楽です。  chrome,firefoxは恐らくバグ一杯あるでしょう

また windows10に WinSCP をいれると
windows10とopenbsdとの間で ファイルのやり取りができ、
セキュリテイ的の脆弱なsambaをつかわなくてすみます。
これおすすめです。



2) NFSです。


1) /etc/exports を                                                                                                         
/home/open/nfs--- -maproot=bin: -network=192.168.188 -mask=255.255.255.0



2) /etc/rc.conf.local                                                                                                   
portmap_flags=""
mountd_flags=""
nfsd_flags="-tun 4"


3)mkdir /home/open/nfs---
   chmod -R 777 /home/open/nfs---

にしておいて


B)LINUXで
 mount.nfs 192.168.188.3:/home/open/nfs--- /mnt
すると


# df
Filesystem                      1K-blocks      Used Available Use% Mounted on
dev                               3043788         0   3043788   0% /dev
run                               3049508      1216   3048292   1% /run
/dev/sda1                       437943296 339052960  97638192  78% /
tmpfs                             3049508     63988   2985520   3% /dev/shm
tmpfs                             3049508         0   3049508   0% /sys/fs/cgroup
tmpfs                             3049508       544   3048964   1% /tmp
tmpfs                              609900        12    609888   1% /run/user/1000
192.168.188.3:/home/open/nfs--- 170908032     19008 162343616   1% /mnt <ーーーここです



とできてるようです。


3)top

load averages:  0.02,  0.04,  0.00                                                                                 foo.my.domain 07:46:03
62 processes: 61 idle, 1 on processor                                                                                            up  1:22
CPU0 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU1 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU2 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU3 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Memory: Real: 49M/746M act/tot Free: 2219M Cache: 593M Swap: 0K/3312M



4) 日本の時間に  /etc/ntpd.conf                                               を                                                       
servers pool.ntp.org
にして下さい




5)
商品名 : DELL PCモニター 17インチ E173FPc
画面サイズ】17 インチ 
入力端子】D-Sub 15ピン
 解像度】SXGA (1280x1024) 


6)すべてを ソース(アルファベットと数字だけ)から

構築は
http://openbsd-akita.blogspot.jp/2015/10/make-world-openbsd-follow-current.html

7)このPCのグラボは
# dmesg | grep vga 
vga1 at pci7 dev 3 function 0 "ATI Rage XL" rev 0x27




8) ホットスペア


ホットスペアとは、HDDの故障に備えて、あらかじめ予備のHDDを通電状態で待機させておくことをいいます。
ホットスペアを用意しておけば、あるHDDが故障したとき、その代わりに予備のHDDを稼働させ、故障発生前の状態に修復する、という作業を自動化することができる。

もし、1台のハードディスクが故障した場合、RAIDシステムを管理しているRAIDコントローラは、故障したディスクを論理的に切り離し、ホットスペア用ディスクを起動する。
そして、残っているデータとパリティ情報などからホットスペアのディスクに必要なデータを書き込み、元の正常な状態に復旧させる。



以上の処理がすべて自動的に実行されるのが、ホットスペアのメリットである。

以下は このPCの場合で



という風に

HDD0は    spare
HDD1~3は raid 5 を組んでます。

例えば HDD2がこわれたら
PCは HDD2を切り離し、HDD0を組み込んでraid 5を再構成します。
  
もしspareがなければ、
さらに1台が壊れると PCはだめになるので
メンテナンス要員はあわてて駆けつけなければなりません。
ちまり
もう一台が壊れないうちに
人間様がその壊れたのをひき抜いて新しいハードディスクをそこにくっつけなければなりません。
時間的猶予がないです。

しかし 
スペアであれば自動的に壊れたハードディスクの代わりにスペアを動かしてくれますので、翌朝ゆっくりとかけつけて
壊れたハードディスクHDD2を新しいハードディスクにすれば済みます
そういったことでサーバーのメンテナーに負担が少なくて済みます 

で きっと必須でしょう




A) 驚かれると おもいますが、 openbsdでは 本体に sshサーバーと 
大変セキュアなopenbsd固有の wwwサーバーが
インストール時から組み込まれてます。
(openssh はopenbsd謹製で とてもセキュアです)

したがって 綱を放てばwwwサーバーが出現します。

綱を解くには
/etc/rc.conf.local を            
httpd_flags=""
とし

/etc/httpd.conf を   
ext_addr="*"
server "default" {
        listen on $ext_addr port 80
}
types {
        include "/usr/share/misc/mime.types"

}
として

/var/www/htdocs/index.html を                                               
ok
とすると

たとえば linuxの chroniumブラウザで
192.168.188.4 とうつと
ok
がでます。




B)動画さーばー
まで、そのRAIDシステムは耐障害性が低下した状態で運用せざるを得なくなる。
# pkg_add minidlna                                                    
quirks-2.304 signed on 2017-04-02T15:01:33Z
minidlna-1.1.5p4:libid3tag-0.15.1bp4: ok
minidlna-1.1.5p4: ok
The following new rcscripts were installed: /etc/rc.d/minidlna
See rcctl(8) for details.

mkdir /share


このフォルダに mp4ファイルをおきます
# ls /share
openbsd 6.2 in USB hard disk  ( UEFI PC) lumina !-nzUqfrj10hE.mp4

/etc/rc.d/minidlna -f restart
以上で
パナソニックTV の リンクボダンをおすと 以下です。
これで mp4ファイルがみれます。
映画でも 家族ビデオでも こうするとTVの大画面でみれるので素敵です。


なお スマホからみるには
MediaHouse のDLNAクライアントを playストア からインストすればいいです
また openbsdへの windows10からのファイルの転送は winscp
がいいと思います
の正常な状態に復旧させる。

以上の処理がすべて自動的に実行されるのが、ホットスペアのメリットである。ホットスペア用ディスクを用意していない場合、ディスクの故障時には、手動で正常なディスクに交換するまで、そのRAIDシステムは耐障害性が低下した状態で運用せざるを得なくなる。

wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)