# 아래는 여러 인터넷 사이트에서 설명하는 내용 - 정확치 않음 (이것때문에 삽질 여러번 ㅜ.ㅜ)

# dd if=/dev/urandom of=tmpfile bs=1M count=3

3+0 records in

3+0 records out

3145728 bytes (3.1 MB) copied, 0.443321 s, 7.1 MB/s


# hdparm --fibmap tmpfile 


tmpfile: underlying filesystem: blocksize 4096, begins at LBA 63; assuming 512 byte sectors

 byte_offset  begin_LBA    end_LBA    sectors

           0    1318991    1325134       6144


# hdparm --read-sector 1318991 /dev/sdb 


/dev/sdb: 

reading sector 1318991: succeeded 

b0e8 3ad7 d080 84e8 b4b2 7e60 21f1 eff3 

0ef9 fa10 b172 89f8 186f 0194 4cb1 e190 

.......................................


# rm tempfile && sync && sleep 120


# hdparm --read-sector 1318991 /dev/sdb 


/dev/sdb: 

reading sector 1318991: succeeded 

0000 0000 0000 0000 0000 0000 0000 0000 

0000 0000 0000 0000 0000 0000 0000 0000 

....................................... 



위와 같이 0000 으로 채워져야 이상없이 trim 기능 작동하는 것임



# 정확한 방법
# 간단한 확인 방법
# TRIM 기능이 적용되도, 파일의 처음 1개 섹터와 마지막 7개 섹터는 내용이 변하지 않고 나머지 섹터는 0000으로 체워짐
# 바로 윗줄은 불변의 얘기는 아니고, 시스템에 따라 처음 2개 또는 그 이상의 색터도 내용이 변하지 안는 경우도 있음, 
# 여러 섹터를 확인해봐야함

# dd if=/dev/urandom of=tmpfile bs=1M count=3

3+0 records in

3+0 records out

3145728 bytes (3.1 MB) copied, 0.362944 s, 8.7 MB/s


# hdparm --fibmap tmpfile

tmpfile:

 filesystem blocksize 4096, begins at LBA 63; assuming 512 byte sectors.

 byte_offset  begin_LBA    end_LBA    sectors

           0     369727     375870       6144

 

# hdparm --read-sector 369728 /dev/sdd

/dev/sdd:

reading sector 369728: succeeded

b560 f5cd 3258 40d7 a6b6 0a09 23b6 651e

5804 266f e94d 846e 07ed d601 eab3 3c20 

....................................... 

# rm -f tmpfile && sync && sleep 10

# hdparm --read-sector 
369728 /dev/sdd
/dev/sdd:
reading sector 369728: succeeded
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
....................................... 


# 위 내용 세부 설명
# TRIM 기능이 적용되도, 파일의 처음 1개 섹터와 마지막 7개 섹터는 내용이 변하지 않고 나머지 섹터는 0000으로 체워짐
# 바로 윗줄은 불변의 얘기는 아니고, 시스템에 따라 처음 2개 또는 그 이상의 색터도 내용이 변하지 안는 경우도 있음, 
# 여러 섹터를 확인해봐야함
# 따라서 처음과 끝 섹터에서 일정 섹터(보통 2~30이하)를 검사해야 정확하게 판단 가능함

# dd if=/dev/urandom of=tmpfile bs=1M count=3

3+0 records in

3+0 records out

3145728 bytes (3.1 MB) copied, 0.362944 s, 8.7 MB/s


# hdparm --fibmap tmpfile

tmpfile:

 filesystem blocksize 4096, begins at LBA 63; assuming 512 byte sectors.

 byte_offset  begin_LBA    end_LBA    sectors

           0     369727     375870       6144


# hdparm --read-sector 369727 /dev/sdd

/dev/sdd:

reading sector 369727: succeeded

24f5 2e3a 9b74 1748 d299 7898 3f7d 28a3

c4fa aff3 a5db f760 249b d416 1a75 8f32

....................................... 


# hdparm --read-sector 369728 /dev/sdd

/dev/sdd:

reading sector 369728: succeeded

b560 f5cd 3258 40d7 a6b6 0a09 23b6 651e

5804 266f e94d 846e 07ed d601 eab3 3c20 

....................................... 
 

# hdparm --read-sector 375870 /dev/sdd

/dev/sdd:

reading sector 375870: succeeded

46d9 4d96 afc9 aa44 a255 d1bf d8b0 f63f

6c44 8f79 0225 f2f8 fd19 6041 9cf7 ad9c
....................................... 
 

# hdparm --read-sector 375869 /dev/sdd

/dev/sdd:

reading sector 375869: succeeded

b765 1f8f 15fb 2143 ff81 5216 6a58 2bba

da61 658e 106b 95d2 52c4 5764 cfff 4b72

....................................... 
 

# hdparm --read-sector 375868 /dev/sdd

/dev/sdd:

reading sector 375868: succeeded

51e7 7313 c3f4 5344 99d9 2e24 35bc 8033

242a 5d09 6aee c045 7ff0 a1b2 e47b 5b04

....................................... 
 

# hdparm --read-sector 375867 /dev/sdd
/dev/sdd:
reading sector 375867: succeeded
bcc6 0c16 f092 4441 98e6 1681 5688 752a
a702 8676 5685 7c82 2c33 1b59 dcd8 bd99

....................................... 
 

# hdparm --read-sector 375866 /dev/sdd

/dev/sdd:

reading sector 375866: succeeded

a92f 15f3 8025 dda3 7ef4 8498 ea4a b96d

e200 d9cc 7ca8 ea18 99b1 f26b 3ace dc02

....................................... 
 

# hdparm --read-sector 375865 /dev/sdd
/dev/sdd:
reading sector 375865: succeeded
5860 288a 5800 ca86 d51b abf0 f374 e875
be93 0eaf 5ffa 279c 5f39 1b87 78a8 c9f8
....................................... 
 

# hdparm --read-sector 375864 /dev/sdd
/dev/sdd:
reading sector 375864: succeeded
daa8 885c d276 66d8 caf5 bfe4 b8b2 28c2
543e 87d6 d583 c582 d68b 0259 5d8b c09b
....................................... 
 

# hdparm --read-sector 375863 /dev/sdd
/dev/sdd:
reading sector 375863: succeeded
115a bf14 0442 7b71 419e 078e 5f01 3e2d
6fdf 4ce7 8f0e dd55 8988 5c5e a211 36ad
....................................... 

# hdparm --read-sector 375862 /dev/sdd
/dev/sdd:
reading sector 375862: succeeded
64e5 533a 71a9 d75e d450 6e53 1ade 059a
e838 8c97 8b6e 5bfa 2721 3a87 ffe1 0da5
....................................... 

# hdparm --read-sector 375861 /dev/sdd
/dev/sdd:
reading sector 375861: succeeded
2b67 3c1e 2d5d 80dc 6a4a 5f57 70f5 a7c4
b85f 03dc 5cdf 6152 78da 7ac2 9020 4133
....................................... 
 

# rm -f tmpfile && sync && sleep 10

# hdparm --read-sector 369727 /dev/sdd
/dev/sdd:
reading sector 369727: succeeded
24f5 2e3a 9b74 1748 d299 7898 3f7d 28a3
c4fa aff3 a5db f760 249b d416 1a75 8f32
....................................... 
 

# hdparm --read-sector 369728 /dev/sdd
/dev/sdd:
reading sector 369728: succeeded
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
....................................... 
 

# hdparm --read-sector 375870 /dev/sdd
/dev/sdd:
reading sector 375870: succeeded
46d9 4d96 afc9 aa44 a255 d1bf d8b0 f63f
6c44 8f79 0225 f2f8 fd19 6041 9cf7 ad9c
....................................... 

# hdparm --read-sector 375869 /dev/sdd
/dev/sdd:
reading sector 375869: succeeded
b765 1f8f 15fb 2143 ff81 5216 6a58 2bba
da61 658e 106b 95d2 52c4 5764 cfff 4b72
....................................... 

# hdparm --read-sector 375868 /dev/sdd
/dev/sdd:
reading sector 375868: succeeded
51e7 7313 c3f4 5344 99d9 2e24 35bc 8033
242a 5d09 6aee c045 7ff0 a1b2 e47b 5b04
....................................... 

# hdparm --read-sector 375867 /dev/sdd
/dev/sdd:
reading sector 375867: succeeded
bcc6 0c16 f092 4441 98e6 1681 5688 752a
a702 8676 5685 7c82 2c33 1b59 dcd8 bd99
....................................... 

# hdparm --read-sector 375866 /dev/sdd
/dev/sdd:
reading sector 375866: succeeded
a92f 15f3 8025 dda3 7ef4 8498 ea4a b96d
e200 d9cc 7ca8 ea18 99b1 f26b 3ace dc02
....................................... 

# hdparm --read-sector 375865 /dev/sdd
/dev/sdd:
reading sector 375865: succeeded
5860 288a 5800 ca86 d51b abf0 f374 e875
be93 0eaf 5ffa 279c 5f39 1b87 78a8 c9f8
....................................... 

# hdparm --read-sector 375864 /dev/sdd
/dev/sdd:
reading sector 375864: succeeded
daa8 885c d276 66d8 caf5 bfe4 b8b2 28c2
543e 87d6 d583 c582 d68b 0259 5d8b c09b 

....................................... 

# hdparm --read-sector 375863 /dev/sdd

/dev/sdd:

reading sector 375863: succeeded

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

....................................... 

# hdparm --read-sector 375862 /dev/sdd


/dev/sdd:

reading sector 375862: succeeded

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

....................................... 
 

# hdparm --read-sector 375861 /dev/sdd

/dev/sdd:

reading sector 375861: succeeded

0000 0000 0000 0000 0000 0000 0000 0000

0000 0000 0000 0000 0000 0000 0000 0000

....................................... 



'Linux' 카테고리의 다른 글

파티션 UUID 확인 하는 방법  (1) 2012.02.17
awk IP주소 가져오기  (0) 2012.02.07
man 내용 파일로 저장하기  (0) 2012.02.02
areca 1212-1222 핫스페이, 리빌드 관련 정보  (0) 2012.01.17
GeoIP 업데이트  (0) 2011.12.29
Posted by 광장군
,

대단쓰

재미 2011. 11. 16. 18:24


Posted by 광장군
,
[우분투 ssh 접속 속도 문제]

$ sudo vi /etc/ssh/ssh_config

:% s/GSSAPIAuthentication yes/GSSAPIAuthentication no/g

참고 : http://www.walkernews.net/2009/04/06/how-to-fix-scp-and-ssh-login-prompt-is-very-slow-in-linux/

How To Fix: SCP And SSH Login Prompt Is Very Slow In Linux
 

Apparently, today is not a good day for me. But it’s not too bad too as I still have enough fingers to count all these bad incidents :-)

OK, back to topic. How to find out that what cause the SSH or SCP login prompt to slowdown? How could you fix this so-called slow or delayed SSH and SCP login prompt?

This is one of the “bad incident” happened on me today – as the boss was looking at me to scp program patches to a remote Linux-based application server, the SSH login prompt took more than 1 minute to appear on screen.

To be precise, the stopwatch showed that it took exactly 1 minute and 25 seconds to display SSH login prompt!

Luckily, I do not have to Google for more than a minute to find the cause and solution :-)

What causes SCP and SSH login prompt to slowdown? 

For my case, the GSSAPI authentication feature was causing the delayed SSH login prompt!

You can confirm the causes of your case by using the -v option switch. For example, the following is the verbose response of SSH login process started with -v option:
dev01 [/home/devstl]$ ssh -v appssupp@10.50.100.111
......
......
......
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug1: Next authentication method: publickey
debug1: Trying private key: /home/devstl/.ssh/identity
debug1: Trying private key: /home/devstl/.ssh/id_rsa
debug1: Trying private key: /home/devstl/.ssh/id_dsa
debug1: Next authentication method: password
appssupp@10.50.100.111's password:

How to fix SCP and SSH delayed login prompt?

The answer for my case is apparently by disabling GSSAPI authentication, which can be done in one of these three ways:
The “fix” is tested with SSH clients installed by openssh-clients-3.9p1-8.RHEL4.15 RPM file.

1) Specify the option to disable GSSAPI authentication when using SSH or SCP command, e.g.:
ssh -o GSSAPIAuthentication=no appssupp@10.50.100.111

2) Explicitly disable GSSAPI authentication in SSH client program configuration file, i.e. edit the /etc/ssh/ssh_config and add in this configuration (if it’s not already in the config file):
GSSAPIAuthentication no

3) Create a file called config in .ssh directory of respective user home directory (or whichever user home directory that need to get rid of this show login prompt). For example, edit/home/devstl/.ssh/config (create the config file if it’s not currently exist) and add in the GSSAPIAuthentication no option.
1) /etc/ssh/ssh_config is a global SSH client configuration file that affects all system users who are using SSH client programs.

2) /home/devstl/.ssh/config is local SSH client configuration file that only affects the user account called devstl. Whatever SSH client options specified in this local file overwrite the options stated in global SSH client configuration file.

After disabling GSSAPI authentication, SSH login prompt is back to “normal” now:
dev01 [/home/devstl]$ ssh -v appssupp@10.50.100.111
......
......
......
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/devstl/.ssh/identity
debug1: Trying private key: /home/devstl/.ssh/id_rsa
debug1: Trying private key: /home/devstl/.ssh/id_dsa
debug1: Next authentication method: password
appssupp@10.50.100.111's password:

As you can see, the SSH login is not currently authenticated via public key cryptography method, which I’ve to fix it later :-( 
 
Posted by 광장군
,
[우분투] jre 여러 버전 설치됬을때 Default jre 버전 선택

kilim@kilim-desktop:/usr$ sudo update-alternatives --config java
[sudo] password for kilim: 
대체 항목 java에 대해 (/usr/bin/java 제공) 2개 선택이 있습니다.

  선택       경로                                    우선순  상태
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      자동 모드
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      수동 모드
* 2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        수동 모드

기본 사항[*]을 사용하려면 엔터, 다른 것을 사용하려면 번호를 입력하십시오: 0
update-alternatives: /usr/lib/jvm/java-6-openjdk/jre/bin/java 사용해서 자동 모드에서 /usr/bin/java (java) 제공.

kilim@kilim-desktop:/usr$ sudo update-alternatives --config java
대체 항목 java에 대해 (/usr/bin/java 제공) 2개 선택이 있습니다.

  선택       경로                                    우선순  상태
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      자동 모드
  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      수동 모드
  2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        수동 모드

기본 사항[*]을 사용하려면 엔터, 다른 것을 사용하려면 번호를 입력하십시오: ^Ckilim@kilim-desktop:/usr$ 
 
Posted by 광장군
,
[adaptec raid 메니저 설치]

1. 밴더 및 모델명 확인
# lspci
04:00.0 RAID bus controller: Adaptec AAC-RAID (rev 09)

# dmesg
scsi4 : aacraid
  Vendor: Adaptec   Model: 5805 RAID5        Rev: V1.0
  Type:   Direct-Access                      ANSI SCSI revision: 02

2. http://www.adaptec.com/en-us/support/raid/ 에서 해당 모델 찾기

3. 해당 모델 디테일에서 Storage Manager 다운로드

4. 
# wget http://download.adaptec.com/raid/storage_manager/asm_linux_x86_v7_00_18781.tgz
# tar xvfz asm_linux_x86_v7_00_18781.tgz 
# cd cmdline/
# ./arcconf GETCONFIG 1 AL

5. 
/usr/StorMan/arcconf getconfig 1 ## 전체 정보 ##
/usr/StorMan/arcconf getconfig 1 ld ## 간략한 정보 ##
/usr/StorMan/arcconf getstatus 1 ## 현재 레이드상태 ##
/usr/StorMan/arcconf getlogs 1 device ## device 로그 보기 ##
/usr/StorMan/arcconf getlogs 1 event ## event 로그 보기 ##
/usr/StorMan/arcconf getlogs 1 dead ## dead 로그 보기 ##


[areca raid 메니저 설치]

1. 밴더 및 모델명 확인

# lspci
03:00.0 RAID bus controller: Areca Technology Corp. ARC-1680 8 port PCIe/PCI-X to SAS/SATA II RAID Controller

# dmesg
ARECA RAID ADAPTER2: FIRMWARE VERSION V1.46 2009-01-06 
scsi2 : Areca SAS Host Adapter RAID Controller( RAID6 capable)
 Driver Version 1.20.00.15.RH1 2008/02/27
  Vendor: Areca     Model: ARC-1222-VOL#000  Rev: R001
  Type:   Direct-Access                      ANSI SCSI revision: 05
sdb : very big device. try to use READ CAPACITY(16).

2. ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/Linux/CLI/ 에서 해당 모델 CLI 다운로드

3. 
# wget ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/Linux/CLI/v1.84_101109.zip
# unzip v1.84_101109.zip 
# cd V1.84_101109/
# cd x86-64/
# chmod u+x cli64 
# ./cli64 

4.
CLI > help
CLI > disk info
CLI > rsf info
CLI > vsf info

Posted by 광장군
,
* lastlog 안남기기
WtmpLog off

* xferlog 안남기기
#TransferLog /var/log/xferlog
TransferLog /dev/null
Posted by 광장군
,
[amazon RDS - function, Stored procedure 만들기]

1. command_line_tools 설치 및 환경설정
   첨부된 command_line_tools.mp4 동영상 보면서 따라하되
   windows 환경변수에 EC2_REGION 값을 세팅 해야 함
  ; EC2_REGION 값은 DB Domain 정보에서 가져오거나
    "AWS Management Console(https://console.aws.amazon.com/s3/home)" -> RDS -> DB Instances
     에서 가져올 수 있음 (Zone: ap-northeast-1b 에서 마지막 b를 뺀 ap-northeast-1 만 가져와야 함)

[command_line_tools]


(아래 동영상은 그냥 참고만)
[Amazon_RDS_Signup_and_DB_Instance_Creation]



2. command_line_tools를 이용한 DB 세팅
   http://blog.peterdelahunty.com/2010/10/stored-procedures-on-amazon-rds.html
    (혹시 몰라서 위 내용 아래 첨부함)
    에 따라서 작업함

Stored procedures on Amazon RDS

Thursday, October 14, 2010

Been a long time since i blogged but need to document this pain in the arse.

So for a new project i need to create a mysql function (same for stored proc) on amazon RDS.

When i tried to install it i got this error:

ERROR 1419 (HY000) at line 3: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

So to get them to install you need to set that database parameter to ON. However to do that is not so simple.

Lucky for you people i have found out how to do it and here are the steps:

1) Install the RDS CLI tools. I installed these on my EC2 instance.

Download from here:
http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=294&externalID=2928

They are java based and so you need have Java running. Plus they need your amazon key and secret key. Once you have them installed following the readme do the following:

Important!! make sure you set the AWS region you are working in.
Eg export EC2_REGION=ap-southeast-1

2) create a new parameter group

rds-create-db-parameter-group peters-params -f mysql5.1 -d "peters params"

3) modify the log_bin_trust_function_creators to be set to ON

rds-modify-db-parameter-group peters-params --parameters="name=log_bin_trust_function_creators, value=on, method=immediate"

4) change your running db instance to use the new param group

rds-modify-db-instance petersdbinstance --db-parameter-group-name=peters-params

5) restart the instance

rds-reboot-db-instance petersdbinstance


That will allow you to create a function or stored procedure:

Some point about the function / stored proc:

You need to specify the DETERMINISTIC stuff and you need to add a DEFINER=CURRENT_USER


DELIMITER $$
DROP FUNCTION IF EXISTS `sayhello`$$
CREATE DEFINER=CURRENT_USER FUNCTION `sayhello`(param1 VARCHAR(120))
RETURNS VARCHAR(120)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
RETURN CONCAT('Hello, ',s,'!');

END$$
DELIMITER ;


This works for me hope it helps
Posted by 광장군
,

[Nginx - 경우에 따라 inactive time을 바꾸기]
2011. 03. 24. 임광일

* proxy_cache_path는 http Context에서만 수정 가능함

* set $abc 1m 와 같은 변서 세팅은 http Context에서 사용 안됨

* 또한 inactive option은 변수 처리 안됨
  ex) /cache levels=2:2:2 keys_zone=DELL:10m inactive=$abc max_size=1g; <= 에러

* proxy_cache_valid는 inactive option에 적용 순위 밀림
  실제 의미 없어 보임

* 그 외 여러가지 if문이나 변수 처리로 해보려했으나 모두 안됨

* proxy_cache_path는 PATH가 UNIQUE 해야함
  그렇지 않으면 후순위로 정의한 경우에는 DEFAULT 값이 먹음
  ex) proxy_cache_path        /cache levels=2:2:2 keys_zone=DELL1:10m inactive=1m max_size=1g;
      proxy_cache_path        /cache levels=2:2:2 keys_zone=DELL2:10m inactive=2m max_size=1g;
      와 같이 적용 했을 경우 DELL1 사용에서는 inactive=1m 가 적용 되었는데
                             DELL2 사용에서는 inactive=10m 이 적용 됨

* 그런데 캐싱 데이터는 공유 해야 하기 때문에 ln -s /cache1 /cache2 와 같은 형태로 링크 시켜서 사용

* keys_zone이 달라도 proxy_cache_key 값이 같으면 키 값은 동일

* location에 따라 다른 keys_zone을 사용하는 방식을 이용해서 inactive time 다르게 처리
  ex) location /1/ { proxy_cache             DELL1; }
      location /2/ { proxy_cache             DELL2; }

* DELL1은 inactive=1m 이고
  DELL2는 inactive=2m 일때
  DELL1 서치후 DELL2 서치하면 , 파일은 기존 파일로 유지, inactive time 도 1m에서 1m 으로 유지
  DELL2 서치후 DELL1 서치하면 , 파일은 신규 파일로 변경, inactive time 도 2m에서 1m 으로 변경

* 위와 같은 결과로 "HOT ISSUE 검색어 처리" 같은 경우는 cron으로 5m 마다 특정 keys_zone을 만들어서
  캐시를 생성하면 짧은 inactive time 우선 처리 하기 때문에 이상 없음

Posted by 광장군
,

독일 드레스덴 어느 공원에서
사용자 삽입 이미지
Posted by 광장군
,