ÔõÑùʹÓÃLinux¾ÙÐÐÎļþϵͳÐÔÄܵ÷ÓÅ
ÔõÑùʹÓÃlinux¾ÙÐÐÎļþϵͳÐÔÄܵ÷ÓÅ
СÐò£º
ÎļþϵͳÊDzÙ×÷ϵͳÖкÜÊÇÒªº¦µÄÒ»²¿·Ö£¬ËüÈÏÕæÖÎÀíºÍ´æ´¢ÎļþÊý¾Ý¡£ÔÚLinuxϵͳÖУ¬ÓжàÖÖÎļþϵͳ¿É¹©Ñ¡Ôñ£¬Èçext4¡¢XFS¡¢BtrfsµÈ¡£ÎªÁË»ñµÃ¸üºÃµÄÐÔÄܺÍЧÂÊ£¬¶ÔÎļþϵͳ¾ÙÐе÷ÓÅÊÇÖÁ¹ØÖ÷ÒªµÄ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃlinux¾ÙÐÐÎļþϵͳÐÔÄܵ÷ÓÅ£¬²¢¸ø³öÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢Ñ¡ÔñºÏÊʵÄÎļþϵͳ£º
²î±ðµÄÎļþϵͳ¶Ô²î±ðµÄÊÂÇ鸺ÔØÓвî±ðµÄ˳ӦÐÔ¡£ÔÚÑ¡ÔñÎļþϵͳʱ£¬ÐèҪ˼Á¿ÊÂÇ鸺ÔصĶÁд±ÈÀý¡¢Êý¾ÝÇå¾²ÐÔÒªÇóµÈÒòËØ¡£
ext4£ºÊÊÓÃÓÚͨÓó¡¾°£¬ÎȹÌÐÔºÍÐÔÄܶ¼½ÏºÃ¡£
XFS£ºÊÊÓÃÓÚ´óÐÍÎļþ´æ´¢ºÍ¸ß²¢·¢»á¼û£¬ÊʺϸßÐÔÄܵÄЧÀÍÆ÷¡£
Btrfs£ºÊÊÓÃÓÚ´ó¹æÄ£Êý¾ÝµÄ´æ´¢ºÍÖÎÀí£¬Ö§³Ö¿ìÕÕ¡¢Ñ¹ËõµÈ¸ß¼¶ÌØÕ÷¡£
¶þ¡¢µ÷½âÎļþϵͳ²ÎÊý£º
LinuxϵͳÖеÄÎļþϵͳ²ÎÊý¿ÉÒÔͨ¹ýµ÷½âÄں˲ÎÊýÀ´¾ÙÐÐÓÅ»¯£¬³£ÓõIJÎÊý°üÀ¨£º
Îļþϵͳ¹ÒÔØÑ¡Ïmount options£©£º¿ÉÒÔͨ¹ýÐÞ¸Ä/etc/fstabÎļþÀ´ÉèÖá£
noatime£º½ûÓÃÎļþÔÚ»á¼ûʱ¸üлá¼ûʱ¼ä´Á£¬¿ÉïÔÌ´ÅÅÌI/O²Ù×÷¡£
nodiratime£º½ûÓÃÎļþ¼ÐÉÏÎļþµÄ»á¼ûʱ¼ä´Á¸üС£
relatime£º×Ô¶¯¸üÐÂÎļþÔÚ»á¼ûʱµÄʱ¼ä´Á£¬µ«½öÔÚÉϴλá¼ûʱ¼äÁè¼ÝÉÏ´ÎÐÞ¸Äʱ¼äÖ®ºó¸üУ¬ïÔÌ´ÅÅÌI/O²Ù×÷¡£
´ÅÅ̵÷ÀíËã·¨£¨I/O Scheduler£©£º¿Éͨ¹ý/sys/block/{device}/queue/schedulerÎļþÀ´ÉèÖá£
deadline£ºÊʺÏ×ÀÃæÇéÐΣ¬ÄÜ°ü¹Ü¶ÁдÇëÇóµÄʵʱÏìÓ¦¡£
noop£ºÊʺϸ߸ºÔصÄЧÀÍÆ÷ÇéÐΣ¬½«I/OÇëÇó°´Ë³Ðò´¦Öóͷ£¡£
´úÂëʾÀý£º
ÐÞ¸Ä/etc/fstabÎļþ£º
UUID=<uuid> /mnt ext4 defaults,noatime 0 0
µÇ¼ºó¸´ÖÆ
Ð޸ĴÅÅ̵÷ÀíËã·¨£º
echo deadline > /sys/block/sda/queue/scheduler
µÇ¼ºó¸´ÖÆ
Èý¡¢ÉèÖÃÎļþϵͳ»º´æ£º
LinuxϵͳĬÈÏʹÓÃpage cacheÀ´Ìá¸ßÎļþϵͳµÄÐÔÄÜ¡£¿ÉÒÔͨ¹ýÐÞ¸Ä/sys/block/{device}/queue/read_ahead_kbÎļþÀ´ÉèÖÃÔ¤¶ÁÈ¡µÄÊý¾Ý¿é¾Þϸ£¬ÒÔ˳Ӧ²î±ðµÄÊÂÇ鸺ÔØ¡£
´úÂëʾÀý£º
echo 2048 > /sys/block/sda/queue/read_ahead_kb
µÇ¼ºó¸´ÖÆ
ËÄ¡¢ÆôÓÃTRIMÖ§³Ö£º
¹ØÓÚʹÓùÌ̬ӲÅÌ£¨SSD£©µÄÎļþϵͳ£¬ÆôÓÃTRIMÖ§³Ö¿ÉÒÔÌá¸ßÎļþϵͳµÄÐÔÄܺÍÊÙÃü¡£¿ÉÒÔͨ¹ýÐÞ¸Ä/etc/fstabÎļþÀ´¿ªÆôTRIM¡£
´úÂëʾÀý£º
UUID=<uuid> /mnt ext4 defaults,noatime,discard 0 0
µÇ¼ºó¸´ÖÆ
Î塢ʹÓÃÑÓ³Ùд£¨Lazy Write£©£º
ÈÃÎļþϵͳ»º´æ¾¡¿ÉÄܶàµÄдÇëÇó£¬ïÔ̶Դ洢װ±¸µÄд²Ù×÷£¬Ìá¸ßÐÔÄÜ¡£
´úÂëʾÀý£º
echo 1000 > /proc/sys/vm/dirty_expire_centisecs echo 1000 > /proc/sys/vm/dirty_writeback_centisecs
µÇ¼ºó¸´ÖÆ
Áù¡¢ÓÅ»¯´ÅÅ̵÷Àí£º
¹ØÓڸ߸ºÔصÄЧÀÍÆ÷ÇéÐΣ¬¿ÉÒÔͨ¹ýµ÷½â´ÅÅ̵÷ÀíËã·¨À´Ìá¸ßÐÔÄÜ¡£
´úÂëʾÀý£º
echo 1024 > /sys/block/sda/queue/nr_requests
µÇ¼ºó¸´ÖÆ
½áÂÛ£º
ͨ¹ýÑ¡ÔñºÏÊʵÄÎļþϵͳ¡¢µ÷½âÎļþϵͳ²ÎÊý¡¢ÉèÖÃÎļþϵͳ»º´æ¡¢ÆôÓÃTRIMÖ§³Ö¡¢Ê¹ÓÃÑÓ³ÙдºÍÓÅ»¯´ÅÅ̵÷ÀíµÈÒªÁ죬¿ÉÒÔÓÐÓÃÌá¸ßLinuxϵͳµÄÎļþϵͳÐÔÄÜ¡£ÔÚµ÷ÓÅÎļþϵͳʱ£¬Ðèƾ֤Ïêϸ³¡¾°¾ÙÐÐÉèÖ㬲¢¾ÙÐгä·Ö²âÊÔÒÔÑéÖ¤ÐÔÄÜÌáÉýЧ¹û¡£
²Î¿¼ÎÄÏ×£º
https://www.kernel.org/doc/html/latest/filesystems/filesystems.html
https://wiki.archlinux.org/index.php/Solid_state_drive#Filesystem_mount_options
https://www.kernel.org/doc/html/latest/block/index.html
ÒÔÉϾÍÊÇÔõÑùʹÓÃLinux¾ÙÐÐÎļþϵͳÐÔÄܵ÷ÓŵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡