<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>32687</bug_id>
          
          <creation_ts>2016-10-31 10:11:51 +0300</creation_ts>
          <short_desc>После установки на ssd не работает trim</short_desc>
          <delta_ts>2022-08-21 13:31:17 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>util-linux</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://altlinux.org/ssd</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>43582</blocked>
    
    <blocked>32650</blocked>
    
    <blocked>43581</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Anton Farygin">rider</reporter>
          <assigned_to name="Alexey Gladkov">legion</assigned_to>
          <cc>aen</cc>
    
    <cc>boyarsh</cc>
    
    <cc>cas</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>ldv</cc>
    
    <cc>legion</cc>
    
    <cc>placeholder</cc>
    
    <cc>rider</cc>
    
    <cc>vt</cc>
    
    <cc>zerg</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>159579</commentid>
    <comment_count>0</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-10-31 10:11:51 +0300</bug_when>
    <thetext>Необходимо в случае установки на SSD запускать fstrim как минимум раз в неделю по расписанию.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159582</commentid>
    <comment_count>1</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-10-31 10:43:41 +0300</bug_when>
    <thetext>Как воспроизвести?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159583</commentid>
    <comment_count>2</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-10-31 10:52:17 +0300</bug_when>
    <thetext>А рецепт с fstab : http://vasilisc.com/trim-ssd годится7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159584</commentid>
    <comment_count>3</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-10-31 10:54:47 +0300</bug_when>
    <thetext>Найти в коде место, где вызывается fstrim -a по крону. 

Ну или поставить на ssd, через месяц дать команду fstrim -v -a и убедиться в том, что TRIM не выполнен.
# fstrim -v -a
/: 52,6 GiB (56417341440 bytes) trimmed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159585</commentid>
    <comment_count>4</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-10-31 10:56:22 +0300</bug_when>
    <thetext>Рецепт с fstab признан устаревшим. У меня он не работает.

В других популярных дистрибутивах fstrim вызывается по крону.

Эту функцию нужно иметь возможность отключить.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159586</commentid>
    <comment_count>5</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-10-31 10:59:51 +0300</bug_when>
    <thetext>http://help.ubuntu.ru/wiki/ssd/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159587</commentid>
    <comment_count>6</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-10-31 11:01:31 +0300</bug_when>
    <thetext>И еще (ссылки от rider@) : http://askubuntu.com/questions/443761/how-is-trim-enabled</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159596</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2016-10-31 16:12:05 +0300</bug_when>
    <thetext>Собери пакетик, который можно класть в дистрибутивы?

Разумеется, стоит проверять, что работаем по SSD
(по /sys/block/sd?/queue/rotational -- должен быть нолик).

У меня на локалхосте воткнуто в скриптик синхронизации сизифа :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159597</commentid>
    <comment_count>8</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-10-31 16:21:12 +0300</bug_when>
    <thetext>В исходниках util-linux лежит fstrim.service и fstrim.timer
А проверять надо делать или нет оно умеет само (fstrim -a)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159609</commentid>
    <comment_count>9</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-10-31 18:23:25 +0300</bug_when>
    <thetext>Кстати, для сервера это тоже актуально</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159610</commentid>
    <comment_count>10</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-10-31 18:34:14 +0300</bug_when>
    <thetext>Т.е. - для того, что бы делать TRIM на ssd достаточно время от времени запускать fstrim -a, все необходимые сервисы (systemd) для которого лежат в исходниках util-linux
Устанавливать это нужно не только на сервера, но и на рабочие станции.
fstrim -a сам умеет (я посмотрел в исходники) определять, для каких дисков нужно делать TRIM а для каких - нет.
Эту функцию нужно включить во все собираемые дистрибутивы, включая стартеркиты.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159635</commentid>
    <comment_count>11</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2016-11-01 13:22:03 +0300</bug_when>
    <thetext>По твоей же ссылке:

---
Only Intel and Samsung SSDs will have TRIM enabled by default in Ubuntu 14.04 because some cheap SSDs can even brick themselves when running TRIM.
--- http://askubuntu.com/questions/443761/how-is-trim-enabled

Повторюсь, просьба по возможности помочь с пакетом.  Я давно хочу добавить такую функциональность, сдерживают именно редкие, но меткие косяки прошивок, о которых порой слышу.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159637</commentid>
    <comment_count>12</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-11-01 13:26:56 +0300</bug_when>
    <thetext>Миша, blacklist теперь в ядре, посмотри последний комментарий здесь:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1259829
А ещё патч тут:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/ata?id=3b8d2676d15d6b2326757adb66b70a9cd6650373

И баг тут:
https://bugzilla.kernel.org/show_bug.cgi?id=71371

Можно смело запускать fstrim -a везде где хочешь.
Если вылезет проблема - совет отключить trim и дать нам информацию о проблемном устройстве для добавления в blacklist ядра.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159686</commentid>
    <comment_count>13</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2016-11-02 15:21:57 +0300</bug_when>
    <thetext>(В ответ на комментарий №8)
&gt; В исходниках util-linux лежит fstrim.service и fstrim.timer
&gt; А проверять надо делать или нет оно умеет само (fstrim -a)

(В ответ на комментарий №10)
&gt; Эту функцию нужно включить во все собираемые дистрибутивы, включая стартеркиты.

Посмотрел в федорином спеке -- там %{_unitdir}/fstrim.* прямо в основной пакет util-linux и кладут.  Может, так и сделать? (с legion@ обсудили подпакет, он не против -- я пошёл смотреть, заметил такое)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159687</commentid>
    <comment_count>14</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-11-02 15:23:32 +0300</bug_when>
    <thetext>(In reply to comment #13)
&gt; (В ответ на комментарий №8)
&gt; &gt; В исходниках util-linux лежит fstrim.service и fstrim.timer
&gt; &gt; А проверять надо делать или нет оно умеет само (fstrim -a)
&gt; 
&gt; (В ответ на комментарий №10)
&gt; &gt; Эту функцию нужно включить во все собираемые дистрибутивы, включая стартеркиты.
&gt; 
&gt; Посмотрел в федорином спеке -- там %{_unitdir}/fstrim.* прямо в основной пакет
&gt; util-linux и кладут.  Может, так и сделать? (с legion@ обсудили подпакет, он не
&gt; против -- я пошёл смотреть, заметил такое)

+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159689</commentid>
    <comment_count>15</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-11-02 15:34:23 +0300</bug_when>
    <thetext>(In reply to comment #14)
&gt; (In reply to comment #13)
&gt; &gt; (В ответ на комментарий №8)
&gt; &gt; &gt; В исходниках util-linux лежит fstrim.service и fstrim.timer
&gt; &gt; &gt; А проверять надо делать или нет оно умеет само (fstrim -a)
&gt; &gt; 
&gt; &gt; (В ответ на комментарий №10)
&gt; &gt; &gt; Эту функцию нужно включить во все собираемые дистрибутивы, включая стартеркиты.
&gt; &gt; 
&gt; &gt; Посмотрел в федорином спеке -- там %{_unitdir}/fstrim.* прямо в основной пакет
&gt; &gt; util-linux и кладут.  Может, так и сделать? (с legion@ обсудили подпакет, он не
&gt; &gt; против -- я пошёл смотреть, заметил такое)
&gt; 
&gt; +1

В смысле -- в основной пакет, как в Fedora</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159690</commentid>
    <comment_count>16</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2016-11-02 15:40:46 +0300</bug_when>
    <thetext>(В ответ на комментарий №8)
&gt; В исходниках util-linux лежит fstrim.service и fstrim.timer
Обсудили ещё с glebfm@ (в т.ч. по взаимодействию с ovz-el) и aen@;
похоже, стоит положить эти файлики туда же, где и бинарник fstrim,
т.е. в основной подпакет util-linux.  Проверяю 2.27.1-alt2.M80P.1...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159695</commentid>
    <comment_count>17</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-11-02 19:09:49 +0300</bug_when>
    <thetext>Так я о чём и писал. Конечно так и сделать.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159698</commentid>
    <comment_count>18</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2016-11-02 21:55:57 +0300</bug_when>
    <thetext>util-linux-2.27.1-alt2.M80P.1 -&gt; p8:

* Wed Nov 02 2016 Michael Shigorin &lt;mike@altlinux&gt; 2.27.1-alt2.M80P.1
- added fstrim service/timer (closes: #32687)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159707</commentid>
    <comment_count>19</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-11-03 09:19:49 +0300</bug_when>
    <thetext>
Факта добавления таймера и сервиса недостаточно - нужно активировать его в дистрибутиве.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159709</commentid>
    <comment_count>20</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2016-11-03 12:49:01 +0300</bug_when>
    <thetext>(В ответ на комментарий №19)
&gt; Факта добавления таймера и сервиса недостаточно - нужно активировать его в
&gt; дистрибутиве.
Да, и мне такое положение вещей кажется разумным.  Достаточно

+       @$(call add,DEFAULT_SERVICES_ENABLE,fstrim.timer)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160164</commentid>
    <comment_count>21</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2016-11-24 13:02:36 +0300</bug_when>
    <thetext>Хорошо бы и в сизифе не забыть сделать.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>160579</commentid>
    <comment_count>22</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2016-12-08 11:16:36 +0300</bug_when>
    <thetext>А можно то-же самое повторить и в Sisyphus ? а то я с удивлением обнаружил что данное изменение было сделано только в p8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>162941</commentid>
    <comment_count>23</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2017-04-03 00:39:39 +0300</bug_when>
    <thetext>util-linux-2.29.2-alt1 -&gt; sisyphus:

* Sun Apr 02 2017 Alexey Gladkov &lt;legion@altlinux&gt; 2.29.2-alt1
- New version (2.29.2).
- Fix `blkid -v` exit code (ALT#29544).
- Add fstrim service/timer (ALT#32687).
- Cleanup logger man-page (ALT#33152).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>