How to fully install Ubuntu on USB Flashdrive? [duplicate]
Rather than to install dual-OS on my laptop, I would like to install Ubuntu on my flashdrive (USB flash memory, or whatever you call it). So, whenever I want to run my Ubuntu, I will just plug my flashdrive to the USB port and run it from there by change the boot sequence in BIOS. Is it possible?
Yes. You write the ISO to one media, and install on another (eg. install to second usb). I haven’t done it recently, but I did on some machines need to tweek the system so I could boot it on multiple machines, but this was probably machine/bios specific. (once installed you no longer need the installer/ISO thumb-drive)
As long as my understanding, ISO is installer, right? What I am asking is it fully install on flashdrive, not a life CD. Life CD i have it now Ubuntu 11.10. It is not full feature. Is it still ask to be installed
Ubuntu 11.10 or the 2011.October (Ubuntu releases are yy.mm in format) is well past EOL (15 months) so I’d recommend a supported version. You download the ISO (a file) which is written to a thumb-drive (installer which is run in ‘live’ mode usually) which is booted & used to install to a hdd/sdd/system (or another thumb-drive in this case). Yes one of either could be cd/dvd/cdrw/dvdrw but thumb-drives are more common today. What I suggested was just to install to another thumb-drive (treating it as if it’s your hdd/sdd), then when you reboot you can remove first thumb-drive/cd/dvd/..
Yes, it is Ubuntu released in October 2011. It was my last Ubuntu I used. Since that time I stopped using Ubuntu, after previously I used Ubuntu 7.04 (2007.04). Before that, I used RedHat.
The following link has a slightly different perspective and will add some details not yet found in C.S.Cameron’s good answer: Introduction and Instructions
2 Answers 2
Full Install to USB
11.10 is too old, Latest LTS, (Long Term Service), release is 18.04.
Full installs are more stable and secure than persistent installs, but not as quick to make. They are better at utilizing disk space as no fixed size casper-rw file or partition is required. They are not very good for use of installing Ubuntu.
Following is a step by step how to install 18.04 on a 16GB flash drive with options for separate Home partition and Windows compatible data partition:
- Create a live USB or DVD using SDC, UNetbootin, mkusb, etc.
- Turn off and unplug the computer. (See note at bottom)
- Unplug the power cable from the hard drive or unplug the hard drive from the laptop.
- Plug the computer back in.
- Insert the flash drive.
- Insert the Live USB or Live DVD.
- Start the computer, the USB/DVD should boot.
- Select language.
- Select install Ubuntu.
- Select Keyboard layout
- Select «Continue».
- Select installation type and «Download updates while installing Ubuntu» and Select «Install third-party software . «, (optional).
- Select «Continue».
- At «Installation type» select «Something else». (Full disk encryption is now working with flash drives).
- Select «Continue».
- Confirm target device is correct.
- Select «New Partition Table».
- Click Continue on the drop down.
(Optional FAT32 data partition for use on Windows machine)
- Click «Free space» and «+».
- Make «Size. » about 2000 MB.
- Select «Primary».
- Location = «Beginning of this space».
- «Use as:» = «FAT32 file system».
- «Mount point» = «/windows».
- Select «OK»
(Non Optional Root Partition)
- Click «free space» and then «+».
- Select «Primary», «Size . » = 4500 to 6000 MB, «Beginning of this space», Ext4, and Mount point = «/» then OK.
(Optional home partition)
- Click «free space» and then «+».
- Select «Primary», «New partition size . » = 1000 to 6000 MB, Beginning of this space, Ext2, and Mount point = «/home» then OK.
(Optional swap space, allows hibernation)
- Click «free space» and then «+».
- Select «Primary», «New partition size . » = remaining space, (1000 to 2000 megabytes, or same size as RAM), Beginning of this space and «Use as» = «swap area» then OK.
- Confirm «Device for boot loader installation» points to the root of the USB drive. Default should be OK if HDD was unplugged.
- Click «Install Now».
- Select your location.
- Select «Continue».
- Insert your name, computer name, username, password and select if you want to log in automatically or require a password.cscameron
- Select «Continue».
- Wait until install is complete.
- Turn off computer and plug in the HDD.
- Replace the computer’s cover.
Note: You may omit disabling the hard drive if after partitioning you choose to install grub to the root of the USB drive you are installing Ubuntu to, (ie sdb not sdb1). Be cautious, many people have overwritten the HDD MBR as default location for boot loader is sda, any items in the internal drive’s grub will be added to the USB’s grub. You may do an update-grub later.
First, I will not use the 11.10 as it is to old. I was telling abiut live-CD rather than to say I will install it.
I will make a bootable installer (on USB flash drive or on CD/DVD). I will take out my laptop hardrive. Then I will boot the laptop from the live-CD/Flashdrive. Then I will install. Is like that?
That always works for me. I will check back here to see if you have any questions. There is another method if you have BIOS/UEFI problems.
+1 for a very detailed answer. I would not bother with the swap partition for Ubuntu 18.04 in a USB. Three reasons: First, Ubuntu now uses a swap file by default. Second, hibernating a system into a USB drive and then unplugging it (by mistake) may have unexpected effects. Third, hibernation won’t work if the same USB is used in a different computer with more RAM than the original computer.
Here’s another way: Use Virtualbox to install Ubuntu. You only need one USB drive, and don’t have to worry about screwing up your current installation of Windows. Edit: With this method, you’re ony using Virtualbox to install Ubuntu. You don’t use it to run Ubuntu at all. Once it’s installed, Virtualbox is no longer needed.
Plug in your USB and open up the Disk Management utility. Take note of the drive number that your USB drive shows up as. Open up cmd and run:
VBoxManage internalcommands createrawvmdk -filename "C:\Users\\VirtualBox VMs\\.vmdk" -rawdisk \\.\PhysicalDrive#
This will create a file that points to the physical drive you’ve entered (in this case, your USB drive). Now, just start Virtualbox as an administrator and create a new VM as usual, but, when you’re prompted to create a drive—select the option that allows you to choose an already-existing drive, and point Virtualbox to the .vmdk file you’ve just made.
Note: I’ve used this on Linux quite a few times. In fact, I used it to install Windows on the 2nd harddrive in my computer without a USB. I’ve never used Windows to install another thing; the commands are slightly different, but I assume things like, when one needs to use sudo in Linux, running the command (e.g. — Virtualbox) as an administrator is sufficiently equivalent.
Как создать виртуальный USB-накопитель?
Нужно сэмулировать подключенную к usb флешку с возможностью определить ее размер и работать как с физическим устройстов в режиме чтения\записи.
А почему именно флешку ? Простой виртуальный диск не подойдет ?
Dark_SavanT ★★★★★ ( 06.04.15 16:06:53 MSK )
Последнее исправление: Dark_SavanT 06.04.15 16:07:35 MSK (всего исправлений: 1)
Потому, что я работаю с программой VirtualBox и в ней «оно» должно определяться именно как подключенная физическая флешка.
Тогда пробуй USB gadget как советовал Dark_SavanT
insmod g_file_storage.ko file=/my_virtual_usb_storage.dat
Я не так давно на Linux как вы могли подумать, судя из совета и гугла мне нужно написать собственный драйвер?
надо сходить в гугл и научиться ставить это
insmod g_file_storage.ko file=/my_virtual_usb_storage.dat (это файл, который прикидывается флешкой)
и засунуть это в терминал.
нет все уже написано до вас, нужно просто установить (есть вероятность что у вас уже установлено) и настроить.
Про файл который прикидываеться флешкой я понял. Что это g_file_storage.ko и где его взять? Терминал отвечает, что модуль не загружен, нет такого модуля в директории, но это и понятно.
g_mass_storage, только это тебе не надо
тебе надо в настройки виртуал бокса, там должно быть создание usb диска для этой виртуальной машины.
Linux version 3.16.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt7-1 (2015-03-01)
если «no such device», то видимо у тебя нету устройства, которое прикидывается usb device, usb host так по умолчанию не умеет.
У меня нет модуля с таким названием.
И не понимаю,причём тут наличие или отсутствие устройств?
Как я понимаю эти модули продвинутая версия loop устройства умеющего прикинуться диском полностью,
причём здесь что либо ещё?
Как я понимаю эти модули продвинутая версия loop устройства
неправильно понимаешь, это часть usb gadget framework, об этом нам говорит g_*
Emulate physical USB device Linux
I have a Linux application that I would like to automate some tests for, and its state should change depending on the status of certain devices, i.e. USB devices, WLAN devices, WAN devices. However, we no longer have physical USB, WLAN, WAN, etc devices at our disposal, so I need to figure out a way to test this program without actually plugging in physical devices, turning them on/off, etc. I am starting off by simply creating a virtual USB device that I can control from user space, but there is a fundamental lack of knowledge on my part preventing me from taking any of the similar topics on these forums and applying them to my project. I feel like I will need to create some kind of virtual USB driver, and then have it communicate with some user-level program rather than usbfs. However, even if I create this virtual driver, how do I «plug in» this device from user-space and get my program registered with this particular driver? Is what I’m trying to do even possible?
2 Answers 2
The best way is to use the Linux Gadget Drivers and hardware that allows you to be a USB device. The gadget driver allow a computer to «pretend» to be any kind of device. Then your system under test has a single USB OTG cable to the gadget box. You don’t even need to unplug the cable if your gadget box has the right hardware. The «gadget box» could be your desktop/laptop running Linux (if it supports USB OTG), or even an Android phone or Raspberry Pi. (Beware that USB cables suck. Just because the cable fits doesn’t mean it’s wired correctly for USB OTG.)
Once you have the right USB OTG hardware, your gadget box is all software:
1) If your device under test supports OTG, make sure your gadget box does NOT try and become a USB host. (Then your device under test will become a USB client.) I.e. make sure things like usb_storage are not automatically loaded.
2) Out of the box, the kernel supports gadgets for USB Hubs, USB Ethernet, USB Serial ports and USB sticks. Just load the right modules on your gadget box and it «just works». For example, to create a USB stick, do something like this: » insmod g_file_storage.ko file=/dev/ram0 «. The far side will think that you plugged in a USB stick.
For serial devices, your gadget can run user-space code that «picks up the phone» on /dev/USBx» and talks to your device under test. (Presumably emulating a 4G modem or whatever.)
Tons of devices are really «USB serial» under the hood because the manufacturer was too lazy to understand USB.
3) With a little re-compiling or configuring, you can have those generic Gadget Devices pretend to be various USB IDs or return various vendor strings, etc. This won’t be the same as «testing against real hardware», but at least you are testing with generic version of these devices.
4) For device types that aren’t already in the kernel (i.e WiFi or something), you’re on your own. With enough blood sweat and tears, you can use write your own gadget type. (Ideally, keep as much as possible in user space, and only handle the performance critical parts in the kernel..)
Beware: it is impossible to simultaneously understand and appreciate USB.