[SOLVED] Questions about making a bootable USB flashdrive
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Startup Disk Creator is used to create a bootable Live installation CD on a flash drive and it is not an installed system. The purpose of it is to have a Live CD you can use to test whichever Linux you are using as well as to use it to actually install to another hard drive or flash drive. No, Startup Disk creator is not a full install.
Thanks yancek. But I used Startup Disk Creator yesterday and put Bodhi onto a machine and it then gave me the option to install it, which I did.
Quote:
Originally Posted by yancek
Persistence lets you save some data and changes to your flash drive as pointed out above. If you use a FAT32 formatted flash drive to put your Xubuntu on it, then your persistence file is limited to 4GB. You can create a persistent 'partition' that is larger using a Linux filesystem.
Good to know. But my primary concern is just installing the OS permanently. If I ever get into using the bootable as a thing I use over and over I'll use Linux filesystems instead of FAT32.
Quote:
Originally Posted by yancek
Never heard of mkusa but there is software called "mkusb" which creates a bootable flash drive of Ubuntu with persistence and also with the first partition on it as ntfs so you can use it to have data accessible from Linux or windows. If you want to try it, the link below has instruction on how to get it and how to use.
If you want to simply install to a flash drive, you can do that either with another bootable flash drive or with a DVD. If you expect to use it on multiple computers, don't install any proprietary software such as graphics drivers.
"mkusa" was a typo. Sorry. It is "mkusb." Thanks for the link, and yeah, I do want to try it because it supposedly takes the risk out of the "dd" way of doing it (and wiping out the wrong drive), but still it seemed pretty complicated.
yanecek said was I was going to say. "Startup Disk Creator is used to create a bootable Live installation CD on a flash drive and it is not an installed system."
Once your computer boots to the USB, you can choose to install, make changes to the filesystem on the hard drive in the computer, or just test/play in the live image.
Thanks erik. So what's the difference really? It sounds like Starup Disk Creator gives the option of using the bootable flash drive over and over and over (because it makes it with "persistence") or you can just test the OS or you can install it permanently. It seems ideal.
Quote:
Originally Posted by erik2282
Personally, I use the dd command in a terminal when making bootable USB's.
you have to be ABSOLUTELY sure that /dev/sdb is your flash drive, if you get this part wrong, you can overwrite the wrong hard drive. use this with caution.
Thanks for the tutorial and your example. (Examples really help.) I'll do it in the terminal one day but for now as you say...
and don't assume that if fdisk -l shows the usb as being /dev/sdb or what ever it happens to be that it will be the same on a reboot, especially if you leave the usb in during the reboot. Always run fdisk -l before using dd to make sure the dev naming of the usb hasn't changed.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Rep:
Quote:
Originally Posted by colorpurple21859
and don't assume that if fdisk -l shows the usb as being /dev/sdb
+1
Agreed, and just to be clear, /dev/sdb just happened to be the flash drive I was using when I ran that command. Anyone else's can be something different.
and don't assume that if fdisk -l shows the usb as being /dev/sdb or what ever it happens to be that it will be the same on a reboot, especially if you leave the usb in during the reboot. Always run fdisk -l before using dd to make sure the dev naming of the usb hasn't changed.
Thanks colorpurple. You know, I have a hard time figuring out what's what in the terminal. I do stuff there but I'm always using 'pwd' to figure out where the heck I am. And figuring out which drive is which sounds a little dicey.
I'm not sure what you're saying though. So you make sure you have the correct drive when you use DD in the terminal to make your bootable USB flash drive. Then you stick it in the target computer and boot up (or reboot if the USB flash drive is made in the same computer). So let's say you make the USB flash drive in the same computer. So, when am I re-checking fdisk -l again to make sure the dev naming of the usb drive hasn't changed? (And actually I foresee using the USB bootable flashdrive in a different computer and just booting up. Is there a risk to doing it that way? Would I need to be running fdisk -l again then too?)
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Rep:
So you can see an example, take a look at mine.
Below you can see that under Device it has the 3 /dev/sda's. In my case, on this particular computer, my hard drive is /dev/sda. The sda1, sda2, and sda5 are partitions that divide the hard drive. But the drive as a whole is called sda, or /dev/sda using the whole path.
Code:
root@mycomputer:~# fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3636cf13
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 937195519 937193472 446.9G 83 Linux
/dev/sda2 937197566 976771071 39573506 18.9G 5 Extended
/dev/sda5 937197568 976771071 39573504 18.9G 82 Linux swap / Solaris
Now, if i stick a USB drive in and re-run fdisk -l, I can tell which is my USB drive because its the new one that wasn't there before. At the bottom of the code below, you will see /dev/sdb1. So my flash drive here is /dev/sdb. sdb is the whole flash drive and sdb1 is a partition on the flash drive.
Code:
root@mycomputer:~# fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3636cf13
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 937195519 937193472 446.9G 83 Linux
/dev/sda2 937197566 976771071 39573506 18.9G 5 Extended
/dev/sda5 937197568 976771071 39573504 18.9G 82 Linux swap / Solaris
Disk /dev/sdb: 7.5 GiB, 8023703552 bytes, 15671296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5f3728a2
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 2493567 2493504 1.2G 17 Hidden HPFS/NTFS
Below you can see that under Device it has the 3 /dev/sda's. In my case, on this particular computer, my hard drive is /dev/sda. The sda1, sda2, and sda5 are partitions that divide the hard drive. But the drive as a whole is called sda, or /dev/sda using the whole path.
Code:
root@mycomputer:~# fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3636cf13
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 937195519 937193472 446.9G 83 Linux
/dev/sda2 937197566 976771071 39573506 18.9G 5 Extended
/dev/sda5 937197568 976771071 39573504 18.9G 82 Linux swap / Solaris
Now, if i stick a USB drive in
Did you mean to say "Now, if i stick another USB drive in...?
Quote:
Originally Posted by erik2282
and re-run fdisk -l, I can tell which is my USB drive because its the new one that wasn't there before. At the bottom of the code below, you will see /dev/sdb1. So my flash drive here is /dev/sdb. sdb is the whole flash drive and sdb1 is a partition on the flash drive.
Code:
root@mycomputer:~# fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3636cf13
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 937195519 937193472 446.9G 83 Linux
/dev/sda2 937197566 976771071 39573506 18.9G 5 Extended
/dev/sda5 937197568 976771071 39573504 18.9G 82 Linux swap / Solaris
Disk /dev/sdb: 7.5 GiB, 8023703552 bytes, 15671296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5f3728a2
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 2493567 2493504 1.2G 17 Hidden HPFS/NTFS
Thanks a lot, Eric. What I'm wondering is, Is the potential confusion having two USB flash drives in there at the same time and getting them confused? Because it seems to me there's no possibility of confusion in your first example because of the USB flash drive being so much smaller than the other two drives. (That's why I asked if you meant 'another' usb drive.)
I was testing things. I did the f disk -l thing and then abandoned it. Then I came back to try to follow your example (and I just left the USB flash drive in there all along) and lo and behold my results looked similar to yours.
Code:
fun@fun-OptiPlex-170L:~$ sudo su
[sudo] password for fun:
root@fun-OptiPlex-170L:/home/fun# cd ..
root@fun-OptiPlex-170L:/home# cd ..
root@fun-OptiPlex-170L:/# pwd
/
root@fun-OptiPlex-170L:/# fdisk -l
Disk /dev/sda: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders, total 78125000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00040bb1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 75769855 37883904 83 Linux
/dev/sda2 75771902 78123007 1175553 5 Extended
/dev/sda5 75771904 78123007 1175552 82 Linux swap / Solaris
Disk /dev/sdb: 7748 MB, 7748222976 bytes
247 heads, 9 sectors/track, 6807 cylinders, total 15133248 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe4c3ce52
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 15132671 7565312 b W95 FAT32
root@fun-OptiPlex-170L:/#
So is the lesson here to always check the status of the USB flash drive before doing the DD operation? For instance, if I'd've been in a hurry (in my example) I could've had my USB drive in the command as "sda" instead of "sdb." But really, even if that were the case, what would that do that would be so terrible?
After I DD an iso to a usb I will usually reboot my laptop and make sure the usb will boot before usinig the usb on another computer. if the usb doesn't boot or there is something about the iso that is on the usb I don't like, I usually just reboot dd a different iso and check again. I've been doing this for serveral years on this laptop without incident. About two months ago I was checking out some distos, loaded the usb reboot check out the iso, reboot loaded another iso. That is when the fun began. On the reboot the usb became sda and my harddrive became sdb. The next thing I realize is the usb light isn't blinking like it normally does and the hard drive light is blinking away. Thank goodness it only acutually wrote over the first part of my harddrive where windows was installed. I was able to salavage the windows recovery partition and the linux partitions using testdisk.
For instance, if I'd've been in a hurry (in my example) I could've had my USB drive in the command as "sda" instead of "sdb." But really, even if that were the case, what would that do that would be so terrible?
From the fdisk output you posted above, it shows a 40GB hard drive as sda and an 8GB flash drive as sdb. If you had used the dd command to create a bootable iso and written it to sda (40GB) drive, it would have completely destroyed and overwritten everything on the 40GB drive. Although it might be possible to recover some of the data on that drive, for a new user it would be extremely problematic.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Rep:
Quote:
Originally Posted by Gregg Bell
Did you mean to say "Now, if i stick another USB drive in...?
No. Im only talking about one USB drive. The dd will copy from source to destination, block by block. In my example I copied a .iso file that was in my Downloads folder in sda to the usb drive, sdb.
Quote:
Originally Posted by Gregg Bell
Is the potential confusion having two USB flash drives in there at the same time and getting them confused?
If you had more than one usb drive then yes, that would be a potential confusion. But if you only have one usb drive then you can get confused by putting sda where sdb should be, or sdc, sdd, or however many drives you have mounted.
Then my primary hard drive (sda) would have been overwritten and unusable. Then I'd have to reinstall my OS and have complete data loss, unless of course you have backups.
source and destination is like this:
dd if=source/of/iso of=/destinantion/of/media
if you wanted to clone a usb to usb, then, for example:
Code:
dd if=/dev/sdb of=/dev/sdc bs=32M
this would make a block by block copy from sbd to sdc. sdc would be exactly like sdb. and just to reiterate, those are examples. Always triple check that you are using the correct path when using dd.
If you want to do this I'd suggest practicing on a computer that, in case you mess up, its no big deal to reinstall. Please don't test on your running system and risk losing data for the sake of practicing the dd command. For now use the GUI tools and if you have another machine, test/play on that one. my two cents.
A full installation onto a flash drive is a 2-step, 2-flash drive process. You need a small flash drive (looks like at least 2GB for Xubuntu) for the bootable iso image, and a larger flash drive (realistically 8 GB or larger; I've installed Lubuntu on a 4GB drive, but it was tight)
Step 1: Make a bootable iso image, just as you normally would on the small flash drive. Don't worry about persistence - it doesn't matter here one way or the other.
Step 2: Boot from the small flash drive, plug in the larger flash drive, and select the Install icon. Select the large flash drive (rather than your system's internal hard drive) as the installation target and install as you otherwise normally would. Make sure you install the bootloader to the larger flash drive
Step 3: The installation is done - there is no step 3. You should now have a bootable, full installation of your favorite distro on the large flash drive.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Rep:
Greg, I just reread all your posts after reading rockdoctor's post. I didnt realize you wanted an actual install, not live image, on a flash drive. Sorry about that. Anyway, my steps are correct to make the bootable USB, but then follow RockDoctor's steps to boot to it and install on the other drive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.