Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 23 Jul 2014, 04:15
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to do a full install on external USB hdd
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [30 Posts]   Goto page: 1, 2 Next
Author Message
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Thu 09 Oct 2008, 12:34    Post subject:  How to do a full install on external USB hdd  

---Edit---
Advance warning
(1) Puppy "as is" has been designed to enable running *frugal* installs off usb devices, including usb pendrives and usb hard-disk drives, and is used as such by many Puppians.
(2) Puppy has *not* been designed to run *full* installs off usb devices and, "as is", is not even capable to do so.
(3) This thread documents how I tweaked and patched Puppy to run full off usb nonetheless. However the technique is pretty delicate, well beyond "newbie" level, and (if you make mistakes) not without risk for other partitions and OSes that you may have on your PC. Summary: read the referenced material carefully, be sure you understand what you're doing, and use at your own risk.
---/Edit---

It's an issue that comes back repeatedly on the forum.

Has anybody ever been able to do a Puppy full install onto an external usb hard-disk drive, and to successfully boot it?

Before saying "yes I have", double-check PUPMODE in /etc/rc.d/PUPSTATE --- a full install has PUPMODE=2.

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm


Last edited by erikson on Thu 04 Dec 2008, 10:34; edited 6 times in total
Back to top
View user's profile Send private message Visit poster's website 
Béèm


Joined: 21 Nov 2006
Posts: 11782
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

PostPosted: Thu 09 Oct 2008, 15:12    Post subject:  

The last part, booting, is my main problem. But could be due to my Laptop not being able to do so. I get the message 'no operating system found'.
Didn't try however for quite some time.

But if I remember well, there is also the issue that in the early stage, vmlinuz, there is no USB support.

_________________
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
Back to top
View user's profile Send private message 
mechvent

Joined: 17 Mar 2007
Posts: 13

PostPosted: Tue 14 Oct 2008, 23:50    Post subject: limited success with 3.01  

I have been playing with this lately with a 2.5" external drive - usb. First thing I noticed is that on boot up pretty much every time I need to go into the bios and make sure that the external drive is listed first in the hard drive list because on several computers I have noticed that on reboot it defaults back to the internal drive.

I have tried every different permutation of and I seem to be able to boot a few times and then puppy is not able to find the pupsave file on the disk, whether I boot from the hard drive or try from another usb of cd. I even installed grub on an ext 3 and got the same problem after success 3 times.

I am about to try with puppy 4.1 and I will report any success/ failure.

To repeat, though, I am able to get puppy to boot every time, but after a few reboots the pupsave file cannot be found. The main trick was going into the bios on every reboot and making sure the external hard drive was chosen.
Back to top
View user's profile Send private message 
davesurrey

Joined: 05 Aug 2008
Posts: 1201
Location: UK

PostPosted: Thu 16 Oct 2008, 06:48    Post subject:  

@ mechvent,
The OP is about Full installs. I thought there were no pup_save files in a full install.
As erikson says, check you really are in a PUPMODE=2.
Dave
Back to top
View user's profile Send private message 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Sat 25 Oct 2008, 15:29    Post subject:  

Well, at last I did it.

I installed and booted a full-install Puppy off of my external USB hard drive.

Code:
# mount
rootfs on / type rootfs (rw)
/dev/sdb9 on / type ext3 (rw,errors=continue,data=ordered)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=2,mode=620)
none on /sys type sysfs (rw)
shmfs on /dev/shm type tmpfs (rw,size=117868k)
none on /proc/bus/usb type usbfs (rw)
#
# cat /etc/rc.d/PUPSTATE
PUPMODE=2
ATADRIVES='sda sdb '
PUP_HOME='/'
#

Too tired now to explain - maybe later as a how-to.

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm

Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3355
Location: Oregon

PostPosted: Sun 26 Oct 2008, 20:32    Post subject:  

[quote="erikson"]Well, at last I did it.

I installed and booted a full-install Puppy off of my external USB hard drive.

I did that a while back. It was to a usb drive from a Toshiba Satellite Laptop.
The Toshiba BIOS recognizes the usb drive as just another drive and by changing boot order, I could boot from the USB drive.
Upon removing it, the BIOS, not finding the USB drive would boot to the internal hard drive.
The external drive was partitioned and formated ext2 and no grub either on install.
It had a syslinux file instead.
Anyway, it worked fine.
Back to top
View user's profile Send private message 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Mon 27 Oct 2008, 05:03    Post subject:  

8-bit,

Quote:
The Toshiba BIOS recognizes the usb drive as just another drive and by changing boot order, I could boot from the USB drive. Upon removing it, the BIOS, not finding the USB drive would boot to the internal hard drive.

Okay.

Quote:
The external drive was partitioned and formated ext2 and no grub either on install. It had a syslinux file instead.

Okay again; syslinux is just another bootloader.

But booting off usb is not the problem, that works just fine (frugal). But are you sure it was a *FULL* install (i.e. with PUPMODE=2) ???

Please post /etc/rc.c/PUPSTATE.

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm

Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3355
Location: Oregon

PostPosted: Mon 27 Oct 2008, 20:57    Post subject:  

.[/quote] Okay again; syslinux is just another bootloader.

But booting off usb is not the problem, that works just fine (frugal). But are you sure it was a *FULL* install (i.e. with PUPMODE=2) ???

Please post /etc/rc.c/PUPSTATE. [/quote]

Opps (foot in mouth)!
I double checked and since it says I have a pupsave file and Pupstate=13, I guess I will have to try that again.

But for the few that would like to boot from a USB install, the insight here on BIOS support could save a few from the floppy load method.
Back to top
View user's profile Send private message 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Tue 28 Oct 2008, 10:10    Post subject:  

In short:

(1) The Puppy Universal Installer, as is, does *not* allow to do a full install on usb devices.

(2) Puppy's vmlinuz, as is, has *no* usb storage drivers (as static compiled-in modules) and thus can't access usb storage devices. (Note that usb storage drivers are included in initrd.gz such that it's possible to boot frugal installs off usb devices.)

It's a double catch-22.

Next posts explain how to overcome these catches.

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm

Back to top
View user's profile Send private message Visit poster's website 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Tue 28 Oct 2008, 10:12    Post subject:  

Allowing the Puppy Universal Installer to do a full install on usb storage devices.

This is easily solved by patching /usr/sbin/puppyinstaller.

Locate...
Code:
case $FINALPMEDIA in
 usbflash|usbhd|ideflash|idezip) #removable media, install with syslinux/extlinux
  (fairly long usb/flash/zip section; only frugal)
  ;;
 scsihd|idehd|satahd) #internal media, boot with boot-disk or grub.
  (fairly long hdd section; full or frugal)
  ;;
 idecd|scsicd|usbcd)
  (cd section, not yet implemented)
  ;;
esac

... and modify as follows...
Code:
case $FINALPMEDIA in
 usbflash|usbhd|ideflash|idezip|scsihd|idehd|satahd)
  (fairly long hdd section; full or frugal)
  ;;
 idecd|scsicd|usbcd)
  (cd section, not yet implemented)
  ;;
esac

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm

Back to top
View user's profile Send private message Visit poster's website 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Tue 28 Oct 2008, 10:14    Post subject:  

Booting a full install off usb storage device

I'll start with my code.

Code:
#!/bin/sh
#=====================================================================
# Script: init (in initrd-410k25-full-usb.gz)
# (-c) GPL erikson 2008-Oct-25, last rev. 2008-Oct-28
# Some code used and adapted from Puppy Linux (LGPL Barry Kauler)
# Purpose: booting full-install Puppy off usb storage device
#=====================================================================

#=== usb boot partition (boot hint or default)
[   $pdev1 ] && PDEV1=$pdev1
[ ! $PDEV1 ] && PDEV1=sdb9
PDEV=$(echo $PDEV1 | cut -b1-3)

#---------------------------------------------------------------------
# Functions

ferr() {
 echo "Fatal error: $1" >/dev/console
 echo "Dropping out to initrd console" >/dev/console
 exec /bin/sh 1>/dev/console 2>&1
}

#---------------------------------------------------------------------
# Main code

mount -t proc none /proc
mount -t sysfs none /sys
mount -t rootfs -o remount,rw rootfs /
ln -s /proc/mounts /etc/mtab

USB_ROOT=/dev/$PDEV1
USB_MPNT=/mnt/$PDEV1
mkdir -p $USB_MPNT

#=== Load kernel drivers for usb

echo "Loading kernel drivers needed to access USB drive(s)..." >/dev/console
modprobe usbcore
[ "$(elspci -l | grep '0C0300')" != "" ] && modprobe uhci-hcd
[ "$(elspci -l | grep '0C0310')" != "" ] && modprobe ohci-hcd
[ "$(elspci -l | grep '0C0320')" != "" ] && modprobe ehci-hcd
modprobe usb-storage &      # BK backgrounds this too (why?)

#=== Wait till usb device PDEV is registered
#    takes 6...7 seconds on my laptop

echo "Registering USB storage device(s)..." >/dev/console
TLOG=/tlog ; rm -f $TLOG   # comment out for no logging
i=1 ; imax=15
while [ $i -le $imax ]; do
 ALLDRVS=$(ls -1 /sys/block | egrep "^hd|^sd|^scd|^sr|^mmc")
 [ $TLOG ] && echo "--- pass $i ---" >>$TLOG
 [ $TLOG ] && echo $ALLDRVS >>$TLOG
 [ $TLOG ] && /bin/dmesg | grep "usb-storage:" >>$TLOG
 sleep 1
 [ "$(echo $ALLDRVS | grep $PDEV)" != "" ] && break
 i=$((i+1))
done

#=== Mount the usb boot partition, drop out to console if failing

mount $USB_ROOT $USB_MPNT || ferr "can't mount $USB_ROOT"
[ -f $USB_MPNT/etc/puppyversion ] || ferr "can't find marker file ($USB_MPNT/etc/puppyversion)"

#=== Done - do the switch_root

[ $TLOG ] && cp -af $TLOG $USB_MPNT
sync
umount /sys
umount /proc

echo "Now executing the switch_root..." >/dev/console
exec switch_root $USB_MPNT /sbin/init

#========= end of file ===============================================


Now the rationale.

The following IBM article gives an excellent overview of the issues involved (read it first): Boot Linux from a FireWire device.

As applied to Puppy, full installs use the one-pass boot method (i.e. vmlinuz only), while frugal installs use the two-pass boot method (i.e. vmlinuz plus initrd.gz). The one-pass method can be used if the necessary drivers are built into the kernel *and* if the devices respond timely. In regular Puppy this is the case only for internal hard disk drives.

It's possible to compile the kernel with usb support included (from the sources supplied by Barry). I have done so for testing; unfortunately the recompiled vmlinuz still would not boot a full install off usb, with error message: "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block (0,0)". This reflects the catch-22 issues mentioned in the article: "There is a timing window within the kernel, which means that often, the kernel will proceed to try to mount the root device before it has had a chance to be properly detected or initialized." On the web there are several patches around to build a kernel that deals with this catch-22, but the ones I found apply to older kernel versions. I did not pursue this road any further.

Now it may come as a big surprise to most Puppians that it's also possible to use a two-pass boot (i.e. with some appropriate initrd.gz) for regular full installs. Note that the ultimate characteristic of a full install is that the boot partition is directly mounted on / (as opposed to a frugal install, that uses filesystems within files pup_xxx.sfs, pup_save.2fs etcetera).

Re initrd two-pass booting, quoting IBM: "In a nutshell, the kernel is booted as normal; but instead of mounting the "real" root file system, a miniature root filesystem is created in RAM, and that is mounted. Any number of arbitrary steps can then be performed in this initial environment before the real root is mounted and we switch to using the real root and destroy the initial RAM disk. This is useful in all sorts of circumstances, but for our purposes we will simply be using our mini environment to rescan the SCSI bus, wait for the external disk to be recognized, then switch to using this as our real root and continue to boot."

So that's what my init code above does - it loads the usb drivers, waits for the usb drive(s) to be registered, mounts and switches root to the boot partition. Nothing more, nothing less (there's no pup_xxx.sfs nor pup_save.2fs involved). Note that the technique of IBM's linuxrc script (namely exiting with exit 0 for further booting) doesn't work with Puppy's vmlinuz (I tested and it fails), so I do a regular switch_root to /sbin/init.

Now the practical steps:
- do a Puppy full install on a fresh usb hdd partition, e.g. using the modified universal installer of previous post (I used Puppy 4.1 kernel 2.6.25.16); this also copies vmlinuz into the /boot subdir of that partition
- take Puppy's initrd.gz, unpack it, replace the init script by the code above, repack into initrd-410k25-full-usb.gz, and place it along with vmlinuz in the same /boot subdir (Later edit: the techniques for unpacking and repacking initrd.gz are documented in Pizzasgood post here).
- edit your grub menu.lst, e.g. (Later edit: if you don't have an installed grub yet, you must install and configure it first; also see comments on grub in further posts)
Code:
# --- pup410k25 FULL (ro, vga=normal) ---
title pup410k25 FULL
root (hd0,8)
kernel /boot/vmlinuz root=/dev/sdb9 pdev1=sdb9 ro vga=normal pmedia=usbhd nosmp
initrd /boot/initrd-410k25-full-usb.gz

Reboot into pup410k25 FULL and enjoy the full install running off usb hard drive.

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm


Last edited by erikson on Fri 14 Nov 2008, 14:06; edited 7 times in total
Back to top
View user's profile Send private message Visit poster's website 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Tue 28 Oct 2008, 10:15    Post subject:  

Additional comments

I have tested full installs of Puppy 4.1 kernel 2.6.25.16 on:
- external usb hard disk drive (Seagate FreeAgent Desktop 500 GB)
- usb flash pendrive (SanDisk U3 Cruzer Micro 2 GB)

Both work. Note that I would not recommend to run a full install off usb flash pendrive (risk of premature wear-out), but I was curious if it would work, and it does.

Herewith the tarred init script (as listed in earlier post) and modified puppyinstaller (as allowing to do full install on usb devices).
410k25-full-usb.tar.gz
Description 
gz

 Download 
Filename  410k25-full-usb.tar.gz 
Filesize  19.43 KB 
Downloaded  465 Time(s) 

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm

Back to top
View user's profile Send private message Visit poster's website 
erikson


Joined: 27 Feb 2008
Posts: 735
Location: Ghent, Belgium

PostPosted: Sun 02 Nov 2008, 12:19    Post subject:  

For booting a full-install, initrd.gz doesn't need everything of the original one.

I removed the superfluous files. Herewith the size of the original initrd.gz (1239 KB) is reduced to just 434 KB for the modified version that suffices to boot the full install.

_________________
If it ain't broke, don't fix it. --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
http://www.desonville.net/
Puppy page: http://www.desonville.net/en/joere.puppy.htm

Back to top
View user's profile Send private message Visit poster's website 
russoodle


Joined: 12 Sep 2008
Posts: 653
Location: Down-Under in South Oz

PostPosted: Mon 03 Nov 2008, 00:07    Post subject: Re: Full install on external USB hdd..
Subject description: my mind boggles!
 

Thanx for all this, erikson...

I'm pretty much a noob to Linux in general and have no understanding of any OS programming code, so it'll take me a while to assimilate all the info you've kindly provided here and be able to use it, actually knowing what i'm doing Confused

I have a couple of flash drives and the odd corrupted or seldom-used winblows drives, which i thought could be better utilised with Puppy, in conjunction with my IBM T40P laptop, so i'm going to save this page for reference purposes.

ATM, my first partition on the single hdd is home to XP with the next primary partition housing Ubuntu 8.04; additionally, there's a 1gb swap partition and another ext3-formatted partition, which i plan to use for various Puplet frugal installs (heaven knows i have enough Puplet iso CDs here!).

Interesting to note the wireless in your siggy-specs...for the life of me, i cannot connect to my network (wired to mac-beast) with any incarnation of Puppy whatsoever, although both XP and Ubuntu do so seamlessly (and wirelessly) after having been configured just once. Ath0 is recognised, i configure the parameters but the resulting dialogue tells me it cannot make a WPA connection. I reconfigured the router with only WEP security but it still didn't play nice, so for the moment i'm alternately sulking/fuming with frustration, because if i could only get online with Puppy, i doubt that either other OS on this machine would get much exercise at all!

Anyway, my apologies, as this thread isn't the place for my wireless connection issues, however i couldn't resist an envious little vent when i noted your sig Wink

Cheers!
Back to top
View user's profile Send private message 
Béèm


Joined: 21 Nov 2006
Posts: 11782
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

PostPosted: Tue 11 Nov 2008, 16:39    Post subject:  

Thanks to the reference to PizzasGood post about unpacking/repacking initrd I could go on further.

The boot process of the USB drive did start now, but got a message from EXTLINUX: could not find kernel image Linux
boot:

So I then entered /boot/vmlinuz and boot continued to end at a kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(22,1)

Still something missing on that USB drive?

_________________
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [30 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1116s ][ Queries: 12 (0.0044s) ][ GZIP on ]