Action disabled: source

Trim on SSD

트림을 알려면 아래의 개념을 다 이해해야 한다.

출처: http://www.valken.net/460

Spreading

해석하면 넓게 펼쳐 쓰는 것이다. 예를 들어 파일을 다시 쓸 경우, 원래 위치에 저장하는 것이 아니라, 다른 깨끗한 영역으로 옮겨 가며 쓰기를 하는 것이다. 이렇게 할 경우, 이미 포맷된 깨끗한 영역에 쓰기를 하기 때문에, 삭제로 인한 쓰기 속도가 하락이 생기지 않는다. 즉, 삭제하는 절차를 피하여 성능을 높이는 것이다. 또한, 같은 영역을 반복해서 써서 발생하는 수명 문제도 어느정도 극복할 수 있다.

다만, 이렇게 사용할 경우, 비어 있는 모든 영역에 죄다 한번씩 쓰기를 하게 된 이후로부터는, 쓰기 전에 삭제하는 절차를 수행해야 하므로 성능 저하가 발생한다.(주: 그래도 HDD 보단 빠르다.) 이 성능 저하를 해결하기 위해서는 더러워진 영역을 깨끗하게 삭제해 주면된다. 이를 GC (garbage collection) 라고 부른다. 초기에는 이를 사용자가 수동으로 수행해줘야 했지만, 좀더 세련되게 자동으로 해주는 것이 TRIM 이란 기술이 추가되었다.

Counting

해당 영역을 몇번 쓰기를 했는지, 그 쓰기 횟수(주: 좀더 정확히는 삭제 횟수)를 저장한다. 그리고, 쓰기 횟수가 적은 영역을 먼저 사용하도록 하는 기법이다. Spreading 과 병행해서 사용한다. 성능과는 무관하고, 수명을 늘이기 위한 기법이다.

Swapping

Counting 을 하더라도, OS 처럼 한번 쓰고나면 줄창 읽기만 하는 영역이 있고, 데이터 영역처럼 읽고 쓰기가 자주 일어 나는 영역이 있다. 이런 경우 OS 가 사용하는 영역은 처음에 포맷을 한번은 하니깐, 쓰기 횟수가 1 이며, 데이터 영역은 쓰기 횟수가 높을 것이다. 이럴 경우 OS 처럼 쓰기 횟수가 적은 데이터를 쓰기 횟수가 많은 곳으로 옮기고, 이 영역을 데이터들이 사용하도록 바꿔 준다. Counting 을 좀더 적극적으로 사용하여 수명을 늘리는 기법이다.

Garbage Collection

GC 는 일반적으로 메모리 관리에 나오는 용어인데, SSD 에서도 비슷한 동작을 수행한다. Spreading 기법에 의해서 삭제 예정이지만, 아직 삭제 되지 않은 영역을 깨끗하게 해주는 작업이다. 초기에는 이를 수동으로 해주어야 했지만, TRIM 이란 기능이 생기면서 OS 에서 자동으로 해주는 것으로 바뀌었다.

TRIM

앞서 설명했듯이 GC 를 OS 가 자동으로 해주도록 해주는 기능이며, 쓰기 성능을 높게 유지 시켜 주는 기능이다. OS 스케줄러가 보기에 SSD 읽고 쓰기가 적은 시간에 열심히, 더러워진 영역을 청소해준다.

트림(Trim)기능이란 무엇입니까? 참조. http://loversky20.tistory.com/148

저널링끄기

ext4의 저널을 어떻게 끌 것인가? 첫번째, 저널의 제거는 파일시스템이 마운트된 상태에서는 할 수 없다. 운영체제가 포함된 드라이브의 저널을 끄려면, 다른 드라이브로 부팅하는게 필요하다. 난 Arch Linux를 사용하고, 우분투 라이브 CD 같은 Arch 인스톨 디스크로 작업했다. 파일시스템 변경 툴의 필요성이 표준 이슈가 되면서, 여러 리눅스 라이브 배포판으로 작업 가능하게 되었다.

다른 디스크로 부팅 했으면, 터미널을 열고 루트 권한을 얻거나 sudo를 사용해 명령어를 입력해라. 저널을 제거하기를 원하는 ext4 파티션이 /dev/sda1 이라고 가정하고, 아래에 따라 작업한다. 명령어: tune2fs -O ^has_journal /dev/sda1 그리고 나서 파일시스템 검사를 돌리는게 좋다. e2fsck -f /dev/sda1 [출처] 리눅스 SSD, TRIM|작성자 gccc

http://blog.naver.com/PostView.nhn?blogId=gccc&logNo=30103576630

Trim on ubuntu

http://askubuntu.com/questions/18903/how-to-enable-trim

There are two forms of TRIM, manual (wiper.sh) and automatic:

1) Manual TRIM

In ubuntu this can be performed with wiper.sh, but is not needed when automatic TRIM is enabled.

2) Automatic TRIM

Automatic TRIM is supported since kernel 2.6.33 with the EXT4 file system

For automatic TRIM to work, the drive needs to be mounted with the "discard" option in fstab. To add this option run:

sudo cp /etc/fstab ~/fstab-backup gksudo gedit /etc/fstab add discard to options on the entry for the SSD; the line should read similar to this:

UUID=ed586ab8-08c5-4bae-b118-d191b716b4a4 / ext4 discard,errors=remount-ro 0 1 reboot, automatic TRIM should now be working.

Testing automatic TRIM:

To Test if Trim is working issue the following commands (adapted from here):

cd / #or whatever part of the file system is on the SSD sudo dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct # you will not need sudo for these to work, if your SSD is in /home for example sudo hdparm –fibmap tempfile From the output copy the number under "begin_LBA" and use it in the next command. Also check the system name of your SSD: System→Administration→Disk Utility (sda, sdb, or sdc …)

sudo hdparm –read-sector 2638848 /dev/sda #replace 2638848 with the number obtained before and /sda with your SSD drive you should receive a a long string of characters for those sectors

sudo rm tempfile sync sudo hdparm –read-sector 2638848 /dev/sda even after removing the file the sectors are still not empty. Wait a while then run the command again

sudo hdparm –read-sector 2638848 /dev/sda if you get only zeros, then automatic TRIM is working.

* 출처: Trim on SSD

누구나 수정하실 수 있습니다. 문법은 Formatting Syntax참조하세요.

역링크