Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Testing USB pen drive with poor write speeds

  1. #1
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    246
    Distro
    Ubuntu 20.04 Focal Fossa

    Testing USB pen drive with poor write speeds

    Hello all,

    So i have this SanDisk Ultra Trek 64GB pen drive (USB 3.1) and I'm thinking of getting another but first I'm testing the write speed as many reviews I read before I bought it said that the write speed degrades massively over a relatively short period. I've already tested it once using the 'dd' utility, and the results were pretty poor, so I wanted to check the method I used was good. The method in question is basically what is found on linuxconfig.com


    1. First I used 'fdisk' to remove all partitions and created a single 'Linux' partition (not sure what Linux means in this context but it seemed the obvious choice)
    2. ran 'sudo mkfs -t ext4 /dev/sda1'
    3. ran 'sudo dd if=/dev/zero of=/dev/sda1 oflag=direct bs=128k count =32k


    below is a copy of dd's output...
    Code:
    32768+0 records in
    32768+0 records out
    4294967296 bytes (4.3 GB, 4.0 GiB) copied, 527.162 s, 8.1 MB/s
    ...I know there are many variables here and SanDisk probably didn't specify the write speed in the context of Linux, but they claim read speeds up to 130MB/s with write speeds "lower", significantly lower by the looks of my 8.1MB/s. It is in a blue USB type A port which I believe denotes the USB 3.1 standard?

    For reference I have the most awful USB pen drive on earth that came as part of one of those promotional pens that companies hand out with their branding on, it doesn't even look like an electronic device and is easily ten years old, and after undergoing the same procedure plugged into the same port it was getting write speeds of 11MB/s plus.

    The only steps I omitted that the guide recommends were to run the 'sync' command and also to run 'echo 3 > /proc/sys/vm/drop_caches'. I didn't use the former because I believe the 'dd' option 'oflag=direct' means caching isn't used, and the latter because I don't know what it does (also I cant use 'cat' to view the contents of that pseudo file, even with sudo, so I left it be).

    Any critique is welcome!

    Edit: From SanDisks Website -

    "Most of the SanDisk USB flash drives fall under the entry level category unless otherwise labeled as Ultra or Extreme. Entry level USB drives do NOT have any defined transfer speed. The Ultra and Extreme USB flash drives transfer speed MAY vary from 10MB/s to 260MB/s depending on the specific product."

    So, maybe it's normal? I'm still unsure...
    Last edited by jcdenton1995; October 23rd, 2020 at 02:28 PM.

  2. #2
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Testing USB pen drive with poor write speeds

    I recommend to use sync for all these tests (if run via a shell). If the process itself includes flushing the buffers, the sync command will finish at once, and, when you use it, there will be no doubt (and of course, avoid other write operations during the test).

    A simple, yet fairly good write speed test is bundled in Disks alias gnome-disks. This works completely in a graphical user interface, and needs no sync command.

    See this link.



    If you want a dd command line, I would recommend status=progress oflag=dsync

    See this link that is also mentioning the shellscript watch-flush (which is part of mkusb).



    You can wipe the whole drive (overwrite with zeros) with mkusb. This will restore the write speed of a well used (and tired) USB pendrive or memory card to almost the original speed. But don't do it too often because of the wear of memory cells.
    Last edited by sudodus; October 23rd, 2020 at 04:17 PM.

  3. #3
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    246
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Testing USB pen drive with poor write speeds

    Thanks, this is really helpful. Especially being able to use mkusb to completely wipe a drive, as I did use Disks to do this after I (believe) I messed up the memory stick, although I'm not sure exactly what I did wrong. Also the 'status=progress' option is a little buggy for me for some reason.

    Am I right in thinking that a good all round method of formatting a drive to work within Linux is to use fdisk to remove the existing partitions (if any) before creating a new GPT partition table and then populating it with one or more new partitions of the type 'Linux partition' (I don't understand what this is because it doesn't seem to refer to the partitioning scheme or the filesystem type?) before using mkfs to format the new partition as ext4?

    Sorry if that's a bit wild, I only partially understand the whole shebang.

  4. #4
    Join Date
    May 2008
    Beans
    3,947
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Testing USB pen drive with poor write speeds

    Quote Originally Posted by jcdenton1995 View Post
    Am I right in thinking that a good all round method of formatting a drive to work within Linux is to use fdisk to remove the existing partitions (if any) before creating a new GPT partition table and then populating it with one or more new partitions of the type 'Linux partition'
    To create partition tables and partitions, it is easier to use gparted from the repositories.

    https://gparted.org/

  5. #5
    GhX6GZMB is offline Iced Almond Soy Ubuntu, No Foam
    Join Date
    Jun 2019
    Beans
    1,093

    Re: Testing USB pen drive with poor write speeds

    You won't find any USB-Flash stick with high write speeds. It's in the technology.
    The memory core is NAND-Flash and has certain write times (measured in ms, not ns). That's just the way it is. Semiconductor physics.
    Read times are a completely different story. Reads are fast, and with block/sector buffering even faster.
    Last edited by GhX6GZMB; October 23rd, 2020 at 11:26 PM.

  6. #6
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Testing USB pen drive with poor write speeds

    Quote Originally Posted by jcdenton1995 View Post
    Am I right in thinking that a good all round method of formatting a drive to work within Linux is to use fdisk to remove the existing partitions (if any) before creating a new GPT partition table and then populating it with one or more new partitions of the type 'Linux partition' (I don't understand what this is because it doesn't seem to refer to the partitioning scheme or the filesystem type?) before using mkfs to format the new partition as ext4?

    Sorry if that's a bit wild, I only partially understand the whole shebang.
    You can use fdisk like that, but I think it is straightforward to remove the whole partition table by wiping the first mibibyte (easy with mkusb). After that most partitioning tools will work (but if the drive is excessively slow it will usually help to wipe the whole device).

    I agree with the @ tea for one that gparted is a good tool for partitioning. It is available by default in live Ubuntu, and you can install it in installed Ubuntu.

    Code:
    sudo apt update
    sudo apt install gparted

  7. #7
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    246
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Testing USB pen drive with poor write speeds

    Quote Originally Posted by tea for one View Post
    To create partition tables and partitions, it is easier to use gparted from the repositories.
    Thanks, I totally agree, but I always try to learn how to use the most basic command line utilities so I know I will be able to use them over multiple distros and potentially in scripts, if I get that far.

    Quote Originally Posted by ml9104 View Post
    You won't find any USB-Flash stick with high write speeds. It's in the technology.
    The memory core is NAND-Flash and has certain write times (measured in ms, not ns). That's just the way it is. Semiconductor physics.
    Read times are a completely different story. Reads are fast, and with block/sector buffering even faster.
    Yes, it looks like I underestimated the extent to which manufacturers will go to advertise a product. I mean don't get me wrong it's an inexpensive memory stick and I'd happily buy another, but when they claim read speeds up to 130 MB/s but with slower write speeds, I just didn't expect more than 10 times slower I guess...

    Quote Originally Posted by sudodus View Post
    You can use fdisk like that, but I think it is straightforward to remove the whole partition table by wiping the first mibibyte (easy with mkusb). After that most partitioning tools will work (but if the drive is excessively slow it will usually help to wipe the whole device).
    Thanks, out of interest is this because the first mebibyte will contain all the metadata like the partition table etc. with the actual partitions and their data normally starting at the first mebibyte boundary (I've just been reading about partition / sector alignment and I feel like this is related?)

  8. #8
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Testing USB pen drive with poor write speeds

    The partition table as well as the boot structure of grub (for BIOS mode alias CSM alias legacy mode) are all within the first mibibyte, so wiping it will remove many causes of confusion for the partitioning tool, that you want to use later on.

    fdisk is one of the the text mode tools, parted another one and gdisk a third one (gdisk is dedicated to gpt). There is also sfdisk, a script-oriented flavour of fdisk if you wish.



    This link shows some aspects of USB drive speed and some links to test results
    Last edited by sudodus; October 24th, 2020 at 05:25 PM.

  9. #9
    Join Date
    Sep 2011
    Location
    Pennsylvania, U.S.A.
    Beans
    3,068
    Distro
    Ubuntu Development Release

    Re: Testing USB pen drive with poor write speeds

    Quote Originally Posted by tea for one View Post
    To create partition tables and partitions, it is easier to use gparted from the repositories.

    https://gparted.org/
    Gparted is very good.

  10. #10
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    246
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Testing USB pen drive with poor write speeds

    I see, thanks for all your help, as well as the links, (and to everyone else too!).

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •