# Slow USB flash drive boot



## ScopeDog (Feb 5, 2013)

Hi.

I tried to figure out why this happens, but couldn't resolve by myself.
I partitioned a USB flash drive with gpart like


```
=>      34  15240509  da0  GPT  (7.3G)
        34       128    1  freebsd-boot  (64k)
       162  14475136    2  freebsd-ufs  (6.9G) -- newfs -U'ed
  14475298    761856    3  freebsd-swap  (372M)
  15237154      3389       - free -  (1.7M)
```

and installed (restore -rf) root.dump which I made (dump -0af) on a regular PC running with FreeBSD 9.1R.
This is for making a USB flash drive that transforms a normal PC into a FreeBSD server running my applications. (My friends who are not familiar with FreeBSD are going to use it.)

OK, the 'restore' took 13 hours for 3GB root.dump but finished well, and the flash drive boots normally.
However, the booting is very slow. Bootstrap loading is slow and even after login, the file access is very slow.
Syncing the disk also takes long time at shutdown (for example, 39 39 39 39 39 38 38 38 38.......)

Interestingly, when I installed FreeBSD-9.1-RELEASE-amd64-memstick.img to the same flash drive, the booting was much faster and had no issue with shutdown.

Probably, I need specify more options for USB, but what's the difference between the memstick.img and the USB FreeBSD installed like the above way?

Thank you very much for your cooperation.


----------



## kpa (Feb 6, 2013)

Most likely the difference was UFS soft updates. Use the -U flag with newfs(8) when creating the filesystem. Soft updates can be turned on afterward on an unmounted filesystem with tunefs(8).

Slow boot with USB memory sticks is more a "feature", loading of the boot loader binaries and the kernel files is done with the age old BIOS calls and they are often very slow with USB memory sticks.


----------



## ScopeDog (Feb 6, 2013)

Thank you for response.

I'm sorry but I used newfs -U.

> Slow boot with USB memory sticks is more a "feature", loading of the boot loader binaries and the kernel files is done with the age old BIOS calls and they are often very slow with USB memory sticks. 

But it doesn't explain why memstick.img is faster than mine.
As for syncing disks at shutdown and the file access, I noticed that memstick.img uses md or mfs, so it is natural that they are faster with memstick.img.
However, I don't understand why kernel load with memstick.img is faster.


----------

