Ubuntu 12.04下SSD的配置

本文详细介绍了SSD中TRIM指令的手动和自动形式,包括如何启用自动TRIM、如何进行手动TRIM操作,以及如何测试TRIM是否正常工作。此外还提供了具体的命令示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有关partition aligned, gparted支持所以请使用gparted来进行分区,如果不是aligned,gparted会warning的。

有关TRIM,请看:

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

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

1) Manual TRIM

In ubuntu this can be performed with fstrim, but is not needed when automatic TRIM is enabled. fstrim first appeared in 11.10, on earlier systems you have to use wiper.sh which can be found at/usr/share/doc/hdparm/contrib/wiper.sh.gz

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.

转载于:https://www.cnblogs.com/super119/archive/2012/11/08/2760987.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值