如何提高硬盘写入速度

如何提高硬盘写入速度

Seagate Barracuda 1TB 1000GB 7200RPM 64MB SATA3在 ubuntu 16.04 服务器中有 2 个 HD(Dell Poweredge 400SC)。

当我将文件从一个磁盘复制rsync到另一个磁盘时,我的速度为 25-30 Mb/s。从阅读中可以看出,我应该能够达到这个速度的两倍。

我应该如何优化此设置以提高传输速度?

// lsblk

sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   931G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0   509M  0 part [SWAP]
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0    20G  0 part 
└─sdb2   8:18   0 910.5G  0 part /mnt

我已经阅读了有关启用 DMA 的信息,但看起来我似乎无法在系统上执行此操作。

// hdparm -Tt /dev/sdb

/dev/sdb:
 Timing cached reads:   1098 MB in  2.00 seconds = 548.31 MB/sec
 Timing buffered disk reads: 346 MB in  3.02 seconds = 114.69 MB/sec

尝试启用 DMAsdb会执行以下操作。

// hdparm -d1 /dev/sdb

/dev/sdb:
 setting using_dma to 1 (on)
 HDIO_SET_DMA failed: Inappropriate ioctl for device
 HDIO_GET_DMA failed: Inappropriate ioctl for device

// hdparm -i /dev/sdb

/dev/sdb:

 Model=ST1000DM003-1SB102, FwRev=CC43, SerialNo=Z9A4EEL4
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-4,5,6,7

// 消息队列 |删除 SATA

[    2.074207] ata3: SATA max UDMA/133 cmd 0xfe00 ctl 0xfe10 bmdma 0xfea0 irq 18
[    2.080635] ata4: SATA max UDMA/133 cmd 0xfe20 ctl 0xfe30 bmdma 0xfea8 irq 18

// lscpci

00:00.0 Host bridge: Intel Corporation 82875P/E7210 Memory Controller Hub (rev 02)
00:01.0 PCI bridge: Intel Corporation 82875P Processor to AGP Controller (rev 02)
00:06.0 System peripheral: Intel Corporation 82875P/E7210 Processor to I/O Memory Interface (rev 02)
00:1d.0 USB controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)
00:1d.1 USB controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)
00:1d.2 USB controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #3 (rev 02)
00:1d.3 USB controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4 (rev 02)
00:1d.7 USB controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)
00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)
00:1f.5 Multimedia audio controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller (rev 02)
02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Rage XL PCI (rev 27)
02:0c.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)

// SATA 版本

// smartctl -a /dev/sdb | grep SATA
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)

答案1

我想这个问题可能会引来许多不同的答案。

我想到的一个技巧是通过禁用 来节省一些写入atime。它是上次访问文件的时间,默认情况下通常设置为relatime,这在性能方面比 更好atime。但是,您可以通过noatime选项完全禁用它来进一步改进它。例如:

$ grep noatime /etc/fstab                  
UUID=9b5e4b95-46b1-4f54-aa07-9de91e01cbf2 /             ext4            rw,noatime,data=ordered 0 0

相关内容