ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • EXT4에서 ssd - trim사용
    컴퓨터 2012. 3. 12. 07:42





    ext4 파일시스템에서 trim을 활성화 시키는 방법에 대한 스크랩입니다. 




    1.

    CentOS 6 버전부터 지원
    ext4 파일시스템에 옵션 추가하여 trim 기능 enable

    (단 SSD에서 TRIM 지원되어야 함)

     

    $ vi /etc/fstab

    /dev/sda1  /  ext4  defaults,discard  0 0



    hdparm으로 해당 SSD가 "Trim"을 지원하는지 확인하는방법


    hdparm -I /dev/sda   (-I는 대문자 아이)


    결과에서  * DATA Set Management determinate TRIM supported  메세지 확인.

    출처
    http://blog.naver.com/biosoft?Redirect=Log&logNo=40152991465 
    http://cafe.naver.com/ssdsamo.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=5003 


     


    2.

    /etc/fstab에 아래와 같이 discard 옵션을 넣어주면 됩니다. ext4만 지원합니다.

     

    /dev/sda5  /opt  ext4  defaults,discard  0 0


    출처

    http://www.ysy2080.com/uribury/?document_srl=2888&mid=linuxno1&sort_index=readed_count&order_type=asc
     


     

    3.

    Chapter 23.  Solid-State Disk Deployment Guidelines

    Solid-state disks (SSD) are storage devices that use NAND flash chips to persistently store data. This sets them apart from previous generations of disks, which store data in rotating, magnetic platters. In an SSD, the access time for data across the full Logical Block Address (LBA) range is constant; whereas with older disks that use rotating media, access patterns that span large address ranges incur seek costs. As such, SSD devices have better latency and throughput.
    Not all SSDs show the same performance profiles, however. In fact, many of the first generation devices show little or no advantage over spinning media. Thus, it is important to define classes of solid state storage to frame further discussion in this section.
    SSDs can be divided into three classes, based on throughput:
    • The first class of SSDs use a PCI-Express connection, which offers the fastest I/O throughput compared to other classes. This class also has a very low latency for random access.
    • The second class uses the traditional SATA connection, and features fast random access for read and write operations (though not as fast as SSDs that use PCI-Express connection).
    • The third class also uses SATA, but the performance of SSDs in this class do not differ substantially from devices that use 7200rpm rotational disks.
    For all three classes, performance degrades as the number of used blocks approaches the disk capacity. The degree of performance impact varies greatly by vendor. However, all devices experience some degradation.
    To address the degradation issue, the host system (for example, the Linux kernel) may use discard requests to inform the storage that a given range of blocks is no longer in use. An SSD can use this information to free up space internally, using the free blocks for wear-leveling. Discards will only be issued if the storage advertises support in terms of its storage protocol (be it ATA or SCSI). Discard requests are issued to the storage using the negotiated discard command specific to the storage protocol (TRIM command for ATA, and WRITE SAME with UNMAP set, or UNMAP command for SCSI).
    Enabling discard support is most useful when there is available free space on the file system, but the file system has already written to most logical blocks on the underlying storage device. For more information about TRIM, refer to itsData Set Management T13 Specifications from the following link:
    For more information about UNMAP, refer to section 4.7.3.4 of the SCSI Block Commands 3 T10 Specification from the following link:

    Note

    Not all solid-state devices in the market have discard support.

    23.1.  Deployment Considerations

    Because of the internal layout and operation of SSDs, it is best to partition devices on an internal erase block boundary. Partitioning utilities in Red Hat Enterprise Linux 6 chooses sane defaults if the SSD exports topology information.
    However, if the device does not export topology information, Red Hat recommends that the first partition be created at a 1MB boundary.
    In addition, keep in mind that MD (software raid) does not support discards. In contrast, the logical volume manager (LVM) and the device-mapper (DM) targets that LVM uses do support discards. The only DM targets that do not support discards are dm-snapshot, dm-crypt, and dm-raid45. Discard support for the dm-mirror was added in Red Hat Enterprise Linux 6.1.
    Red Hat also warns that software RAID levels 1, 4, 5, and 6 are not recommended for use on SSDs. During the initialization stage of these RAID levels, some RAID management utilities (such as mdadm) write to all of the blocks on the storage device to ensure that checksums operate properly. This will cause the performance of the SSD to degrade quickly.
    At present, ext4 is the only fully-supported file system that supports discard. To enable discard commands on a device, use the mount option discard. For example, to mount /dev/sda2 to /mnt with discard enabled, run:
    # mount -t ext4 -o discard /dev/sda2 /mnt
    
    By default, ext4 does not issue the discard command. This is mostly to avoid problems on devices which may not properly implement the discard command. The Linux swap code will issue discard commands to discard-enabled devices, and there is no option to control this behavior.
     
    출처

    http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newmds-ssdtuning.html


     
Designed by Tistory.