Hatena::ブログ(Diary)

しもめも -なんかおもろいもん作りたい- RSSフィード Twitter

2007 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2008 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2009 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2010 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |
2011 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 |

2011-12-13

lvをdisable/enableにする

iSCSIとして見せてるlvのtargetをerrorにしたらiSCSIとして見てる人にSCSIエラー出せるよ、と聞いたのでlvをdisable(targetをerrorにする)方法と元に戻す方法を調べた。


まず、対象のlvの現在のtableを確認する。

# dmsetup table testvg-lv1
0 409600 linear 8:5 411648

start/endがわかったので、次に対象lvのtableをerror targetのものに変える。

# dmsetup reload testvg-lv1 --table "0 409600 error"

suspend/resumeしたらtableをロードし直してくれる。

# dmsetup suspend testvg-lv1; dmsetup resume testvg-lv1

なったか確認。

# dmsetup table testvg-lv1
0 409600 error

できました。

元に戻す場合は、元のtableの内容に書き換えてあげればいいので

# dmsetup reload testvg-lv1 --table "0 409600 linear 8:5 411648"
# dmsetup suspend testvg-lv1; dmsetup resume testvg-lv1
# dmsetup table testvg-lv1
0 409600 linear 8:5 411648

のようにする。


バックアップのtableを保持しつつ自動でやるにはこんな感じか。

元のlvはlinearのtargetがひとつある状態しか考慮してないのでちうい。

2011-11-13

LionでEmacs

やっと重い腰を上げてEmacsコンパイルした。

結局Lionのフルスクリーンはやめて従来のフルスクリーンで。

SKKも入れたままやけどcommand+spaceでGoogle日本語入力を切り替えつつ使うことにする。


参考に見たのは Emacs23 (Cocoa Emacs) 入門から中毒まで : 紹介マニアEmacs23をMac OS X Lionでビルドする | Re: no subjectEmacs 23.2 on MacOS XでIMEオンのときのコマンド入力 - shtaxxx weblog、あたり。


curl -O http://ftp.gnu.org/pub/gnu/emacs/emacs-23.3a.tar.gz
#curl -O http://jaist.dl.sourceforge.jp/macemacsjp/47986/inline_patch-23.2-beta3.tar.gz
curl -O http://repo.or.cz/w/emacs.git/patch/c8bba48c5889c4773c62a10f7c3d4383881f11c1
curl -O http://repo.or.cz/w/emacs.git/patch/f2cea124dffac9ca4b8ce1dbb9b746f8e81109a3
#wget https://github.com/downloads/typester/emacs/emacs-23-lion-fullscreen-test.patch
wget https://github.com/downloads/typester/emacs/fix-shiftmodifier-with-ime.patch
wget https://github.com/downloads/typester/emacs/feature-fullscreen.patch
tar zxvf inline_patch-23.2-beta3.tar.gz
tar zxvf emacs-23.3a.tar.gz
cd emacs-23.3
#patch -p 0 < ../inline_patch-23.2-beta3/emacs-inline.patch
patch -p 1 < ../c8bba48c5889c4773c62a10f7c3d4383881f11c1
patch -p 1 < ../f2cea124dffac9ca4b8ce1dbb9b746f8e81109a3
#patch -p 1 < ../emacs-23-lion-fullscreen-test.patch
patch -p 1 < ../fix-shiftmodifier-with-ime.patch
patch -p 1 < ../feature-fullscreen.patch
./configure --with-ns --without-x 2>&1 | tee ../make.log
make bootstrap 2>&1 | tee -a ../make.log
make install 2>&1 | tee -a ../make.log

2011-11-04

今日のワンライナー

messagesをOS再起動ごと(かsyslogd再起動ごと)にファイルに分割する。

FILE="tmp"; for i in `ls /var/log/messages* | sort -rn`; do while read LINE; do if echo $LINE|grep -q restart; then FILE="`echo $LINE|awk '{ print $1$2$3 }'`.log"; fi; echo $LINE >> $FILE; done < $i; done

あとで時刻外してdiffする時とかに使う。

diff -su <(cut -d' ' -f 4- Oct2412\:38\:40.log) <(cut -d' ' -f 4- Oct2413\:00\:31.log)

2011-10-07

今日のtshark

フラグメントしたUDPパケットIP Fragmentとしか表示されなかった(本当はDNSパケット)のでやり方を調べてた。

オプションに -o "ip.defragment: FALSE" を指定するとIP Fragmentパケットをreassembleしないことがわかったのでメモしておく。

# tshark -nnVo "ip.defragment: FALSE" -r fragment.pcap > fragment.txt