如何优化 Linux 上的 NTFS 性能?

如何优化 Linux 上的 NTFS 性能?

我在具有以下规格的笔记本电脑上运行 Ubuntu 22.04.2:

固态硬盘:惠普 S700 固态硬盘
中央处理器:英特尔酷睿 i7 7700HQ
内存:16 GB
核心:5.19.0-32-通用

截至 2023 年 2 月 25 日,所有系统软件包均已更新至最新版本。 Ubuntu安装在Ext4分区上,而我的数据存储在NTFS分区上,因为它是在使用Windows 10时创建的。SSD被识别为/dev/sdb

SSD及分区详细信息:
输出hdparm -I /dev/sdb

/dev/sdb:

ATA device, with non-removable media
    Model Number:       HP SSD S700 1TB                         
    Serial Number:      HASA42470101207     
    Firmware Revision:  V0823A0 
    Media Serial Num:   
    Media Manufacturer: 
    Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
    Used: unknown (minor revision code 0x011b) 
    Supported: 10 9 8 7 6 5 
    Likely used: 10
Configuration:
    Logical     max current
    cylinders   16383   16383
    heads       16  16
    sectors/track   63  63
    --
    CHS current addressable sectors:    16514064
    LBA    user addressable sectors:   268435455
    LBA48  user addressable sectors:  1953525168
    Logical  Sector size:                   512 bytes
    Physical Sector size:                   512 bytes
    Logical Sector-0 offset:                  0 bytes
    device size with M = 1024*1024:      953869 MBytes
    device size with M = 1000*1000:     1000204 MBytes (1000 GB)
    cache/buffer size  = unknown
    Form Factor: 2.5 inch
    Nominal Media Rotation Rate: Solid State Device
Capabilities:
    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 1   Current = 1
    Advanced power management level: 254
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4 
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled Supported:
       *    SMART feature set
            Security Mode feature set
       *    Power Management feature set
       *    Write cache
       *    Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    NOP cmd
       *    DOWNLOAD_MICROCODE
       *    Advanced Power Management feature set
       *    48-bit Address feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    {READ,WRITE}_DMA_EXT_GPL commands
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Gen3 signaling speed (6.0Gb/s)
       *    Native Command Queueing (NCQ)
       *    Phy event counters
       *    READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
       *    DMA Setup Auto-Activate optimization
       *    Software settings preservation
       *    SMART Command Transport (SCT) feature set
       *    SANITIZE feature set
       *    BLOCK_ERASE_EXT command
       *    DOWNLOAD MICROCODE DMA command
       *    WRITE BUFFER DMA command
       *    READ BUFFER DMA command
       *    Data Set Management TRIM supported (limit 8 blocks)
Security: 
    Master password revision code = 65534
        supported
    not enabled
    not locked
        frozen
    not expired: security count
        supported: enhanced erase
    6min for SECURITY ERASE UNIT. 6min for ENHANCED SECURITY ERASE UNIT.
Checksum: correct

输出df -aTh

Filesystem     Type             Size  Used Avail Use% Mounted on
/dev/sdb2      ext4             162G   64G   90G  42% /
/dev/sdb1      fuseblk          760G  383G  378G  51% /mnt/DATA Laptop

输出findmnt --fstab

TARGET           SOURCE                                    FSTYPE OPTIONS
/                UUID=79debb50-d530-d801-70da-b150d530d801 ext4   errors=remount-ro
/mnt/DATA Laptop UUID=01D94304BCDF47E0                     ntfs   uid=1000,gid=1000,rw,user,exec,umask=000,x-gvfs-show

NTFS和Ext4分区的性能差异:
当我使用以下命令运行基准测试时K磁盘标记在这两个分区上,我注意到 NTFS 和 Ext4 分区之间的性能存在显着差异,尤其是随机读写。

输出/dev/sdb2

                        KDiskMark (3.1.2): https://github.com/JonMagon/KDiskMark
                    Flexible I/O Tester (fio-3.28): https://github.com/axboe/fio
--------------------------------------------------------------------------------
* MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s]
* KB = 1000 bytes, KiB = 1024 bytes

[Read]
Sequential   1 MiB (Q=  8, T= 1):   517.054 MB/s [    504.9 IOPS] < 15813.82 us>
Sequential   1 MiB (Q=  1, T= 1):   500.349 MB/s [    488.6 IOPS] <  2044.34 us>
    Random   4 KiB (Q= 32, T= 1):   168.011 MB/s [  42002.8 IOPS] <   760.80 us>
    Random   4 KiB (Q=  1, T= 1):    28.314 MB/s [   7078.7 IOPS] <   139.87 us>

[Write]
Sequential   1 MiB (Q=  8, T= 1):   356.269 MB/s [    347.9 IOPS] < 24887.09 us>
Sequential   1 MiB (Q=  1, T= 1):   334.044 MB/s [    326.2 IOPS] <  2978.64 us>
    Random   4 KiB (Q= 32, T= 1):   184.879 MB/s [  46219.8 IOPS] <   665.75 us>
    Random   4 KiB (Q=  1, T= 1):    84.579 MB/s [  21144.9 IOPS] <    46.37 us>

Profile: Default
   Test: 1 GiB (x5) [Measure: 5 sec / Interval: 5 sec]
   Date: 2023-02-25 14:18:20
     OS: ubuntu 22.04 [linux 5.19.0-32-generic]

输出/dev/sdb1

                        KDiskMark (3.1.2): https://github.com/JonMagon/KDiskMark
                    Flexible I/O Tester (fio-3.28): https://github.com/axboe/fio
--------------------------------------------------------------------------------
* MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s]
* KB = 1000 bytes, KiB = 1024 bytes

[Read]
Sequential   1 MiB (Q=  8, T= 1):   484.235 MB/s [    472.9 IOPS] < 16879.14 us>
Sequential   1 MiB (Q=  1, T= 1):   494.241 MB/s [    482.7 IOPS] <  2068.27 us>
    Random   4 KiB (Q= 32, T= 1):    24.336 MB/s [   6084.1 IOPS] <  5255.13 us>
    Random   4 KiB (Q=  1, T= 1):    24.453 MB/s [   6113.4 IOPS] <   162.18 us>

[Write]
Sequential   1 MiB (Q=  8, T= 1):   313.461 MB/s [    306.1 IOPS] <  8380.51 us>
Sequential   1 MiB (Q=  1, T= 1):   313.816 MB/s [    306.5 IOPS] <   879.35 us>
    Random   4 KiB (Q= 32, T= 1):    78.391 MB/s [  19597.8 IOPS] <  1237.62 us>
    Random   4 KiB (Q=  1, T= 1):    77.982 MB/s [  19495.5 IOPS] <    37.17 us>

Profile: Default
   Test: 1 GiB (x5) [Measure: 5 sec / Interval: 5 sec]
   Date: 2023-02-25 14:14:16
     OS: ubuntu 22.04 [linux 5.19.0-32-generic]

鉴于 NTFS 分区被 识别为fuseblk系统df,我假设该分区是使用ntfs-3g而不是 挂载的ntfs3,这是新的内核驱动程序。将按照所述将我的 fstab FSTYPE 更改为 ntfs3这里提高性能?我还可以采取其他措施来提高 Linux 上的 NTFS 性能吗?如果没有,是否有任何方法可以非破坏性地将 NTFS 分区转换为 Ext4?

预先感谢您的帮助,祝您有美好的一天。

更新:
将 FSTYPE 设置为ntfs3in/etc/fstab确实确实提高了很多性能。

KDiskMark的输出/dev/sdb1

                        KDiskMark (3.1.2): https://github.com/JonMagon/KDiskMark
                    Flexible I/O Tester (fio-3.28): https://github.com/axboe/fio
--------------------------------------------------------------------------------
* MB/s = 1,000,000 bytes/s [SATA/600 = 600,000,000 bytes/s]
* KB = 1000 bytes, KiB = 1024 bytes

[Read]
Sequential   1 MiB (Q=  8, T= 1):   525.712 MB/s [    513.4 IOPS] < 15556.55 us>
Sequential   1 MiB (Q=  1, T= 1):   428.302 MB/s [    418.3 IOPS] <  2387.84 us>
    Random   4 KiB (Q= 32, T= 1):   237.324 MB/s [  59331.2 IOPS] <   538.66 us>
    Random   4 KiB (Q=  1, T= 1):    43.243 MB/s [  10810.8 IOPS] <    92.45 us>

[Write]
Sequential   1 MiB (Q=  8, T= 1):   495.466 MB/s [    483.9 IOPS] < 16344.70 us>
Sequential   1 MiB (Q=  1, T= 1):   372.929 MB/s [    364.2 IOPS] <  2591.59 us>
    Random   4 KiB (Q= 32, T= 1):   299.469 MB/s [  74867.4 IOPS] <   425.59 us>
    Random   4 KiB (Q=  1, T= 1):   135.961 MB/s [  33990.3 IOPS] <    27.96 us>

Profile: Default
   Test: 1 GiB (x5) [Measure: 5 sec / Interval: 5 sec]
   Date: 2023-02-25 15:45:46
     OS: ubuntu 22.04 [linux 5.19.0-32-generic]

但是,如果我将挂载选项更改为 ntfs3,我将无法在依赖 Proton 的分区上玩任何 Steam 游戏。我只能在使用 ntfs-3g 的 ntfs 挂载选项时运行这些游戏。

更新2:
我找到了一种将 ntfs3 与 proton 一起使用的解决方法,因此我将将该标志保留在/etc/fstab.欢迎提出有关 NTFS 性能改进或从 NTFS 文件系统转换的任何其他建议,这些建议既非破坏性又与 Windows 10 和 Linux 兼容。

答案1

正如您的帖子所示,使用了旧的 SATA SSD。对于我在 Ubuntu 23.04 上使用带有 M.2 插槽的 NVME SSD 的情况,使用ntfs3不会提高性能。

我使用auto文件系统类型获得了超过 2000 MB/s,使用ntfs3.使用 KDiskMark 的 GUI 版本。

我的驱动器的速度约为 7000 MB/s ext4。两个 SSD 驱动器都直接插入主板。

在此输入图像描述

在此输入图像描述

相关内容