The dd command is readily available in almost all distributions out of the box and is pretty easy to use.
dd is used to write or read from any block device in Linux. And you can do a lot of stuff with this command.
With the dd command we will only be testing sequential read and sequential write.
–
dd if=/dev/zero of=speedtest bs=1M count=100
result:
100+0 records in 100+0 records out 104857600 bytes (105 MB, 100 MiB) copied, 0.0963094 s, 1.1 GB/s
The speed that dd reported to us is the speed with which data was cached to RAM memory, not to the disk.
To have the dd command report the speed only after the data is synced with the disk, issue the command:
dd if=/dev/zero of=speedtest bs=1M count=100 conv=fdatasync
result:
100+0 records in 100+0 records out 104857600 bytes (105 MB, 100 MiB) copied, 0.107805 s, 973 MB/s
Test with a larger amount. This should be roughly 200MB.
dd if=/dev/zero of=speedtest bs=64k count=3200 conv=fdatasync
result:
3200+0 records in 3200+0 records out 209715200 bytes (210 MB, 200 MiB) copied, 0.19644 s, 1.1 GB/s
NOTE: If you do not specify the block size, the default block size is used when running programs such as mke2fs. You can verify the default size with the following commands.
tune2fs -l /dev/sda1
result:
tune2fs -l /dev/sda1 tune2fs 1.42.13 (17-May-2015) Filesystem volume name: <none> Last mounted on: /boot Filesystem UUID: 820755d6-52d8-49ae-a297-83c55c4ed956 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 122160 Block count: 488192 Reserved block count: 24409 Free blocks: 415203 Free inodes: 121838 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 119 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8144 Inode blocks per group: 509 Flex block group size: 16 Filesystem created: Mon Jul 27 20:36:24 2015 Last mount time: Thu Jun 30 19:47:47 2016 Last write time: Thu Jun 30 19:47:47 2016 Mount count: 31 Maximum mount count: -1 Last checked: Mon Jul 27 20:36:24 2015 Check interval: 0 (<none>) Lifetime writes: 1621 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: 924e9301-4759-4f93-8d17-f0ab4f4a9d46 Journal backup: inode blocks
or
dumpe2fs /dev/sda1
result:
root@server1:~# dumpe2fs /dev/sda1 dumpe2fs 1.42.13 (17-May-2015) Filesystem volume name: <none> Last mounted on: /boot Filesystem UUID: 820755d6-52d8-49ae-a297-83c55c4ed956 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 122160 Block count: 488192 Reserved block count: 24409 Free blocks: 415203 Free inodes: 121838 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 119 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8144 Inode blocks per group: 509 Flex block group size: 16 Filesystem created: Mon Jul 27 20:36:24 2015 Last mount time: Thu Jun 30 19:47:47 2016 Last write time: Thu Jun 30 19:47:47 2016 Mount count: 31 Maximum mount count: -1 Last checked: Mon Jul 27 20:36:24 2015 Check interval: 0 (<none>) Lifetime writes: 1621 MB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: 924e9301-4759-4f93-8d17-f0ab4f4a9d46 Journal backup: inode blocks Journal features: (none) Journal size: 32M Journal length: 8192 Journal sequence: 0x00000c0d Journal start: 1 Group 0: (Blocks 0-32767) [ITABLE_ZEROED] Checksum 0xb7aa, unused inodes 7811 Primary superblock at 0, Group descriptors at 1-1 Reserved GDT blocks at 2-120 Block bitmap at 121 (+121), Inode bitmap at 136 (+136) Inode table at 151-659 (+151) 19106 free blocks, 7823 free inodes, 5 directories, 7811 unused inodes Free blocks: 8095-8101, 9048-9767, 11744-16383, 18098-18925, 18928-22980, 23910-32767 Free inodes: 322-8144 Group 1: (Blocks 32768-65535) [ITABLE_ZEROED] Checksum 0x4b76, unused inodes 8143 Backup superblock at 32768, Group descriptors at 32769-32769 Reserved GDT blocks at 32770-32888 Block bitmap at 122 (bg #0 + 122), Inode bitmap at 137 (bg #0 + 137) Inode table at 660-1168 (bg #0 + 660) 23770 free blocks, 8143 free inodes, 1 directories, 8143 unused inodes Free blocks: 32890-33279, 33281-33815, 34686-34815, 34863-34940, 35244-36351, 36353-37375, 37401-37889, 38831-40959, 41476-41983, 41991-43519, 43540-44543, 44545-53247, 55296-59391, 63488-65535 Free inodes: 8146-16288 Group 2: (Blocks 65536-98303) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0xde2e, unused inodes 8144 Block bitmap at 123 (bg #0 + 123), Inode bitmap at 138 (bg #0 + 138) Inode table at 1169-1677 (bg #0 + 1169) 12403 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 65536-69631, 71648-71679, 75486-75487, 75512-76159, 76206-76287, 76921-77439, 77469-77485, 77532-77823, 79352-79871, 86016-92159, 98253-98303 Free inodes: 16289-24432 Group 3: (Blocks 98304-131071) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0xa86f, unused inodes 8144 Backup superblock at 98304, Group descriptors at 98305-98305 Reserved GDT blocks at 98306-98424 Block bitmap at 124 (bg #0 + 124), Inode bitmap at 139 (bg #0 + 139) Inode table at 1678-2186 (bg #0 + 1678) 13357 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 99671-100365, 106075-108493, 108541-108543, 114688-122879, 129024-131071 Free inodes: 24433-32576 Group 4: (Blocks 131072-163839) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0x9038, unused inodes 8144 Block bitmap at 125 (bg #0 + 125), Inode bitmap at 140 (bg #0 + 140) Inode table at 2187-2695 (bg #0 + 2187) 30770 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 133070-163839 Free inodes: 32577-40720 Group 5: (Blocks 163840-196607) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x59ef, unused inodes 8144 Backup superblock at 163840, Group descriptors at 163841-163841 Reserved GDT blocks at 163842-163960 Block bitmap at 126 (bg #0 + 126), Inode bitmap at 141 (bg #0 + 141) Inode table at 2696-3204 (bg #0 + 2696) 32647 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 163961-196607 Free inodes: 40721-48864 Group 6: (Blocks 196608-229375) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0xadc6, unused inodes 8144 Block bitmap at 127 (bg #0 + 127), Inode bitmap at 142 (bg #0 + 142) Inode table at 3205-3713 (bg #0 + 3205) 24576 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 204800-229375 Free inodes: 48865-57008 Group 7: (Blocks 229376-262143) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x27cd, unused inodes 8144 Backup superblock at 229376, Group descriptors at 229377-229377 Reserved GDT blocks at 229378-229496 Block bitmap at 128 (bg #0 + 128), Inode bitmap at 143 (bg #0 + 143) Inode table at 3714-4222 (bg #0 + 3714) 32647 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 229497-262143 Free inodes: 57009-65152 Group 8: (Blocks 262144-294911) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x5388, unused inodes 8144 Block bitmap at 129 (bg #0 + 129), Inode bitmap at 144 (bg #0 + 144) Inode table at 4223-4731 (bg #0 + 4223) 32768 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 262144-294911 Free inodes: 65153-73296 Group 9: (Blocks 294912-327679) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x1bcb, unused inodes 8144 Backup superblock at 294912, Group descriptors at 294913-294913 Reserved GDT blocks at 294914-295032 Block bitmap at 130 (bg #0 + 130), Inode bitmap at 145 (bg #0 + 145) Inode table at 4732-5240 (bg #0 + 4732) 32647 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 295033-327679 Free inodes: 73297-81440 Group 10: (Blocks 327680-360447) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x78db, unused inodes 8144 Block bitmap at 131 (bg #0 + 131), Inode bitmap at 146 (bg #0 + 146) Inode table at 5241-5749 (bg #0 + 5241) 32768 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 327680-360447 Free inodes: 81441-89584 Group 11: (Blocks 360448-393215) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x38ba, unused inodes 8144 Block bitmap at 132 (bg #0 + 132), Inode bitmap at 147 (bg #0 + 147) Inode table at 5750-6258 (bg #0 + 5750) 32768 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 360448-393215 Free inodes: 89585-97728 Group 12: (Blocks 393216-425983) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x052e, unused inodes 8144 Block bitmap at 133 (bg #0 + 133), Inode bitmap at 148 (bg #0 + 148) Inode table at 6259-6767 (bg #0 + 6259) 32768 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 393216-425983 Free inodes: 97729-105872 Group 13: (Blocks 425984-458751) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED] Checksum 0x1084, unused inodes 8144 Block bitmap at 134 (bg #0 + 134), Inode bitmap at 149 (bg #0 + 149) Inode table at 6768-7276 (bg #0 + 6768) 32768 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 425984-458751 Free inodes: 105873-114016 Group 14: (Blocks 458752-488191) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0x81a8, unused inodes 8144 Block bitmap at 135 (bg #0 + 135), Inode bitmap at 150 (bg #0 + 150) Inode table at 7277-7785 (bg #0 + 7277) 29440 free blocks, 8144 free inodes, 0 directories, 8144 unused inodes Free blocks: 458752-488191 Free inodes: 114017-122160
dd if=speedtest of=/dev/null bs=64k count=24000
result:
3200+0 records in 3200+0 records out 209715200 bytes (210 MB, 200 MiB) copied, 0.0577722 s, 3.6 GB/s