<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>F2FS on KnightLi Blog</title>
        <link>https://www.knightli.com/en/tags/f2fs/</link>
        <description>Recent content in F2FS on KnightLi Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Fri, 08 May 2026 22:34:39 +0800</lastBuildDate><atom:link href="https://www.knightli.com/en/tags/f2fs/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Does F2FS Freeze an HC620 SMR Drive? Linux SMR Disk Troubleshooting Guide</title>
        <link>https://www.knightli.com/en/2026/05/08/hc620-smr-f2fs-io-wait-freeze/</link>
        <pubDate>Fri, 08 May 2026 22:34:39 +0800</pubDate>
        
        <guid>https://www.knightli.com/en/2026/05/08/hc620-smr-f2fs-io-wait-freeze/</guid>
        <description>&lt;p&gt;When an HC620 helium-filled SMR drive is used with F2FS, symptoms such as system freezes, unresponsive applications, and sustained high &lt;code&gt;iowait&lt;/code&gt; are usually not caused by one bad option. They are the result of device behavior colliding with filesystem policy.&lt;/p&gt;
&lt;p&gt;Western Digital Ultrastar DC HC620 is a Host-managed SMR drive. It is better suited to sequential writes, zoned-aware workloads, and software stacks that understand the device constraints. F2FS is a log-structured filesystem designed for flash storage. Although it can turn many random writes into sequential writes, heavy garbage collection, metadata updates, or low free space can still push a mechanical SMR drive into long internal maintenance cycles.&lt;/p&gt;
&lt;h2 id=&#34;confirm-the-problem-first&#34;&gt;Confirm the problem first
&lt;/h2&gt;&lt;p&gt;Start with these checks:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;iostat -x &lt;span class=&#34;m&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;iotop -oPa
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;dmesg -T &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; grep -Ei &lt;span class=&#34;s2&#34;&gt;&amp;#34;f2fs|blk|zoned|reset|timeout|I/O error&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If disk &lt;code&gt;%util&lt;/code&gt; stays close to 100%, &lt;code&gt;await&lt;/code&gt; is high, and many processes are stuck in &lt;code&gt;D&lt;/code&gt; state, the bottleneck is probably block I/O.&lt;/p&gt;
&lt;p&gt;Then check whether the drive is exposed as a zoned device:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;lsblk -o NAME,MODEL,SIZE,ROTA,ZONED,SCHED,MOUNTPOINTS
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cat /sys/block/sdX/queue/zoned
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;If it is Host-managed SMR, ordinary filesystems and random-write workloads may perform poorly. Unlike consumer drive-managed SMR disks, this class depends more on host software understanding the write rules.&lt;/p&gt;
&lt;h2 id=&#34;why-f2fs-can-amplify-the-stall&#34;&gt;Why F2FS can amplify the stall
&lt;/h2&gt;&lt;p&gt;SMR cannot overwrite arbitrary locations as freely as CMR disks. Shingled tracks overlap to increase capacity. When writes become random, overwrites are frequent, or cache is exhausted, the drive must perform additional data movement and cleanup.&lt;/p&gt;
&lt;p&gt;F2FS was built for NAND flash. It uses log-structured writes and reclaims space through segment cleaning and garbage collection. On SSDs this is natural because there is no mechanical seek. On mechanical disks, especially SMR disks, GC-related reads and writes can turn into severe tail latency.&lt;/p&gt;
&lt;p&gt;When F2FS background GC, foreground writes, checkpoints, metadata updates, and the drive&amp;rsquo;s own SMR cleanup overlap, the I/O queue can stay saturated for a long time. From user space, copying files, deleting directories, downloading, extracting archives, or database writes may make the whole system feel frozen.&lt;/p&gt;
&lt;h2 id=&#34;start-with-conservative-mount-options&#34;&gt;Start with conservative mount options
&lt;/h2&gt;&lt;p&gt;If you cannot migrate immediately, first adjust &lt;code&gt;/etc/fstab&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;UUID=xxxx  /data  f2fs  defaults,nodiscard,active_logs=2,gc_merge,flush_merge,lazytime  0  0
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;What these options do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nodiscard&lt;/code&gt;: disables real-time discard. Mechanical disks usually do not need frequent TRIM/discard behavior like SSDs.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;active_logs=2&lt;/code&gt;: F2FS supports 2, 4, or 6 active logs, and the default is commonly 6. Reducing it to 2 can reduce seek pressure from concurrent logs.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gc_merge&lt;/code&gt;: lets the background GC thread handle some foreground GC requests, reducing stalls when a process triggers slow GC.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;flush_merge&lt;/code&gt;: merges cache flush requests, which can help when the device handles flush slowly.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;lazytime&lt;/code&gt;: reduces metadata writes caused by some access time updates.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Do not treat &lt;code&gt;checkpoint=disable&lt;/code&gt; as a normal tuning switch. It may reduce checkpoint pressure, but it increases risk after crashes or power loss. Kernel documentation also notes that the filesystem still needs GC while checkpoint is disabled to ensure usable space. Unless you understand the tradeoff clearly, do not use it as a long-term performance fix.&lt;/p&gt;
&lt;h2 id=&#34;tune-the-io-scheduler&#34;&gt;Tune the I/O scheduler
&lt;/h2&gt;&lt;p&gt;Mechanical disks and SMR disks often benefit from request merging and latency control. Check the current scheduler:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cat /sys/block/sdX/queue/scheduler
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Try switching to &lt;code&gt;mq-deadline&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; mq-deadline &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; sudo tee /sys/block/sdX/queue/scheduler
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;For desktop interaction, &lt;code&gt;bfq&lt;/code&gt; is also worth testing. Do not look only at sequential throughput. Watch whether freezes are reduced, &lt;code&gt;await&lt;/code&gt; drops, and the system feels more responsive.&lt;/p&gt;
&lt;h2 id=&#34;limit-f2fs-background-gc&#34;&gt;Limit F2FS background GC
&lt;/h2&gt;&lt;p&gt;The F2FS sysfs path depends on the actual device name. Check it first:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ls /sys/fs/f2fs/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Then adjust the GC interval for the matching device:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;m&#34;&gt;60000&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; sudo tee /sys/fs/f2fs/sdX/gc_min_sleep_time
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;m&#34;&gt;120000&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; sudo tee /sys/fs/f2fs/sdX/gc_max_sleep_time
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Here &lt;code&gt;sdX&lt;/code&gt; is only an example. The actual name may be &lt;code&gt;sda1&lt;/code&gt;, &lt;code&gt;dm-0&lt;/code&gt;, or something else. Increasing GC sleep time reduces how often background GC competes for I/O, but space reclaim becomes slower. If the disk is nearly full, foreground GC may still be triggered, so keep enough free space.&lt;/p&gt;
&lt;h2 id=&#34;better-long-term-options&#34;&gt;Better long-term options
&lt;/h2&gt;&lt;p&gt;If the drive stores important data, the safest long-term answer is to back up and change the filesystem, or use a more suitable drive.&lt;/p&gt;
&lt;p&gt;For large mechanical disks, consider:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;XFS: good for large files, backup drives, media libraries, archives, and sequential-write workloads.&lt;/li&gt;
&lt;li&gt;EXT4: stable behavior, broad compatibility, and abundant troubleshooting material.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the drive is Host-managed SMR, also confirm that your kernel, controller, filesystem, and application stack truly support zoned block devices. Otherwise, using it like a normal random-write disk can lead to unpredictable long stalls.&lt;/p&gt;
&lt;h2 id=&#34;practical-advice&#34;&gt;Practical advice
&lt;/h2&gt;&lt;p&gt;This class of disk is better suited to cold data, archives, backups, media files, and sequential writes. It is a poor fit for download caches, container images, VM disks, databases, frequent archive extraction, and small-file random writes.&lt;/p&gt;
&lt;p&gt;If you must keep using F2FS, at least do this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Disable real-time discard.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;active_logs=2&lt;/code&gt; to reduce concurrent logs.&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;gc_merge&lt;/code&gt; and &lt;code&gt;flush_merge&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Keep plenty of free space.&lt;/li&gt;
&lt;li&gt;Avoid placing downloads, databases, and VM images on this disk.&lt;/li&gt;
&lt;li&gt;Watch &lt;code&gt;iostat -x 1&lt;/code&gt;, not just average speed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In short, HC620 + F2FS freezes are the result of SMR write constraints, F2FS GC, and mechanical disk tail latency stacking together. Short-term mitigation is mount-option tuning, scheduler tuning, and background GC limits. The long-term fix is to migrate to XFS/EXT4, or use the SMR drive only for workloads it actually suits.&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://docs.kernel.org/filesystems/f2fs.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Linux Kernel Documentation: F2FS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://documents.westerndigital.com/content/dam/doc-library/en_us/assets/public/western-digital/product/data-center-drives/ultrastar-dc-hc600-series/data-sheet-ultrastar-dc-hc620.pdf&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Western Digital Ultrastar DC HC620 Data Sheet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        
    </channel>
</rss>
