How to run linux from USB drive? - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HUKD, you accept our cookie and privacy policy.
Get the HUKD app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

How to run linux from USB drive?

Iom-RF Avatar
9y, 5m agoPosted 9 years, 5 months ago
Basically I need an Idiots guide to running Ubuntu/Xubuntu off a 1gb USB drive as I don't have a cd writer/dvd rewriter so can't burn off to disk, Thanks. :)
Iom-RF Avatar
9y, 5m agoPosted 9 years, 5 months ago
Options

All Comments

(16) Jump to unreadPost a comment
Comments/page:
#1
#2


Lol, Thanks Stora.

I've seen that before but wondering if there was an easier way!

I think i'll just fire up an old pc and buy some disks and swap the drive around!
4 Likes #4
Hi Iom-RF,

I wrote an article about this for my universities Wiki-unfortunately you cant view that,but here is the tutorial copy & paste style. Its nowhere near as complicated as ive made it seem out. Boot the Windows/Ubuntu CD (note i said CD) & install & run syslinux, then copy the ubuntu files to pen drive & move them around as instructed in the guide.

Also, you may wanna check out [url]www.pendrivelinux.com[/url]

Finally, i wouldnt recommend running Ubuntu from pen drive,its slow to boot up anyway,even slower from USB. Knoppix is allot more USB friendly and has save-state features so you dont lose all your work.

Lemme know if you get stuck anywhere.

Tutorial

For this tutorial, i will be using the Knoppix Linux Live distribution. You may use whichever distribution suits your tastes and needs, however, before we begin, beware that when i booted Ubuntu from my pendrive, it was very slow and unstable. Plus, the notoriously slow initial boot time of Ubuntu renders it unsuitable for pendrive booting in this writers opinion, in that you may be switching between Linux and Windows on a regular basis. Knoppix, on the other hand, ran much more smoothly for me, and features persistent image and save state functions that allow you to easily save and load your settings and files each time you boot. Choose whichever distribution you wish to use first, and then if it doesn't run all that well, try another, and add your experiences to the Compatibility Thread below. Ubuntu may work much more sucessfully for you than it did for me, so don't be afraid to try things that you think won't work.

Different sections of this tutorial can be completed in either Windows, or from the Ubuntu Live CD. Some sections are easier in Windows, and other in Linux, so if you get stuck, try loading Ubuntu carrying out the steps from there.

1. Ensure your pendrive has space to store your chosen OS, files and settings (100MB or so) plus any Windows files you may also want to store. Format your pendrive in FAT or FAT16. As usual, backup any important data, as it will be erased. Ensure that you are using a pendrive, and not a flash based MP3/MP4 player or similar, as formatting it may render it inoperable as a media playing device.

2. You can complete this step in either Windows or Linux-if you receive an error using Windows, then follow the steps for using Ubuntu. Ensure that you select your pendrive, and not your HDD(s)-to be extra safe, power down, remove any live cables (be safe), then earth yourself and unplug your HDD(s) and boot into Ubuntu, then theres no way of screwing them up. Don't forget to plug your HDD(s) back in. You don't need to carry out the steps twice, just once in your preffered OS:

Windows

Download the latest release of SYSLINUX and extract the contents to a folder named "syslinux" on the root of your C:\ drive. Hit Start>Run and enter "cmd" follwed by enter. The command prompt will open, displaying something like "C:\Documents and Settings\YOURNAME". enter "cd .." followed by enter a number of time until the command line reads "C:\". Type "cd syslinux" to jump to the syslinux folder. The command line should now read "C:\syslinux\". Enter "syslinux.exe X:" where X represents the drive letter of your pendrive. Make sure that you enter the correct drive letter, else you may screw up your Windows installation.

If this has been sucessful, carry on to the next step. If you have received an error message, ensure that you have selected the correct directory and that syslinux.exe is spelt correctly. Boot into Linux if you cannot get it to work.

Ubuntu Linux

Burn the Ubuntu Live Linux distribution to CD or DVD, and set your BIOS to boot from it. Using the Synaptic Package Manager (go to System>Administration>Synaptic package manager) install "mtools" and "syslinux". Then open a command prompt. type "sudo fdisk -l" to list the your drives. Your HDD's should show up as "hda" or similar, and your pendrive should appears as either "sda" or "sde". You can check by mounting and unmounting your pendrive through the command prompt and checking its status in the file browser. Mount or unmount the pendrive by entering "sudo umount /dev/YOURPENDRIVESNAME(e.g sda)" and "sudo mount /dev/YOURPENDRIVESNAME(e.g sda)". If your pendrive mounts and unmounts as you enter these commands, you can be sure that you have the correct device. Another method is to compare the size of your drives as displayed in the command prompt-your pendrive is probably considerably smaller than your HDD's.

Now, enter "cd ~" followed by enter and "sudo umount /dev/YOURPENDRIVESNAME(e.g sda)". The following command will install the bootloader on your pendrive: "syslinux /dev/YOURPENDRIVESNAME(e.g sda)".

3. Shut down your OS and reboot. Enter the BIOS by hitting Delete. Set the boot priority to boot from USB-HDD or USB-ZIP. Your pendrive should be listed somewhere in the text that appears as your PC boots, and your pendrives status LED should flash (if it has one). If it doesnt, reboot and/or remove and re-insert until it does. You should see the following message: "SYSLINUX 3.11 2005-09-02 EBIOS Copyright (C) 1994-2005 H. Peter Anvin Could not find kernel image: linux boot:". Congratulations-you've just made your pendrive bootable! If not, check to make sure that the file "ldlinux.sys" is present in the root-if it isn't, then you've done something wrong-format, and try again.

4. Boot into either Ubuntu (from the Live CD) or Windows, your choice. Now comes the fun part. Copy all of the files from your chosen distribution into the root of your pendrive.

5. Open the ".boot" or "boot" folder (one or the other depending on which distro you are intending to use) on the pendrive and copy all of the files and folders up one level into the root of your pendrive. You can now delete the ".boot" or "boot" folder-all of its contents however should be in the root directory. If your ".boot" or "boot" folder contains one solitary folder (for example, Knoppix contains one folder called "Isolinux" and then several files and folders beneath that one) then copy the contents of that folder to root instead. One of the files is called "isolinux.cfg" so if you are in the directory containing that file amongst a whole heap of others, then you are in the right place, so copy all of these files to root. You should have about twelve, but don't worry if you have a different figure, it's different for different flavours of Linux.

6. Rename "isolinux" to "syslinux", ensuring not to rename it to "syslinux.cfg"-it is already a .cfg file, so this will name it "syslinux.cfg.cfg", so just call it "syslinux".

7. Ensure that your BIOS is set to boot from USB and boot into Linux (your BIOS may say boot from CD, instaed of Boot from USB-this doesnt matter). If your machine skips straight to Windows switch off, remove the pendrive, switch on and immediately plug back in. Open a root shell by clicking the penguin icon. Enter "passwd". Knoppix will then ask you to enter a password, followed by enter. It will then ask you to repeat this. Keep a note of the password that you have used-you might be asked for it later.

8. Open a root shell and enter "mount -o remount,rw /cdrom" followed by "mount --bind /cdrom /media/YOURPENDRIVESNAME(e.g sda)". This allows us to write data to the pendrive (remember, Linux still thinks that we are booting from CD, so up until now it wouldn't let us write any data to the pendrive).

9. We are now going to save a persisent home image-this saves all of the data in your home directory as an image, and mounts it on the next boot. From the penguin icon, follow the steps to create a persistent image, and save it on your pendrive. Be patient whilst the image is created, and don't touch anything-Knoppix crashed a couple of times whilst creating my image when i tried to do other things whilst i waited, so just sit tight for a few minutes. Then set up a save configuration file, again from the penguin menu, and set it to save on the pendrive. When you shut down, you will need to save your configuration if you wish to keep system changes (e.g installed programs, wallpapers etc...) but you won't have to follow the persistent image walkthrough each time, that takes care of itself automatically.

10. Finally, boot back into Ubuntu Live CD or Windows (Ubuntu is recommended as Windows doesn't display the syslinux.cfg file correctly) and open the syslinux.cfg file. Change the number "300" at the top to "50". This sets the wait time to 5 seconds at the Knoppix menu, meaning that the OS will boot itself automatically and you can go and make a cup of tea. Add the following to the end of line 2: "noswap noeject noprompt dma home=scan myconfig=scan". Here's a little explanation of what each option does, courtesy of the Knoppix Wiki:

noswap
Security fix: assuming you're going to be using the USB key on a bunch of different computers you don't own, you don't want to be swapping your memory onto their hard drives.
noeject
You can't physically eject a USB key.
noprompt
Gets rid of the "remove CD and close drive door" prompt when shutting down, as this prompt is rather misleading when it's really a USB key instead.
dma
Gets you a significant speed increase when dealing with many IDE drives, a good thing to have.
home=scan
This will cause Knoppix to pick up your persistent home directory automatically the next time you boot up, asking you for the password as needed. You will get an extra menu during bootup, asking you if you want to mount your home directory or not.
myconfig=scan
This will cause Knoppix to pick up your configuration file automatically the next time you boot up.

Now when you boot, Knoppix will ask you what you want to do with the home image that its found-select the first option, and hit OK-if you don't select an option, the prompt will time out after thirty seconds, and no option will be selected.
#5
Andysan, That is one of the most helpful in depth posts I've seen on here for ages. :thumbsup: :-D Even I could understand that, well, most of it anyway. :p
Have some rep.:-D
#6
Blimey!, Thanks Andy!, That looks easy now! :thumbsup:

Repped you to, Great info!
#7
Thanks you guys, although that is all my own work most of the credit goes to the pioneers at pendrivelinux.com who did it first.

Now that i re-read it its quite confusing, to me at least, so to simplify a bit:

1.Format pendrive
2.Download live CD of your choice (Knoppix, Fedora, Ubuntu, SUse etc..)
3.Install Syslinux through either Windows or Ubuntu LiveCD
4.Set your BIOS to boot USB and chek that it attempts to boot from your pendrive
5.If it does, copy linux files to pendrive and reshuflle/rename as explained in earlier post.

If you guys need any more help/advice then give me a shout. This is only for Live distros though, not really a proper install, but if you use Knoppix you can save your settings and effectively have a proper install. its not an ideal situation by any means as you will probably understand when you use it, but it just about works. I'm waiting for somebody to release a proper USB install function in their distro that actually works, if they did everyone would go nuts for it!

Also, if you head over to http://portableapps.com/ you can install Windows apps into a suite on your pendrive, so when you use your pendrive in Windows you can run your favourite apps with your personal swttings dont have to wade through a mass of Linux system files. Finally, the above tutorial does not work well with USB-HDD's, not my USB-HDD at least, but feel free to try. Sorry, should have mentioned that earlier.

Many thanks for the rep.:thumbsup:
#8
Anyone got an up to date simple version of how to do this?

I have the universal USB installer and need the ISO but can't work out which actual one I need. Loads of 'em on the list.

Anyone?
banned#9
debian
#10
WOOOOOOW.

We have a winner on necroing a thread.

5 years and 11 months without a post, then boom, it's back.
banned#11
olympians
WOOOOOOW.

We have a winner on necroing a thread.

5 years and 11 months without a post, then boom, it's back.

is it me?
#12
"WOOOOOOW.

We have a winner on necroing a thread.

5 years and 11 months without a post, then boom, it's back."

****..
banned#13
idlebloke
"WOOOOOOW.

We have a winner on necroing a thread.

5 years and 11 months without a post, then boom, it's back."

****..

what's the prize?
#14
ewwaxo
idlebloke
"WOOOOOOW.We have a winner on necroing a thread.5 years and 11 months without a post, then boom, it's back."****..
what's the prize?

All expenses paid trip to nottingham!!!!
#15
Which version are you installing?
banned#16
idlebloke
Anyone got an up to date simple version of how to do this?

I have the universal USB installer and need the ISO but can't work out which actual one I need. Loads of 'em on the list.

Anyone?

http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/

Use that

And congratulations on bumping a thread older than Jimmy Saville's girlfriends.

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!