Describe how to create a NetBSD live flash drive The NetBSD Project
Status: Closed Time to complete: 240 hrs Mentors: blymn, Julian Coleman, Julian Fagir Tags: howto, research, system

Flash drives become increasingly the source for operating system installations.
Though, you might want to try the operating system first by using a live system.
In this task you should create a live USB flash drive from NetBSD. You can use Jibbed or the installation USB flash drive images as an example how to do this.


In the end, there should be a howto which steps have to be taken to enable NetBSD to boot from a flash drive.

Uploaded Work
File name/URL File size Date submitted
NetBSD USB.pdf 369.4 KB December 04 2012 15:13 UTC
Install guide.markdown 21.6 KB January 04 2013 13:08 UTC
guide-v2.markdown 21.8 KB January 04 2013 13:13 UTC
guide-v3.markdown 31.3 KB January 05 2013 12:49 UTC
guide-v4.markdown 31.5 KB January 06 2013 01:58 UTC
Comments
Alvin Tan on November 27 2012 22:59 UTC Boot

What do you mean by a enabling NetBSD to boot from a flash drive? Do you mean changing the BIOS for the boot device?

JAR on November 28 2012 00:55 UTC Task Claimed

I would like to work on this task.

Aleksej Saushev on November 28 2012 08:20 UTC Task Assigned

This task has been assigned to JAR. You have 240 hours to complete this task, good luck!

Julian Fagir on November 28 2012 11:49 UTC No, there's more to do

Hi,


a live system entails more than just changing the BIOS boot device. You have to do some tweaks on the operating system to actually be useful on the very slow flashdrives.


Regards, Julian 

JAR on November 29 2012 23:59 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

Melange on November 30 2012 19:11 UTC Task Claimed

I would like to work on this task.

Aleksej Saushev on December 1 2012 10:54 UTC Task Assigned

This task has been assigned to Lucian Jan Filimon. You have 240 hours to complete this task, good luck!

Aleksej Saushev on December 2 2012 22:32 UTC Progress?

Hi!


You're working on this task for two days already.


Despite the published estimated time, it is not that hard (complexity is overestimated), and by now you should have almost functioning image at the very least.


It is possible that you got stuck or misdirected. Please, get in touch with us on #netbsd-code so that we discuss problems or help you wrap up.

Melange on December 4 2012 15:44 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

Alvin Tan on December 4 2012 23:52 UTC Task Claimed

I would like to work on this task.

Alvin Tan on December 4 2012 23:56 UTC Question

Do I have to specifically use a OS(Win, Linux or OS X), to create the live USB?

blymn on December 5 2012 08:46 UTC which os

You will need to use NetBSD to perform this task as there are tools you need to run to setup the flash drive to boot that are only available in NetBSD.


 

Iain Hibbert on December 5 2012 09:11 UTC Task Assigned

This task has been assigned to Alvin Tan. You have 240 hours to complete this task, good luck!

Alvin Tan on December 7 2012 14:09 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

Pedro L. Coutin on December 17 2012 20:29 UTC labels/UUID in fstab

I guess that'd be a potential problem? The NetBSD partitions could correspond to different /dev 'nodes' depending on circumstances, right?


I did get a usb drive to work with NetBSD for installing, but I had to mess around with it a lot...

Julian Fagir on December 18 2012 00:36 UTC Yes, you have to ship around

Yes, that is a problem. The standard mounting mechanism won't work for USB devices.


Maybe it's a bit too much for this task, but in the end, you would have to provide a script which probes for the right device and mounts it.


 


 


If you created a USB stick from scratch for the installer, and it was essentially more than just what is already described in the USB stick  howto, you could also claim this task and describe what you have done.


 


 

wmzhere on January 3 2013 07:53 UTC Purpose?

Hi, 


I don't know the purpose of this task exactly. Could you please tell me what's the right one?



  • Burn it to an image file, write MBR and PBR to the flash drive. The bootloader maps the image to memory(memdisk), thus you can run NetBSD temporary on a flash disk. Once the computer is shut down, all your data on the memdisk is lost.

  • Run NetBSD installer from the flash drive, thus you can install it to a hard drive.

  • Run NetBSD from the flash drive just like running it from a built-in hard drive. You will feel no difference as if it's running on a hard disk.


Than you.

blymn on January 3 2013 08:00 UTC Re: Purpose

The third option is the one we are after.


 

wmzhere on January 3 2013 09:30 UTC Task Claimed

I would like to work on this task.

Julian Coleman on January 3 2013 09:53 UTC Task Assigned

This task has been assigned to wmzhere. You have 240 hours to complete this task, good luck!

wmzhere on January 4 2013 13:14 UTC Ready for review

The work on this task is ready to be reviewed.

blymn on January 5 2013 10:09 UTC review

Overall, this looks like an excellent job to me.  I can only see a couple of very small nits:


 


1) You use the phrase "unmounting might cost some time", this is not correct English and should be fixed


 


2) In the clean up you say run the command "umount /dev/cdrom", that is not where you said to mount things!


Can you please tidy these things up?


Thanks for the efforts so far.


 

blymn on January 5 2013 10:10 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

wmzhere on January 5 2013 12:51 UTC Ready for review

The work on this task is ready to be reviewed.

wmzhere on January 5 2013 13:03 UTC Error correction

Hi, 


I'm sorry that I posted the file with an error. Here's the diff.


 


--- guide-v3.markdown2013-01-05 20:55:47.389849387 +0800


+++ guide-v3-fix.markdown2013-01-05 20:52:26.505844801 +0800


@@ -801,7 +801,7 @@


 


 Insert the following text to `/mnt/usb/etc/rc.conf`. That will make NetBSD mount it at boot time.


 


-critical_filesystems_local = /var/run


+critical_filesystems_local="/var/run"


 


 You can unmount the drive and try to boot from it now.


 


 

Julian Fagir on January 5 2013 15:39 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Julian Fagir on January 5 2013 15:43 UTC Please apply the patch

Uhm, please apply that patch and upload the file again, it's difficult to apply the patch from Google Melange.


Are you sure using only /var/run as a tmpfs is sufficient? We've talked about that on IRC, I personally woudl also mount /var/tmp, /tmp and maybe even /var/lock as a tmpfs, but apparently you talked to blymn and he considered your work correct.


There's only one small thing I would also correct:


NetBSD# rm -rf /mnt/usb


is correct, but unnecessarily aggressive. Rather do `rmdir /mnt/usb` in case the user placed some files there (he shouldn't do that, but you never know).


Anyway, please upload again with your patch applied.

wmzhere on January 6 2013 01:58 UTC Ready for review

The work on this task is ready to be reviewed.

wmzhere on January 6 2013 02:07 UTC /var/lock?

Hi Julian, 


Thank you for your suggestions. Actually, "rm -rf" would be a catastrophe if user place something important there.


As for tmpfs for "/var/lock", I don't think it's necessary. The lock files are small and can be easily cached.



  • When there is lots of memory, the lock files stay in memory and if there's no memory they can be read from disk directly. 

  • If we use tmpfs, when there is lots of memory, they can be read from memey, when there's no memory, the tmpfs are stored on disk(swap partition) and reading them still requires disk read operation.


So, IMHO, it's not necessary.

blymn on January 6 2013 11:34 UTC Re: /var/lock

I think Julian is more concerned about wear and tear on the USB flash drive, they do have have a limited number of write cycles.  Mind you, there are lots of other things that would need to be done to minimise the writes to the drive.


Personally, I don't think we need to go overboard on these things for the purpose of this exercise.  What you have documented will allow someone to build a flash drive capable of being used to test drive a new machine or to give to someone to try NetBSD.  I can see where Julian wants to go with this but to me it seems a bit more that was originally asked for.


 

Julian Fagir on January 6 2013 18:47 UTC You're right

You're right. I think the work should be considered done now. Maybe we could open up another task about researching what causes the most write cycles, but then, GCi is nearly over...

Julian Fagir on January 6 2013 18:47 UTC Task Closed

Congratulations, this task has been completed successfully.