20c24 FreeBSD on usb stick (Live USB) - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > Installing & Upgrading

Installing & Upgrading Installing and upgrading FreeBSD.

Reply
 
Thread Tools Display Modes
  #1  
Old September 25th, 2009, 16:25
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default FreeBSD on usb stick (Live USB)

I'd like to have FreeBSD even while travelling so I'm trying to install FreeBSD on usb stick.
I tried to boot from CD and install from FTP on usb stick. This works but with 2 issues:
1. Despite I have a line in /etc/fstab:
Code:
/dev/da0s1a     /     ufs    rw    1    1
root cannot be found on boot and I have to mount it manually in loader prompt. Then everything goes well.
2. /tmp and /var are on the stick so lots of writing occurs that is not good for this kind of media.

I also tried this but there is a mess with fstab in that "howto": it drops me to single user mode and asks to correct fstab that is indeed unusual:
Code:
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ufs/FreeBSDonUSB   /               ufs     rw,noatime      1       1
md                      /tmp            mfs     rw,-s16M,nosuid,noatime 0       0
md                      /var/run        mfs     rw,-s4M,nosuid,noatime  0       0
md                      /var/log        mfs     rw,-s16M,nosuid,noatime 0       0
/dev/acd0               /cdrom          cd9660  ro,noauto,nosuid        0       0
/proc                   /proc           procfs  rw,noauto       0       0
/tmp                    /var/tmp        nullfs  rw              0       0
I prefer first option but I suspect that something wrong with that (looking normal) fstab too because trying to boot my another machine I'm getting something like: "no boot" "no ufs".

Did somebody successfully installed FreeBSD on usb-stick with swap, /tmp and /var on local HDD or in memory?
Reply With Quote
  #2  
Old September 25th, 2009, 20:36
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

Working fine here. No swap, filesystems as suggested by the howto you linked to...
Reply With Quote
  #3  
Old September 25th, 2009, 22:14
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

...gosh, what could be wrong?
I just rebuilt world and kernel from 8-b2 t0 8-rc1. Cannot mount root at all and da0 is not in the list of valid devices
before I at least could mount as ufs:/dev/da0s1a, not now.
Reply With Quote
  #4  
Old September 25th, 2009, 22:28
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

Perhaps you're not building correctly?

I recommend using a release installation to set it up.
Reply With Quote
  #5  
Old September 25th, 2009, 23:34
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

You meant kernel+world or usb install?
I followed the install by character, but... yes, mistakes happen
Mergemaster? I checked, main configs are correct.
Do you have exactly the same fstab as I posted?
One more strange thing: the flash appears as twice mounted if inserted into working system. I need to check what's bootable on the stick...otherwise I have to repeat
Reply With Quote
  #6  
Old September 26th, 2009, 02:34
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

This is my fstab:

Code:
/dev/ufs/FreeBSD	/               ufs     rw,noatime      1       1
md                      /tmp            mfs     rw,-s16M,nosuid,noatime 0       0
md                      /var/run        mfs     rw,-s4M,nosuid,noatime  0       0
md                      /var/log        mfs     rw,-s16M,nosuid,noatime 0       0
/dev/acd0               /cdrom          cd9660  ro,noauto,nosuid        0       0
/proc                   /proc           procfs  rw,noauto       0       0
/tmp                    /var/tmp        nullfs  rw              0       0
Reply With Quote
  #7  
Old September 27th, 2009, 01:34
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

Looks the same. What partitions do you have on the stick?
I chose "entire disk" but I have unused before (understandable) and after.
The after unused space looks as marked A and I cannot remove it.
The stick in mounted as 2 partitions.
I'd rather not to reinstall everything 'cause I have only beta2 CD to mount. How to move A from unused to da0s1a?
Reply With Quote
  #8  
Old September 27th, 2009, 02:50
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

I have two partitions (slices). One FAT32 slice for generic data, and one BSD slice for my FreeBSD system. I have boot0 installed in the MBR (just in case).

fdisk(8) will allow you to set the active partition.
Reply With Quote
  #9  
Old September 27th, 2009, 13:58
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

I reinstalled everything. Anyway I have to do the following at mountroot> prompt that appears every time.
Code:
mountroot> ufs:/dev/da0s1a
But at least fstab is mounted now.
The only thing I changed in the howto is my volume label: I called it FBSDUSB instead of FreeBSDonUSB.
I have in /boot/loader.conf:
Code:
geom_label_load="YES"
and dmesg shows:
Code:
user@: /usr/obj/usr/usr/src/sys/GENERIC
module_register: module g_label already exists!
Module g_lable failed to register: 17
........................................
Trying to mount root from ufs:/dev/ufs/FBSDUSB
BOOT MOUNT ERROR:
If you have invalid mount options, reboot, and first try the following from the loader prompt:
set vfs.root.mountfrom.options=rw
and then remove invalid mount options from /etc/fstab
there is nothing in my us/obj. What I'm doing wrong?
Reply With Quote
  #10  
Old September 27th, 2009, 18:08
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

I read man but anyway I'm not fdisk expert. For me it's strange to see this stick always appeared as 2 identical entries: one entry is mountable another is not (file or directory doesn't exist)
Below is fdisk output identical for /dev/da0 and /dev/ufs/FBSDUSB and /dev/da0s1a:
Code:
# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=487 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=487 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 7823592 (3820 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 486/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
#
However if use /dev/da0s1 the output is:
Code:
# fdisk /dev/da0s1
******* Working on device /dev/da0s1 *******
parameters extracted from in-core disklabel are:
cylinders=486 heads=255 sectors/track=63 (16065 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=486 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
<UNUSED>
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 0, size 50000 (24 Meg), flag 80 (active)
        beg: cyl 0/ head 0/ sector 1;
        end: cyl 1023/ head 254/ sector 63
#
This is beyond my comprehension: why 4 partitions? Why upside down and wrong size? Finally and most important: can I delete 3 unused partitions and have then only 1 or 2 instead (1 or 2 offset partitions)? I also don't understand why those 3 unused partitions have no any size?
Before reinstalling I whipped out everthing and I had only 1 partition. I'd rather not to loose the installation: it works though I have to manually mount root on every boot. Is it possible to correct partition table without loosing all the data?
Reply With Quote
  #11  
Old September 28th, 2009, 00:17
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

You are misunderstanding how a PC BIOS MBR works. There is no MBR in the first sector of a partition, so don't try run it on da0s1.

Not sure what you've done wrong. Looks like your fstab is broken. Is there a /dev/ufs/FBSDUSB? Can you mount it as such at the mountroot prompt? If so, check your fstab file for errors.
Reply With Quote
  #12  
Old September 29th, 2009, 15:28
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

Thanks. Indeed in depth I don't understand BIOS and disk geometry and only I know is that MBR usually resides on first 64 sectors of HDD. That what I have with this flash:

Code:
Offset   Size(ST)    End    Name   PType    Desc  Subtype   Flags

  0        63         62     -      12      unused     0
 63     7823592    7823654  da0s1    8      freebsd  165     A
7823655   11993    7835647   -      12      unused     0
I understand that first 63 sectors are reserved for MBR. But whatever I tried the last UNUSED partition (or space) stays firm there having the same 11993 (big enough?) number of sectors as unused. Do you know what is that unused space for? Could be those just "bad sectors"? If yes why this flash is always mounted as 2 same name entries? Does this unused space matter?
Also this could be important:
Code:
bios_geom=487/255/63 = 7823655
So the "fake" partition (unused space) is located beyond legal bios space? Does this flash has invalid partition table that I cannot wipe away?

As to fstab I provided it in this thread and as you can see it's exactly the same as yours except label name that cannot be a reason of my troubles, is it?
I CANNOT mount the device at mountroot prompt as FBSDUSB, only as /dev/da0s1a. When it was just fat32 formated flash I mounted it under FreeBSD as /dev/da0s1 that's why I tried it again.
Reply With Quote
  #13  
Old September 29th, 2009, 17:27
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

I'm not sure why sysinstall's partition tool is reporting that weird amount of unused space at the end. Usually it should be one cylinder's worth of unused space, but I'm not sure that old rule has to be followed any more, and it shouldn't appear to go past the end of the disk. It is not bad sectors that's for sure. You can ignore it I think as fdisk's idea of your partition table looks fine to me.

Quote:
I CANNOT mount the device at mountroot prompt as FBSDUSB, only as /dev/da0s1a.
Then there is a problem with the file system's label or with glabel. Add this to loader.conf:

Code:
kern.geom.label.debug=1
And paste your subsequent boot dmesg.
Reply With Quote
  #14  
Old October 1st, 2009, 18:15
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

Sorry for the delay.
I reinstalled everything again with the same result
Debug output:
Code:
mountroot> GEOM_LABEL [1]:MSDOSFS:da0: FAT12/16 volume not valid
GEOM_LABEL [1]:MSDOSFS:da0s1: FAT32 volume not valid
GEOM_LABEL [1]:UFS2 file system detected on da0s1a
GEOM_LABEL [1]:Lable for provider da0s1a is ufsid/4ac4ac0c82f9c462
GEOM_LABEL [1]:UFS2 file system detected on da0s1a
GEOM_LABEL [1]:Label for provider da0s1a is ufs/FBSDUSB
GEOM_LABEL [1]:MSDOSFS:da0s1a: no FAT signature found
My only choice was to type again as always : ufs:/dev/da0s1a and it boots with this:
Code:
GEOM_LABEL [1]:Label ufs/FBSDUSB removed
GEOM_LABEL [1]:Label ufsid/4ac4ac0c82f9c462  removed
Looks normal but...why 2 labels? Is that why the stick is mounted always as 2 partitions?

Next. I tried the stick on my another machine. Result:
Code:
Not ufs
Not ufs
No /boot/loader

FreeBSD/i386 boot
Default: 0:fd(0,a)boot/kernel/kernel
boot:
Not ufs
No /boot/kernel/kernel

FreeBSD/i386 boot
Default: 0:fd(0,a)boot/kernel/kernel
boot: 0:da(0,a)boot/kernel/kernel ## I typed this.
WARNING: loader(8) metadata is missing!
Then everything went normal up to mountroot> and then I COULD NOT mount with ufs:/dev/da0s1a (and anything else I tried). There is no da0 in the list of valid boot devices. So I had to abort. BTW there was no any debug output on this machine.

Notes about the HowTo:
This doesn't work for me:
Code:
# DESTDIR=/mnt ./install.sh
DESTDIR=: command not found
but this works:
Code:
# setenv DESTDIR /mnt
# ./install.sh
This doesn't work and no clue what enter instead:
Code:
# chroot /mnt /bin/sh
# mount_devfs devfs /dev
mount_devfs: command not found
Missing /mnt in first line:
Code:
# cat >> /etc/rc.conf << EOF
ifcofig_DEFAULT="DHCP"
must be:
# cat >> /mnt/etc/rc.conf << EOF
I also tried to install kde3.5.10 on the stick as suggested in the HowTo. + xorg-minimal. Result: tons of errors, missing libraries, even xorg won't start nothing to dream about kde. Perhaps /tmp is too small for such operations since I saw "cannot write to /tmp...filesystem is full" many times.
Reply With Quote
  #15  
Old October 2nd, 2009, 02:00
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

Quote:
Originally Posted by zeiz View Post
Sorry for the delay.
I reinstalled everything again with the same result
Debug output:
My only choice was to type again as always : ufs:/dev/da0s1a and it boots with this:
Code:
GEOM_LABEL [1]:Label ufs/FBSDUSB removed
GEOM_LABEL [1]:Label ufsid/4ac4ac0c82f9c462  removed
No idea. All I can say is that it works perfectly here.

Quote:
Originally Posted by zeiz View Post
Next. I tried the stick on my another machine. Result:
Code:
Not ufs
Not ufs
No /boot/loader

FreeBSD/i386 boot
Default: 0:fd(0,a)boot/kernel/kernel
boot:
Not ufs
No /boot/kernel/kernel

FreeBSD/i386 boot
Default: 0:fd(0,a)boot/kernel/kernel
boot: 0:da(0,a)boot/kernel/kernel ## I typed this.
WARNING: loader(8) metadata is missing!
Then everything went normal up to mountroot> and then I COULD NOT mount with ufs:/dev/da0s1a (and anything else I tried). There is no da0 in the list of valid boot devices. So I had to abort. BTW there was no any debug output on this machine.
The problem here is the BIOS. It is making the USB disk look like a floppy disk. Look around for the BIOS setting that makes USB boot devices look like hard drives.


Quote:
Originally Posted by zeiz View Post
Notes about the HowTo:
This doesn't work for me:
Code:
# DESTDIR=/mnt ./install.sh
DESTDIR=: command not found
Yup, the howto uses a bourne type shell. You are using csh it seems.

Quote:
Originally Posted by zeiz View Post
This doesn't work and no clue what enter instead:
Code:
# chroot /mnt /bin/sh
# mount_devfs devfs /dev
mount_devfs: command not found
Out of date information. Rather:
Code:
mount -t devfs devfs /dev
Reply With Quote
The Following User Says Thank You to aragon For This Useful Post:
zeiz (October 2nd, 2009)
  #16  
Old October 2nd, 2009, 21:40
zeiz's Avatar
zeiz zeiz is offline
Member
 
Join Date: Nov 2008
Location: Canada
Posts: 691
Thanks: 38
Thanked 54 Times in 52 Posts
Default

Finally: I cannot boot the stick on another machine and this makes me to give up at this time...
Anyway thank you very much!
Reply With Quote
  #17  
Old October 4th, 2009, 22:29
aragon aragon is offline
Giant Locked
 
Join Date: Nov 2008
Location: Cape Town, South Africa
Posts: 2,031
Thanks: 68
Thanked 253 Times in 203 Posts
Default

I recently spotted this:

http://lists.freebsd.org/pipermail/f...er/012361.html

That might address the problem you're having.
Reply With Quote
  #18  
Old December 19th, 2009, 21:25
yvonney yvonney is offline
Junior Member
 
Join Date: Jun 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Could it be the thing I always had to puzzle about with linux where the PC bios calls the partition from a different name. I've had many a struggle figuring out how to boot from external drive or flash changing grub/fstab. Sorry I can just tell you.
Reply With Quote
  #19  
Old January 8th, 2010, 08:14
yvonney yvonney is offline
Junior Member
 
Join Date: Jun 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

known bug? Making me better at freeBSD for sure. Running from 1 gig flash stick. Typing it what's advised at:

mountpoint>

works sometimes.
It may be (as said in first link and elsewhere) that typing ufs:/dev/da0 FIVE TIMES (failing each time of course)
THEN doing full string: ufs:/dev/da0s1a (or whatever your usb device is) - will work

I will try 5-times work-around now.


Here's links i found by searching google for:
"freebsd usb external boot drive ufs:/dev/da0s1a"

http://www.freebsd.org/cgi/query-pr.cgi?pr=138798
http://lists.freebsd.org/pipermail/f...il/006042.html
http://old.nabble.com/Re:-Can%27t-bo...d25977274.html
Reply With Quote
  #20  
Old March 1st, 2010, 11:49
fbsd1 fbsd1 is offline
Member
 
Join Date: Feb 2010
Location: Angeles City, Philippines
Posts: 204
Thanks: 0
Thanked 45 Times in 29 Posts
Default

read these how-to guides your answer is there

http://forums.freebsd.org/showthread.php?t=11715

http://forums.freebsd.org/showthread.php?t=11680
__________________
FreeBSD Install Guide www.a1poweruser.com
Maintainer of the sysutils/qjail port
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Install FreeBSD 8.0 using a USB stick, failed: No /boot/loader everypot Installing & Upgrading 10 February 29th, 2012 19:34
usb stick as pass device slam Peripheral Hardware 10 September 16th, 2009 19:57
Unable to mount ext2 filesystem on USB SATA drive with Live CD donallen General 4 January 24th, 2009 17:12
install on a usb stick DemoDoG Installing & Upgrading 6 January 7th, 2009 15:02


All times are GMT +1. The time now is 07:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0