How to boot Ubuntu Hardy Heron from a USB drive and have it save your changes!

simonrichards150
05-08-2008, 04:49 PM
This tutorial is for booting Ubuntu from a USB drive.

Disclaimer:
I am not responsible for any damage you may do to anything in any way.

Ingredients:

1. USB Flash drive (min 1GB)
2. Ubuntu 8.04 Live CD
3. Computer capable of booting from USB

Also, while you should be able to just follow this guide from beginning to end, its better if you have some experience with command line, linux device listing etc before attempting this.

I am using a Sandisk Cruzer Micro 2GB & Ubuntu 8.04
http://cdn.overstock.com/images/products/P10791919.jpg

Step 1.1:

Obtain the Ubuntu Live CD image from ubuntu.com

http://www.ubuntu.com/getubuntu/download

Step 1.2:

Burn the CD and boot from it.

If you already have an ubuntu installation, just boot into that. You will still need the Live CD.

Step 2:

BACKUP ALL THE DATA FROM YOUR USB DRIVE

Boot into Ubuntu (if you haven't already).

In Ubuntu, enter the 'Applications' menu, and open 'Accessories', and select 'Terminal'.

Type "sudo -i"

Type "fdisk -l"

Identify which device is your flash drive and make a note of it. It will be something like /dev/sdb1.

Here, mine is identified as /dev/sdb1 & /dev/sdb2

http://www.upload3r.com/serve/090508/1210289113.png

You will need to replace the sdb part with whatever yours shows up as, it will be sdx from now on, replace the x with the letter you are shown.

Step 3:

Type "fdisk /dev/sdx"

Type "p" to show the partition on the disk, and type "d" to delete it.
Repeat if you have any other partitions on the disk.

Type "n" to make a new partition.

Type "p" for primary partition.

Type "1" to make it the first partition.

Press Enter to use the default start cylinder.

Type "+755M" to set the partition size.

Type "a" to make the partition active.

Type "1" to select partition 1.

Type "t" to change the partition filesystem.

Type "6" to select the Fat16 filesystem.

Type "n" to make another new partition.

Type "p" for primary partition.

Type "2" to make it the second partition.

Press Enter to use the default start cylinder.

Press Enter again to use the default last cylinder.

Type "w" to write the changes to the disk.

Step 4:

Type "umount /dev/sdx1", then "umount /dev/sdx2".

Type "mkfs.vfat -F 16 -n Ubuntu /dev/sdx1". This formats the first partition.

Type "mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2", to format the second partition.

Exit Terminal, then unplug your USB drive.

Step 5:

Insert the USB drive again.

Open Terminal.

Type "sudo -i"

Type "apt-get update"

Type "apt-get install mtools syslinux"

Type "syslinux -sf /dev/sdx1"

Type "cd /cdrom"

Type "cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz /media/Ubuntu/".

Go to the first partition of the USB drive and delete isolinux.cfg.

Place this file in the first partition:

http://rapidshare.com/files/113739245/syslinux.cfg.html
(download)

Replace "initrd.gz" in the first partition with this one:

http://www.megaupload.com/?d=ZVC28QL7
http://rapidshare.com/files/113566398/initrd.gz.html
(download and replace)

You're done!

Now boot from your USB drive and enjoy!

Select "Start Ubuntu in persistent mode" so that it saves your changes!

Couple of screenshots:

http://www.upload3r.com/serve/090508/1210291731.png
http://www.upload3r.com/serve/090508/1210291799.png

I got my theme from here:
http://kims-area.com/?q=node/25

And my wallpaper from here:
https://wiki.ubuntu.com/Artwork/Incoming/Hardy/Alternate/Dark_Herdy_Wallpaper

If you have any problems just post here and ill help!

YouTouch
05-08-2008, 10:41 PM
Will this wreak or destroy memory on your flash drive?

simonrichards150
05-09-2008, 10:54 AM
Will this wreak or destroy memory on your flash drive?

Absolutely not. You can just format the flash drive back to the way it was! :D

YouTouch
05-09-2008, 04:46 PM
Absolutely not. You can just format the flash drive back to the way it was! :D

and how would this be done?

simonrichards150
05-09-2008, 04:59 PM
and how would this be done?

Well, assuming you had only one partition, using up all the space on the drive, then you would do this:

open terminal

type sudo -i

type fdisk -l to find out what letter to use in the place of x

type fdisk /dev/sdx (replacing x with whatever letter you need to)

type p to list the partitions

type d then 1 to delete the first partition

that might delete both, find out by typing p again. if it has no partitions then go to the next instruction but if the other partition is still listed type d again to delete it.

type n to create a new partition

type p

type 1

hit enter twice

type t

type 6

type w to write the changes to disk

type umount /dev/sdx1

type mkfs.vfat -F 16 -n Disk /dev/sdx1 (where Disk is the label)

And thats it!

Teslanaut
05-24-2008, 01:41 PM
Why not just use Fedora 9? It installs much easier :)

simonrichards150
05-24-2008, 01:46 PM
Why not just use Fedora 9? It installs much easier :)

People like ubuntu :D

And the damn fedora usb maker thing didnt work for me (in windows). So meh. :p

Abcmsaj
05-25-2008, 06:05 PM
Can't balls up my computer if I boot from CD can it?
I've always wanted to try Linux..

simonrichards150
05-25-2008, 06:07 PM
Can't balls up my computer if I boot from CD can it?
I've always wanted to try Linux..

If it's a live CD then it doesnt do any harm whatsoever :)

Abcmsaj
05-25-2008, 06:11 PM
If it's a live CD then it doesnt do any harm whatsoever :)

Wahooo.
Which version?
Desktop or System?

simonrichards150
05-25-2008, 06:12 PM
Wahooo.
Which version?
Desktop or System?

Do you mean Desktop or Server?

Desktop. Server is text based. So get Desktop.

Abcmsaj
05-25-2008, 06:21 PM
Do you mean Desktop or Server?

Desktop. Server is text based. So get Desktop.

I mightve meant that :p

Thank you. I'll let it download now through the night and try this tomorrow

-Subcribes to thread- :)

simonrichards150
05-25-2008, 06:31 PM
I mightve meant that :p

Thank you. I'll let it download now through the night and try this tomorrow

-Subcribes to thread- :)

I wish you luck. :) Linux is a bit weird when youre not used to it but when you get it its easy :D

Anyway I wont be here until wednesday at the earliest so I wont be able to help with anything till then :p

Drew90
05-25-2008, 06:39 PM
This is so cool! I will try it when I get home. Thanks for the Tut!

simonrichards150
05-25-2008, 06:42 PM
This is so cool! I will try it when I get home. Thanks for the Tut!

Why you are very welcome! Let us all know how it goes for you :D

Drew90
05-29-2008, 03:52 PM
When typing "fdisk /dev/sdh" I am prompted with this. (See attachment)

I saw on your screenshot that your USB drive had 991 cylinders while mine has 3981 cylinders. Will this mess anything up?

By the way I am using the same USB drive.

simonrichards150
05-29-2008, 04:11 PM
When typing "fdisk /dev/sdh" I am prompted with this. (See attachment)

I saw on your screenshot that your USB drive had 991 cylinders while mine has 3981 cylinders. Will this mess anything up?

By the way I am using the same USB drive.

Its fine, you can continue as normal, and if anything does go wrong you can just start again, you can't make your USB drive unusable using my method.

Drew90
05-29-2008, 04:17 PM
Just making sure. Thanks for the quick response.

Drew90
05-29-2008, 04:50 PM
I am in the first partition of the drive but I don't see isolinux.cfg

I keep getting errors in the terminal. (See attachment)

simonrichards150
05-29-2008, 04:56 PM
I am in the first partition of the drive but I don't see isolinux.cfg

I keep getting errors in the terminal. (See attachment)

Those stat and symbolic link errors are ok.

I notice the previous command gave an error because you are ubuntu not root

Did you sudo -i as it says near the beginning of the tutorial?

If you close the terminal you need to sudo -i again, perhaps I should put that in the tutorial.../

Drew90
05-29-2008, 04:59 PM
I did at the beginning -- but not after opening the terminal a second time.

Do I have to start all over or can I close the terminal and start after opening the terminal a second time at "sudo apt-get update"?

simonrichards150
05-29-2008, 05:05 PM
facepalm.jpg

I see what I did now, I left out a command on step 5 but it worked for me as I am always root on my particular installation.

I changed step 5, you should be able to just go from step 5 :)

Drew90
05-29-2008, 05:07 PM
Thanks.

I will let you know how the rest goes.

Drew90
05-29-2008, 05:27 PM
While replacing "initrd.gz" I get an error because I do not have enough disk space.

Can I delete something or do I have to resize the partition?

simonrichards150
05-29-2008, 05:30 PM
Argh

That happened to me the fourth or fifth time I did this... Im not sure what causes it so I just started again and its not happened again.

Drew90
05-29-2008, 05:38 PM
Thats what I did anyway. About half way through now.

It is weird because the partition was set at +750M but it reads at 715.

simonrichards150
05-29-2008, 05:41 PM
Thats what I did anyway. About half way through now.

It is weird because the partition was set at +750M but it reads at 715.

I think that space is normal for a FAT filesystem but its something else i just cant put my finger on causing the no space error

Drew90
05-29-2008, 05:54 PM
Hmm...same error. Any ideas?

EDIT: I had to empty the trash bin and that gave me enough file space.

simonrichards150
05-29-2008, 06:06 PM
Try giving it +760M instead of +750M

Drew90
05-29-2008, 06:23 PM
I changed the BIOS sequence and now the USB drive won't boot. Any ideas?

simonrichards150
05-29-2008, 06:32 PM
Does your BIOS support USB booting for definite?

What order do you now have for boot sequence/what options are there?

Has the drive booted successfully before? If it has you may need to unplug it and replug between boots.

Drew90
05-29-2008, 06:43 PM
My computer supports USB booting.

1. USB Device
2. Hard Drive
3. Onboard or USB CD-ROM Drive
4. Floppy Drive (not present)
5. Network Controller (not present)

I haven't successfully booted it -- other than the live cd.

I will try unplugging it then rebooting.

Drew90
05-29-2008, 07:02 PM
Works perfectly!

I don't know what the deal was before -- but it is working fine now after a couple of reboots.

I would rep you -- but it is gone. :(

Where do you put the file for themes after you extract them?

simonrichards150
05-29-2008, 07:04 PM
Works perfectly!

I don't know what the deal was before -- but it is working fine now after a couple of reboots.

I would rep you -- but it is gone. :(

Where do you put the file for themes after you extract them?

Oh lovely :D

The themes you need to download the file and then use the theme browser within ubuntu to select the file and import it and then it will appear in the theme list and you can select it.

user0
05-31-2008, 12:40 AM
Is there any way to get this working with a 2048-bit compatible bootloader like extlinux or GRUB? My 4GB flash drive uses 2048 bit blocks, which sucks, because I can't use syslinux, can't use gparted, and can't use anything else that expects 512 byte blocks.

bluX
05-31-2008, 11:09 AM
Helped alot.

Abcmsaj
06-01-2008, 10:53 AM
finally downloaded the iso - and now I'm gonna balls up the Terminal bit.. I can see it coming.
Never used MS DOS or Terminal before XD

simonrichards150
06-02-2008, 03:15 PM
finally downloaded the iso - and now I'm gonna balls up the Terminal bit.. I can see it coming.
Never used MS DOS or Terminal before XD

Be not afraid of the Terminal...It will be OK :D

xD

BTW Theres no MS-DOS here :p

Is there any way to get this working with a 2048-bit compatible bootloader like extlinux or GRUB? My 4GB flash drive uses 2048 bit blocks, which sucks, because I can't use syslinux, can't use gparted, and can't use anything else that expects 512 byte blocks.

I have no idea, sorry, but that would seem to be a major problem with no easy fix. That I know of, anyway.

Helped alot.

Great!

Abcmsaj
06-02-2008, 03:59 PM
Be not afraid of the Terminal...It will be OK :D

xD

BTW Theres no MS-DOS here :p






Couldn't get the CD to boot.
There's a thread about it on the Linux section.
And it wrecked my Firefox coz I mustve shut down badly :\

vanden9
06-02-2008, 04:03 PM
Is there any way to get this working with a 2048-bit compatible bootloader like extlinux or GRUB? My 4GB flash drive uses 2048 bit blocks, which sucks, because I can't use syslinux, can't use gparted, and can't use anything else that expects 512 byte blocks.
You be better off getting a cheap 1 gb flash drive and using that to boot linux.

Led
06-10-2008, 02:30 PM
Hi, I'm burning the image right now, got the exact flash drive and have a couple of questions:

1) If you create like a open office document or something else, will it save to the flash drive or will is save somewhere on the hard drive?

2) Is there some way to auto boot into persistent mode?

EDIT: Nevermind, I followed a guide on pendrivelinux.com which essitially is the same thing as this and completed it in about 30 minutes. Worked perfectly and it saves changes and stuff. It isn't the full install, just the live cd which disapointed. Linux is pretty confusing though

ethan961
06-13-2008, 10:02 PM
Why not use fedora 9? FEDORA is Fail. Freak Enviroment for Dorks Or Rabid Animals :P :P

But seriously. I used it for a week to review for my linux podcast, and things didnt go over too smooth.
However, there is some really cool stuff in there, ie. upstart, 1 second X, and all that funky stuff.

In all, the masses should stick to ubuntu, or Arch, my distro :) :P

justinede
06-21-2008, 12:38 AM
whats the advantages of Ubuntuto windows?

simonrichards150
06-21-2008, 07:33 AM
whats the advantages of Ubuntuto windows?

well in this case it means you can take your environment with you, which you cant do with windows. Other than that, and the fact it is totally open source and also great for servers, it is just... Different. It suits some people better than others. But it is always worth a try. :)

frightenedcow
06-26-2008, 11:59 AM
what program is this that you speak of? What does it do?

simonrichards150
06-26-2008, 12:01 PM
what program is this that you speak of? What does it do?

It is an alternative OS, like Windows or OSX, but different.

This will give you a better idea of what it is:

http://en.wikipedia.org/wiki/Ubuntu

And this

www.ubuntu.com

tylobedo
08-29-2008, 08:26 PM
NICE!!! can you make a tutorial to edit your bios to boot from usb? cuz i doubt my school will have it set to usb first >_>

dima the great
08-31-2008, 01:58 AM
NICE!!! can you make a tutorial to edit your bios to boot from usb? cuz i doubt my school will have it set to usb first >_>

Go to http://www.pendrivelinux.com there's a guide there on setting boot priorities.

Chicken
09-12-2008, 10:45 AM
im not encouraging this and i'm not going to do it as it would be highly illegal if even possible but would it be possible to do the same with osx ??????? just a thought while i was reading

I'm gunna see what linux is like and try this thank god it wont mess up hard drive and it shouldn't mess up pen drive!!!!!

ur_so_beautiful
09-12-2008, 11:23 AM
So i can do all this on my home computer, shove it on a USB Memory Stick and open up Linux in School or on a relative's/friend's computer or something? I don't have to do it ALL on the School/Friend's computer, will i? Will appreciate a reply :)

simonrichards150
09-12-2008, 11:27 AM
So i can do all this on my home computer, shove it on a USB Memory Stick and open up Linux in School or on a relative's/friend's computer or something? I don't have to do it ALL on the School/Friend's computer, will i? Will appreciate a reply :)

You do this once, and then you can boot into linux straight away from the USB drive, providing USB booting is enabled for that particular PC. :)

ur_so_beautiful
09-12-2008, 11:35 AM
You do this once, and then you can boot into linux straight away from the USB drive, providing USB booting is enabled for that particular PC. :)
Awesome. And I won't need to enter all the Terminal Commands again?

simonrichards150
09-12-2008, 11:37 AM
Awesome. And I won't need to enter all the Terminal Commands again?

Nope.

ur_so_beautiful
09-12-2008, 11:41 AM
Nope.
Awesome thanks for the quick reply. Thanks :P

EDIT: Can i put this on more than one USB Memory Stick?

simonrichards150
09-12-2008, 11:47 AM
Awesome thanks for the quick reply. Thanks :P

EDIT: Can i put this on more than one USB Memory Stick?

You can do it as many times as you like, but you can't use multiple USB sticks for a single installation.

ur_so_beautiful
09-12-2008, 11:49 AM
You can do it as many times as you like, but you can't use multiple USB sticks for a single installation.
Oh right so I can't just 'copy & paste' the Linux thing onto another memory stick? Cool thanks again :D

simonrichards150
09-12-2008, 11:51 AM
Oh right so I can't just 'copy & paste' the Linux thing onto another memory stick? Cool thanks again :D

what I mean is...you can't use multiple sticks to create more space, the other sticks will just show up as removable drives.

ur_so_beautiful
09-16-2008, 11:35 AM
Hey i'm back again i just would like a clarification that this doesn't do anything to your current Windows OS does it? I'll still be able to boot into Windows XP like normal. As in the Ubuntu iso won't install and wipe my drive or nothing? I don't need to back up anything on my harddrive, do i?

simonrichards150
09-16-2008, 11:41 AM
Hey i'm back again i just would like a clarification that this doesn't do anything to your current Windows OS does it? I'll still be able to boot into Windows XP like normal. As in the Ubuntu iso won't install and wipe my drive or nothing? I don't need to back up anything on my harddrive, do i?

Nothing will happen to your windows installation if you follow my directions correctly. :)

If you do it right, if the USB drive isn't plugged in, it will boot to XP, and if it is plugged in it will boot into Ubuntu.

ur_so_beautiful
09-16-2008, 11:44 AM
Nothing will happen to your windows installation if you follow my directions correctly. :)

If you do it right, if the USB drive isn't plugged in, it will boot to XP, and if it is plugged in it will boot into Ubuntu.
Sweet thanks for the quick reply I would +rep you if the function was still here lol

So when i go onto a different computer, when it is turned off i can plug the USB Memory Stick in, switch the PC on and it'll boot up using Ubuntu? SWEET lol. But I can still edit the contents on the USB Memory stick after i've booted up in Windows. It won't reboot my PC and then say 'Running Ubuntu' or nothing lol. thanks this is really usefull :D

stuartw
09-16-2008, 11:47 AM
I thought this was common knowledge

simonrichards150
09-16-2008, 11:51 AM
I thought this was common knowledge

What exactly? That you can boot Ubuntu from a USB drive?

Well, it isn't. :p Most people don't even know what linux is.

stuartw
09-16-2008, 11:52 AM
Yea exactly! lol. Well i spose this is a very good thread for those that do not know. afterall it has had a lot of views

stevenplanet
10-07-2008, 08:10 PM
Dude, but then sudo command will destroy the partition magic of Norton 360! Then the user will be unable to execute command 755...

decg
10-15-2008, 03:38 PM
Hey everyone, great How-To Guide, im just having a problem with "apt-get update"
Terminal says it cant retrieve such a such file from http:// bla bla bla.ubuntu.com
Can anyone lend me a hand ? is it because im not connected to the internet using the LiveCD?
Thanks DG

simonrichards150
10-15-2008, 03:48 PM
Hey everyone, great How-To Guide, im just having a problem with "apt-get update"
Terminal says it cant retrieve such a such file from http:// bla bla bla.ubuntu.com
Can anyone lend me a hand ? is it because im not connected to the internet using the LiveCD?
Thanks DG

Yes, you need an internet connection to do this.

decg
10-15-2008, 04:03 PM
ok then but how do I connect to Internet through the live cd ?

simonrichards150
10-15-2008, 04:07 PM
ok then but how do I connect to Internet through the live cd ?

If you have a wireless card, you should be able to connect by clicking on the icon on the top right of the screen, the one that looks like a computer.

decg
10-15-2008, 04:15 PM
If you have a wireless card, you should be able to connect by clicking on the icon on the top right of the screen, the one that looks like a computer.

Sorry i just realised my screen res wasnt set up right so i couldnt see the network connection in the task bar.
New monitor so i put the old one's res in...
im now in the last steps of installation i'll let ya know how it goes.

simonrichards150
10-15-2008, 04:17 PM
Sorry i just realised my screen res wasnt set up right so i couldnt see the network connection in the task bar.
New monitor so i put the old one's res in...
im now in the last steps of installation i'll let ya know how it goes.

Great :)

decg
10-15-2008, 04:22 PM
Great :)

Hey, whats the first partition ? i cant find it...
i have one under the name of the USB stick im using, and one under "casper-rw"
??

EDIT:: Forget that, i didnt wait long enough for the command to finish...

++ all Finished, eveyrthing works prefectly Thanks =)

Ex-Touch
10-21-2008, 05:02 AM
Ubuntu is my favorite distro. Although, I never tried this because I never though my 2GB was good enough.

iPhoneFTW
10-21-2008, 08:59 AM
Can this be done a Mac? I doubt it but meh.

Sorry is this has already been asked

simonrichards150
10-21-2008, 09:30 AM
Can this be done a Mac? I doubt it but meh.

Sorry is this has already been asked

I don't know, you would need a Mac person to answer that, the method should work, it just depends if Macs will boot from USB.

Ex-Touch
10-21-2008, 03:25 PM
Whelp, about to take the plunge. Should I have the live CD in my CD-Rom drive from the start?

simonrichards150
10-21-2008, 08:07 PM
Whelp, about to take the plunge. Should I have the live CD in my CD-Rom drive from the start?

If you have ubuntu installed on your hard drive, you should insert the CD when the system has booted, just to be sure you aren't booting from the CD by accident, and if you don't have it installed, you need the CD in in order to boot from it :p

Ex-Touch
10-22-2008, 04:34 AM
I have it dual booted. I didn't want to do it last night because my dad came home early. (He doesn't know there's Ubuntu on the comp, lol)

Pwnage Productions
11-02-2008, 10:20 AM
I have it dual booted. I didn't want to do it last night because my dad came home early. (He doesn't know there's Ubuntu on the comp, lol)

lol, if my dad knew i had ubuntu hed think i was a hacker or something:p

Ex-Touch
11-02-2008, 01:26 PM
Haha. My dad just doesn't want it.

Schmilk
11-02-2008, 02:13 PM
nice tutorial, I will use either this or fedora
------------------double post merged------------------
hi, how can I identify the name of my flash drive? PM me

Schmilk
11-04-2008, 04:27 PM
Type "+755M" to set the partition size.
Can I make this bigger? I'm on a 2GB flash. Do I need to make it bigger?

simonrichards150
11-04-2008, 04:57 PM
Can I make this bagger? I'm on a 2GB flash. Do I need to make it bigger?

Ah, now your PM makes sense! :p

Just leave that as it is, you will use 755MB for the OS, and the rest of the space will be your user space for apps you install/your documents etc.

Schmilk
11-04-2008, 05:06 PM
Ah, now your PM makes sense! :p

Just leave that as it is, you will use 755MB for the OS, and the rest of the space will be your user space for apps you install/your documents etc.

haha okay thanks, also, can I use ubuntu 8.10?

simonrichards150
11-04-2008, 05:08 PM
haha okay thanks, also, can I use ubuntu 8.10?

You sure can!

Schmilk
11-04-2008, 05:52 PM
You sure can!

Sweet! I have the desktop edition, it will work right?

simonrichards150
11-04-2008, 05:53 PM
Sweet! I have the desktop edition, it will work right?

Yes it will!

Schmilk
11-04-2008, 05:56 PM
Yes it will!

okay thanks so much!

Schmilk
11-05-2008, 08:07 PM
ahhh look!, i was on the last part too :(

this came up:
cp: cannot stat `casper': No such file or directory
cp: cannot stat `disctree': No such file or directory
cp: cannot stat `dists': No such file or directory
cp: cannot stat `install': No such file or directory
cp: cannot stat `pics': No such file or directory
cp: cannot stat `pool': No such file or directory
cp: cannot stat `preseed': No such file or directory
cp: cannot stat `.disk': No such file or directory
cp: cannot stat `isolinux/*': No such file or directory
cp: cannot stat `md5sum.txtREADME.diskdefines': No such file or directory
cp: cannot stat `ubuntu.ico': No such file or directory
cp: cannot stat `casper/vmlinuz': No such file or directory
cp: cannot stat `casper/initrd.gz': No such file or directory
------------------double post merged------------------
never mind I think I got it!
------------------double post merged------------------
after I type the last line:
cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz /media/Ubuntu/
noting happens, should i just wait?
------------------double post merged------------------
can someone please upload the "intrid.gz" file that goes in the casper folder? I accenttly deleted it!! :(