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
Boot by Alvin Tan November 27 2012 22:59 UTC

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

Task Claimed by JAR November 28 2012 00:55 UTC

I would like to work on this task.

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

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

No, there's more to do by gnrp November 28 2012 11:49 UTC

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 

Claim Removed by JAR November 29 2012 23:59 UTC

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

Task Claimed by November 30 2012 19:11 UTC

I would like to work on this task.

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

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

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

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.

Claim Removed by December 4 2012 15:44 UTC

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

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

I would like to work on this task.

Question by Alvin Tan December 4 2012 23:56 UTC

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

which os by blymn December 5 2012 08:46 UTC

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.


 

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

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

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

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

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

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...

Yes, you have to ship around by gnrp December 18 2012 00:36 UTC

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.


 


 

Purpose? by wmzhere January 3 2013 07:53 UTC

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.

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

The third option is the one we are after.


 

Task Claimed by wmzhere January 3 2013 09:30 UTC

I would like to work on this task.

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

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

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

The work on this task is ready to be reviewed.

review by blymn January 5 2013 10:09 UTC

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.


 

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

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.

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

The work on this task is ready to be reviewed.

Error correction by wmzhere January 5 2013 13:03 UTC

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.


 


 

Task Needs More Work by gnrp January 5 2013 15:39 UTC

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.

Please apply the patch by gnrp January 5 2013 15:43 UTC

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.

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

The work on this task is ready to be reviewed.

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

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.

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

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.


 

You're right by gnrp January 6 2013 18:47 UTC

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...

Task Closed by gnrp January 6 2013 18:47 UTC

Congratulations, this task has been completed successfully.