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

# 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 광장군
,