SSD required for Linux platform (Ubuntu for example)

Source: Internet
Author: User
Tags gparted

From: http://yblog.org/archive/index.php/11734

The biggest difference between an SSD and a general traditional hard drive is that its memory-to-life ratio is limited, and the fast Memory (flash memory) in the same data area) SSD memory uses a special algorithm built in the control chip to evenly distribute data to the fast-moving memory chip in different regions.

For Ubuntu Linux, my Acer 3750g laptop is Ubuntu 11.04, sataii SSD 120 GB (sandforce SF-1222 control chip ), after UEFI is enabled, it takes about 8 seconds to enter the automatic desktop.

1. Use the region division program

When SSD is used on Linux, the most important thing is the question "yes" in the "split hard disk magnetic area, this is because the hard drive of the guest system has magnetic column and magnetic fan settings (CHS address), but the SSD does not, so when the size of the magnetic zone is set, if there is no partition alignment, there will be problems with performance and performance. This already applies to the new hard drive splitter.

The most common gparted new version (0.7.0 in my hand) is the decentralized magnetic zone separation tool, which provides the ability to automatically operate magnetic zones, when installing Ubuntu or other Linux releases to SSD, you can enter the desktop. Before installing the program, use the live-CD or live-USB-based magnetic zone management program gparted (to be installed) for segmentation.

When the SSD Partition Table is formatted, select the form of the partition MBR (Master Boot Record. If your desktop and laptop are in a new style, the boot experience has been changed to a new technology and faster UEFI, therefore, we recommend that you select the guid table format for initial formatting. (Mac OS now uses this new table format ), that is to say, you can select the GPT splitting form (recommended). Of course, you need to follow the MBR and msdos types.

Then, you can format the magnetic area according to your original linear partition (gparted mentioned earlier) on the graphic interface. For the graphic interface, you must use GPT fdisk, in order to help you perform automatic operations and use fdisk, You have to calculate the problem of the magnetic region on your own, now, the new fdisk version can be solved by fdisk-Cu (device. The gparted border interface is divided into magnetic blocks for operations. The options for automatic assignment are in the lower left corner, and the option "MIB" should be selected in the upper right corner. Do not select "magnetic column 」.

In the case of a 256 gb ssd, the recommended memory size is/boot to MB,/to 20 GB, and the full storage space to/home. Then, the recommended memory size is/tmp, put it in tmpfs, and use the system DRAM memory to recover data, which is less harmful to SSD.

When Ubuntu or other Linux distro is installed on a USB flash drive, you may find that the loading time is too short, if you do not want to wait for the online update case, you can select to skip the section of the offline update case. Just install Ubuntu on your own. After the server is re-activated and connected to the Internet, you can update the package automatically or complete the package security.

2. Set the finalize parameter selection, and trim

After installing Linux, it is very important.

To maintain a long period of time and speed, SSD needs to be supported by trim, this allows SSD to erase the information that is marked on the fast-moving memory chip only during non-peak hours. This example is based on the ext4 operating system. In the case of ext4, after the division, the system cycle will actually erase the data only when it runs to the sync command. To enable trim support, you need to configure the fstab so that the specified magnetic region selection can be added with the discard flag.

Commands to be placed in the terminal window

Fstab first copySudo CP/etc/fstab/etc/fstab_bak-notrim

Fstab zookeeperSudo gedit/etc/fstab

Add the trim magnetic zone to the hosts file window, for example, this line "UUID = [long string of English letters and numbers]/ext4 errors = remount-ro 0 1 」

AddDiscard,

Or after ults,

Then, the trim is supported after the host is restarted.

I will addNoatime, nodiratime, discard,

Noatime and noairatime do not access the legal case or data source, which is equivalent to the least frequent access to the magnetic zone.

For example, the setting of my/home magnetic zone will become

#/Home was on/dev/sda3 during installation
UUID = 2d86c8c2-2db5-4f10-a5e8-b91d04a06518/home ext4 noatime, nodiratime, discard, defaults 0 2

Or similar ext4 noatime, nodiratime, discard, errors = remount-ro 0 1

After all the changes, please save the file.

3. Upload/tmp as tmpfs

In the same way, add this line at the bottom of the sudo gedit/etc/fstab file.

Tmpfs/tmpfs defaults, noatime, mode = 1777 0 0

Tmpfs/var/spool tmpfs ults, noatime, mode = 1777 0 0

Tmpfs/var/tmp tmpfs ults, noatime, mode = 1777 0 0
 
You can use sudo Mount-oremount/

If your computer or table machine uses SSD instead of a server, you can add

Tmpfs/var/log tmpfs ults, noatime, mode = 0755 0 0

This is to allow log files to be stored in the memory, reducing access to SSD, improving efficiency and killing SSD.

After that, you can go through the about: config settings in Firefox and redirect the cache to/tmp to improve the efficiency of Firefox, you can also reduce the number of snapshots for SSD.

Added browser. cache. disk. parent_directory.

Set the data value to/tmp

If you want to renew your subscription, the bytes column will be written into the "about: cache" column.

4. SSD speed

I only provide one of the most simple methods here. Apart from using the disk utility, it is best to open the terminal window (terminal ).

Command

Hdparm-Tt/dev/sdxThis X is A or B. Check whether your SSD is the first or second hard drive. I am SDA, because it is the first hard drive.

Timing cached reads: x mb in Y seconds = z MB/sec this is the cache speed, which is related to your SSD support for sataii or sataiii and the dram cache above.

Timing buffered disk reads: x mb in Y seconds = z MB/sec is the real SSD fetch efficiency value.

This is the result for me:

/Dev/SDA:
Timing cached reads: 9760 MB in 2.00 seconds = 4883.67 MB/sec
Timing buffered disk reads: 774 MB in 3.00 seconds = 257.57 MB/sec

Summary

In general, SSD will run well on your Ubuntu or other Linux releases. If you want to change the I/O schedline to provide the system efficiency, you can change it to Noop or deadline. In theory, SSD is used, and the latter will be faster in a long time than the slave.

You need to modify the animation to the/etc/default/GRUB settings.

Extended zookeeper

Howto: Configure ext4 to enable trim support for SSDS on Ubuntu and other distributions

Howto: Check if trim on ext4 is enabled and working on Ubuntu and other distributions

Aligning filesystems to an SSD's erase block size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.