Lubos Rendek

The only solution is determination.

Basic USB Flash Drive Read/write Speed Test

| Comments

Before we begin we first need to mount our USB flash drive. In our example USB flash drive will be mounted into /media/usb0 directory or keep the path relative.

USB flash drive WRITE speed test

Create a file called test.sh with the following content. Change the path to your mounted USB flash drive if necessary:

1
2
dd if=/dev/zero of=/media/usb0/bigfile bs=1048576 count=3000
sync
  • dd command will create a new file of predefined size
  • sync command will ensure that none of the data remain in RAM and thus are written onto USB filesystem

Execute test.sh file as folllows:

1
2
3
4
5
6
7
8
time bash test.sh 
3000+0 records in
3000+0 records out
3145728000 bytes (3.1 GB) copied, 130.404 s, 24.1 MB/s

real    3m36.677s
user    0m0.000s
sys     0m4.092s

From here we can see that 3145728000 bytes took 3m36.677s to write.

USB flash drive READ speed test

Before you do any read test make sure that you clean your RAM otherwise chances are that you will read all or some of the data directly from RAM. To clean your RAM execute as root user:

1
/sbin/sysctl vm.drop_caches=3

Once done start read speed test by:

1
2
cd /media/usb0
time dd if=bigfile of=/dev/null bs=1048576

The time command will output time it took to read your data from your mounted USB drive.

Comments