le4thab
Posts: 52
Joined: Fri Jan 06, 2012 10:55 pm

Re: booting of USB flash drive

Mon May 07, 2012 6:27 pm

NOOB ALERT!

i only have 8gh cards to play with and have maxxed out my budget with logitech k260(plug and play,please add to usable kb+mice £20 tesco) and generic powered usb hub(logik LP4HUB10 £15 comet).

i have run into problems with only being able to write the Arch image to sd and boot from this.i would like to run kde as a full package and remove what i do not want/need.i then have problems with storage on the card.

i understand that if i edit the cmdline.txt to show root =dev/sda1 instead of root=mmcblk0p2 it should look to the usb drive to boot from.

i have a few questions about this

1.would i be right in thinkin if i copy the contents of a bootable sd card with the changes above this will boot to the usb(i understand sd card has to be present)?

2.how can i find the address to the usb drive?i am new to any kind of command line and cd /dev/sda1 reports the error "the system cannot find the path specified" i am of the understanding that this is wrong (DUHHH) and would like some help with this.

Thanks

James

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: booting of USB flash drive

Mon May 07, 2012 6:36 pm

Try this (from the command line):

$ sudo bash

# fdisk -l

#

That should tell you device names of all the attached "hard-disk-like" devices.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

le4thab
Posts: 52
Joined: Fri Jan 06, 2012 10:55 pm

Re: booting of USB flash drive

Mon May 07, 2012 6:41 pm

i am thrying this under windows and sudo is not a recognised command also what is the last letter of the command fdisk -?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: booting of USB flash drive

Mon May 07, 2012 6:48 pm

These are Unix commands - they will (only) work on a Unix (Linux) system.

If you really are in a situation where you can't boot the Pi at all (from the SD card), then you may have to try to hit it by trial and error.  Try /dev/sda1.  If that doesn't work, try /dev/sda2, and so on.  Or try /dev/sdb1, and so on.

Note also that /dev/sd* does't mean anything on a Windows system, so it is not surprising that it generated a useless error message in that environment.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: booting of USB flash drive

Mon May 07, 2012 6:48 pm

Oh, and the last letter of the fdisk command is "el" (as in lisp)
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

le4thab
Posts: 52
Joined: Fri Jan 06, 2012 10:55 pm

Re: booting of USB flash drive

Mon May 07, 2012 7:17 pm

thanks.

i tried the command on arch and saw that the 32gb drive is seen as dev/sda but still no luck lol i dont know what should be left on the sd card now.i thought that this would be just the cmdline.txt but obviously not because i get no boot at all now

User avatar
jojopi
Posts: 3041
Joined: Tue Oct 11, 2011 8:38 pm

Re: booting of USB flash drive

Mon May 07, 2012 7:44 pm

le4thab said:

i only have 8gh cards to play with
If you mean 8GB, then that is plenty.  But because the downloadable images need to work on smaller cards too, they only use the first 2GB by default.  So if you want to install a lot of extra packages you may need to resize the filesystem to use the whole card.

i have run into problems with only being able to write the Arch image to sd and boot from this.i would like to run kde as a full package and remove what i do not want/need.i then have problems with storage on the card.
Do you mean that the Debian image did not boot, but the Arch image did?  As a beginner you might be better to try to get Debian working...

i understand that if i edit the cmdline.txt to show root =dev/sda1 instead of root=mmcblk0p2 it should look to the usb drive to boot from.
Yes.  But getting a suitable Linux root filesystem onto the USB drive first is not a simple process to describe.  Especially if you want to do it from Windows.

le4thab
Posts: 52
Joined: Fri Jan 06, 2012 10:55 pm

Re: booting of USB flash drive

Mon May 07, 2012 8:01 pm

yes,i have gotten an arch image onto 3 diffrent sdhc cards bot cannot seem to do the same with the fedora remix and debian!i have used 3 diffrent programs (win32diskimager, roadkills disk image, flashnul-1rc1 and then the fedora auto installer which i cannot get to see any drives.)

i would like to install kde on top of arch but using a usb drive as the storage.but i thought pointing the sd card to look to usb as a boot drive would be easier?

is there any way of installing a gui to usb and not the sd card?

User avatar
Feakster
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm

Re: booting of USB flash drive

Thu May 10, 2012 7:10 pm



le4thab said:


i only have 8gh cards to play with


If you mean 8GB, then that is plenty.  But because the downloadable images need to work on smaller cards too, they only use the first 2GB by default.  So if you want to install a lot of extra packages you may need to resize the filesystem to use the whole card.


i have run into problems with only being able to write the Arch image to sd and boot from this.i would like to run kde as a full package and remove what i do not want/need.i then have problems with storage on the card.


Do you mean that the Debian image did not boot, but the Arch image did?  As a beginner you might be better to try to get Debian working…


i understand that if i edit the cmdline.txt to show root =dev/sda1 instead of root=mmcblk0p2 it should look to the usb drive to boot from.


Yes.  But getting a suitable Linux root filesystem onto the USB drive first is not a simple process to describe.  Especially if you want to do it from Windows.



This is something I'm keen to try. Anyone got any ideas or a step-by-step process to create a bootable SD card that switches to the USB for the filesystem?

le4thab
Posts: 52
Joined: Fri Jan 06, 2012 10:55 pm

Re: booting of USB flash drive

Thu May 10, 2012 7:43 pm

Tbh i asked for instructions on another thread and one guy has it going.he said that to do it you would need the latest kernal from github but im a bit stumped lol i think the thread is pie doa.keep me updated if you find out anything mate

User avatar
Feakster
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm

Re: booting of USB flash drive

Thu May 10, 2012 8:04 pm

Will do

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: booting of USB flash drive

Thu May 10, 2012 8:24 pm

Hi,

You can't ever change directory to /dev/sda1 - it's a not a directory.

Just a quick intro, all hardware that exists needs to be represented to the user/kernel somehow. The /dev/ directory holds all the representations of the hardware. In this case, anything that is mass storage (pen drive) on the USB port, or anything on SATA will appear as an sdX device. X being a letter that represents which device it is. Any number that follows the letters refers to a partition. So, /dev/sda1 refers to the first partition on the first mass storage device attached to the USB. Just an FYI of course.

There should be no reason why you can't just copy all of the contents from the 2nd partition of the SD card onto an appropriately formatted USB drive (FAT32 should work, but I'd strongly recommend an ext (my preference) or Reiser filesystem). Once you do this the changes to the configuration file you mention should do the trick. Linux is very happy with scattered filesystems.

However, that doesn't mean to say that it will work. The old problem was that the bootloader kicked the kernel into life, the kernel tries to mount the filesystems. If the USB drivers haven't taken affect by this point (they didn't in the past) then the filesystem couldn't mount. There are fixes out there, but if they are in the standard Pi kernel I don't know. I don't have a Pi yet.

Give it a try though

le4thab
Posts: 52
Joined: Fri Jan 06, 2012 10:55 pm

Re: booting of USB flash drive

Thu May 10, 2012 9:48 pm

hey steady_bear i tried this.the /dev/sda1 was the address of the first partition on the 32gb flash drive.the image files from 2 sd cards (one contained arch and the other debian) were then placed in the root of the directory and then the file to change where the rpi to look to boot from was changed.this took up (as you can imagine) a huge portion of yesterday.

i tried this with each individual file between the sd and flash drive to no avail lol

User avatar
Feakster
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm

Re: booting of USB flash drive

Thu May 10, 2012 10:24 pm

le4thab said:


Tbh i asked for instructions on another thread and one guy has it going.he said that to do it you would need the latest kernal from github but im a bit stumped lol i think the thread is pie doa.keep me updated if you find out anything mate


I've been talking to another guy about it on a forum topic I started & we've made a bit of progress. He's got his working off the USB now. I'm still trying. I picked the wrong one of two options on mine which is why I'm re-flashing now. Check this topic:

http://www.raspberrypi.org/for.....tem#p76674

Have a read & see if that helps. You'll need to burn the image to both your SD card and USB stick. Then you need to copy and paste the new kernel file from github in place of the old one. Once you've done that, you need to change the cmdline.txt file by swapping out the destination of the root partition "root=mmcblk0p2" for either "root=dev/sda1" or "root=dev/sda2". I'm not sure which.

User avatar
Feakster
Posts: 35
Joined: Sun Jan 22, 2012 10:41 pm

Re: booting of USB flash drive

Thu May 10, 2012 10:25 pm

le4thab said:


Tbh i asked for instructions on another thread and one guy has it going.he said that to do it you would need the latest kernal from github but im a bit stumped lol i think the thread is pie doa.keep me updated if you find out anything mate


github's kernel's available here:

https://github.com/raspberrypi/firmware ... kernel.img

You have to click where it says "view raw" to download. I thought I'd say because it's not obvious.

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: booting of USB flash drive

Fri May 11, 2012 9:26 am

Hi,

I think I may have slightly mislead you. I was trying to get at the following:

on the Pi whilst it is running type:

'fdisk /dev/mmcblk0p' (assuming this is the SD card)
hit 'p' and check what filesystem is used for the second partition. Write down exactly what it says.
hit 'q' to exit and not harm your SD data.

'fdisk /dev/sda'
hit 'p' - there should be only one partition, likely to be FAT32 or NTFS unless you've changed it already. Hit 'L' (I think) to get a list of FS codes and look for the one that matches the description for SD card partition 2, that you made a note of earlier.
Hit 't' then following the prompts, you need to enter the code. Hitting 'p' again should show the FS of the USB partition 1 is now a Linux one.
Hit 'w' to write the changes to card and exit.

Hit '?' at any point to get a list of what different letters mean, I may have got 'L' (lowercase BTW) and 't' backwards. Hit return after the letter or you get a very long wait.

'mke2fs -j /dev/sda1' this will format the USB drive to have the ext3 (somewhat safer) filesystem.

This will destroy any data on the USB drive!

'mkdir /mnt/USB' (unless you already have a prefered mount point).
'mount /dev/sda1 /mnt/USB'

Now, you need to check to see if /dev/mmcblk0p is mounted as /boot or similar. If it is, unmount it with 'umount /dev/mmcblk0p1'
'cp -a /[a-ln-zA-Z] /mnt/USB' (This copies, whilst keeping all permissions intact, the whole of the root filesystem to the USB drive. It misses out any directories beginning with m as you don't want to copy /mnt/USB to /mnt/USB, could get rather sticky. If there are other directories starting with m, copy them separately.

Now the complete content of the SD card's system is copied to USB. The filesystem is the same, the content is the same, the location is the only thing to have changed. Remount /boot if it was unmounted earlier - 'mount /dev/mmcblk0p1' and make the changes to the boot/kernel configuration files. You also need to make sure you are using the USB friendly kernel. All this just preps the USB drive.

All of the above is off the top of my head, so please read carefully and make sure I've not been an utter plum and typed anything stupid. Worst comes to the worst, just reformat everything.

This may be what you've tried, but you said you'd copied the image files to USB. That doesn't make any sense if you mean *.img, or the debian*.img (or whatever you use to flash the SD), or if you treated the USB drive as you treated the SD card. All wrong.

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: booting of USB flash drive

Fri May 11, 2012 4:13 pm

Just to clarify a couple points - the filesystem ID you want for your USB drive is '83' if using fdisk under Linux to sort the drive out.

So you can ignore my above comments about 'fdisk /dev/mmcblk0p'

I've also just thought - copying /sys/ and /proc/ of a running system may do funny things. Not sure. One way to find out though.

You could just flash the Debian image straight to the USB drive and then point the kernel to /dev/sda2 in the boot options. But you'd need to then expand the partition of the USB pen drive and faff about in that direction. At least you wouldn't need to keep the swap partition on the pen drive though.

Return to “Beginners”