Posts: 1,308
BitJam
Joined: 31 Aug 2009
#1
I wanted to see how long mkfs takes to run on a 2 Gig file on a usb stick. I'm using an 8 Gig Color Turn stick using usb-2.0. I first ran:

Code: Select all

sudo dd if=/dev/zero of=rootfs bs=1M count=0 seek=2048 
which was nearly instant. Then I ran:

Code: Select all

time sudo mkfs.$TYPE -F rootfs
where $TYPE was ext2, ext3, and ext4.

Here are the results:

Code: Select all

 ext2  18 seconds
 ext3  62 seconds
 ext4  21 seconds
So even with usb-2.0, it does take a long time, especially for ext3 which is 3 times slower than the other two. I tried the test several times to make sure that wasn't a fluke.

When we make rootfs and homefs files at boot-time in the Live system, I will follow skidoo's suggestion and warn people it could take a long time. I can also display the mkfs output:

Code: Select all

mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 
but it is all very fast except the very last step. I don't know how to make a meaningful progress indicator. I could launch a process in the background that prints a dot every second and then kill it when mkfs is done.

Another thing to check is the partition alignment. If you do an"sudo fdisk -l /dev/sdX" where X is the letter for your usb stick then you want the first entry to start at 2048. If it starts at 63, this could be making your stick much slower.

BAD:

Code: Select all

/dev/sda1   *          63      433754      216846   83  Linux
GOOD:

Code: Select all

/dev/sde1   *        2048    15265791     7631872   83  Linux
The newer versions of the partitioning tools do this automatically now. We used to have to jump through a few hoops to get it aligned.
Posts: 1,028
SamK
Joined: 21 Aug 2011
#2
I have been of the opinion for quite a while that the progress meters will be welcome . You might recall I mentioned it to you approx 10(ish) months back albeit in relation to the check for bad blocks from the installation ISO.
post30361.html?hilit=progress#p30361

bitjam wrote:I can also display the mkfs output:
I strongly favour a meter in preferernce to the type of report mentioned.

I offer a totally unsubstantiated guess that an overwhelming majority of antiX users conduct partitioning and file system creation using a GUI tool such as GParted. This provides feedback/progress using far less technical terminology than the equivalent console app.

I am not suggesting that GParted is used, rather that we learn from its presentation and employ a feedback mechanism that is immediately understandable to the majority of antiX users.

Providing report output in the form you mention is far from understandable to everyone that does not have a technical background. It will be off-putting for large numbers of users. At a very early juncture, it will convey the impression that antiX is for the technically inclined.

Technically competent users have a better chance of understanding such a report and might even conduct the steps manually. Neither is possible for unskilled users. The improvements are presumably intended to make antiX more appealing by automating and refining the process. To do this it needs to be aimed towards those with fewer skills.

Might it be possible to cater for both skilled and unskilled users? For example, make the process default to some form of highly simplfied progress meter, but also include a switch by which the report can be displayed if wanted.


Although not related directly to the main topic the following is partially relevant
bitjam wrote:...first entry to start at 2048.
I agree that performance can be improved by ensuring the partition alignment on a USB stick starts at 2048. After lots of testing I now routinely use the following as it produces noticeable improvements in performance when tested and I tend not use a flash drive as the primary and only storage space.

Format the partition with a large blocksize, no journaling

Code: Select all

mkfs.ext4 -b 4096 -E stride=128,stripe-width=128 -m 0 -O ^has_journal -L USB-WHITE /dev/sdbX
Check the write speed of the device

Code: Select all

dd count=10 bs=1M if=/dev/zero of=/media/USB-WHITE/test oflag=nocache conv=notrunc,fsync
I make no claim to have found a universal panacea, just something that helps.
Posts: 1,308
BitJam
Joined: 31 Aug 2009
#3
Thanks Sam! Meters it will be.