Reuse of USB after ubuntu installation - linux

This might seem like a stupid question but...
After using a USB to install Ubuntu, is it possible to use it as a regular USB again or is it like a CD install and the USB is now only good for installing Ubuntu?
Thanks.

Yes you can.
Infact you can keep the Ubuntu setup as it is and use the remaining free space to store other things, just incase you need Ubuntu installation in future.

You can use it normally, just be sure you have cleaned up the MBR for the case you leave the device plugged in at restart (when USB boot is still enabled).
Easiest is to format the whole partition (or use a partition manager to clean up the whole device). GParted should be able to do this for you.
Some (sketchy!) technical background:
The USB device is a flash device, where bits are stored non-volatile, but eraseable and changeable. Bits at a normal CD-ROM will really be "burned" in as the reflection capacity will be permanently changed when creating a CD. When booting up your computer, there is small memory ROM that contains a bootloader, that is looking up for devices containing a MBR at the first 512 bytes, that will be executed and load the OS (or in your case the first steps of the Ubuntu installation process).
So if you want to use the USB device as normal data storage again, you should also clear up these first 512 Bytes, as the bootloader from the USB could be loaded otherwise when leaving the device plugged in at reboot. Then the bootloader could throw an exception, as it would normally expect the Ubuntu installation files to be present onto this device.

Related

Install Linux on flash disk like internal disk

guys I have an issue with Linux
I wanna install Linux on flash disk like internal disk
actually I wanna install it with presentation space
I did it but it limited with 4 gig space.
I wanna use all space of flash disk and do my works on it like an internal partition
like a really OS
In the normal installation process, you will be asked to select the partition on which you would like to install Linux.
The option for bootable USB will be visible with a warning sign. In some flavours, it may be hidden however, you can still install it. Simply click on the USB drive partition and Linux can be installed on it.
Make sure you have at least 16GB USB Flash drive to run your Linux smoothly.

How to work on kernel with an embedded device?

Right now, I'm compiling with printk's, copy the resulting kernel to a USB stick, mounting the USB stick on the device, mounting the partition that contains the kernel, copying the new kernel from the USB stick to the partition, rebooting, then inspecting the trace by capturing the dmesg output to a file.
On workstation:
make my-kernel
cp new_kernel /path/to/usb/stick
On embedded device:
mount /dev/sda1/ /mnt
mount kernelpartition /tmp/kernel
cp /mnt/new_kernel /tmp/kernel
sync
umount /tmp/kernel
umount /dev/sda1
reboot
dmesg > mytrace
less mytrace
Is it supposed to this painful to develop? I don't understand how any meaningful amount of non-trivial kernel code is ever developed.
The best workflow is going to depend on the capabilities of the device you are working with. Often they will have a bootloader with options to boot from a network or serial port.
I'm doing some embedded development also, and here's what I came up with. The device I am working with has some built in flash which by default it boots from, but also has a USB port and an SD Card slot. It has a fairly primitive bootloader.
On the USB port I have connected a wifi dongle. I make sure that I compile the kernels with the needed modules to get the USB dongle up and running.
I have built a minimal kernel and root filesystem which I have flashed onto the device. This kernel has the option CONFIG_KEXEC enabled. The root filesystem has kexec tools. I build the system using buildroot.
When this system starts, it attempts to mount the SDCARD and checks to see if it can find a kernel in the root directory. If it can, then it uses kexec to boot this second kernel. This is done using a custom init script that I have written.
If you don't have an SD Card slot on your device, you could probably do something similar with a USB memory stick.
With this setup, I can just use sftp to transfer a new kernel image onto the sdcard, and kexec to boot it. It saves me the hassle of reflashing the device each time I change the kernel.

Automatically enabling all ethernet, ATA, SATA, and SCSI drivers in the Linux .config file

I am compiling my own Linux kernel and userland tools for a PXE environment meant for cloning and reimaging. Right now, I'm sticking to a specific kernel version and using preconfigured .config's for building the Linux kernel.
I need to change from using preconfigured .config's to automatically generating the default configuration for the specified architecture, and then enabling all ethernet, ATA, SATA, and SCSI drivers.
The reason I want to do this is:
Updating the kernel means updating the preconfigured .config's, which takes too much time to manually do. The way I'm doing it now is using menuconfig, enabling the options I need, and saving the resulting .config to my repository.
I know the kernel I'm building is missing some drivers because I've encountered some PC's that were not able to mount the NFS share because Linux could not find an ethernet device (which I've verified by booting an Ubuntu CD, which did find the ethernet device). I want an automated way of building any Linux kernel version that will guarantee that ALL drivers I need are pulled in.
Using a distribution's configuration pulls in too many unnecessary drivers and features for my purposes. It lengthens the kernel build time from 10-15 mintues to an hour or more, and the resulting image is too big.
Does anyone know how to write a Bash script to accomplish this?
Have you considered using a text editor to modify the .config file.
Then you can modify it using search and replace.
Plus, there are other choices for configuring the kernel than the menu-driven "menuconfig".

How can we use Linux from a small storage pen drive? Does it work on micro-controllers also?

I generally hear that LINUX OS can be downloaded on flash, pen drive (floppy disk?) etc. How we can do that?
I have RHEL 5.4 source code - so how can download it into pen drive and how much space is required?
What other functionality I can add apart from the OS - so that when I boot from that storage device I can make use of them?
Can we download Linux OS into micro-controllers also?
I generally hear that LINUX OS can be downloaded on flash, pen drive (floppy disk?) etc. How > we can do that?
If you can't get it to work on your own, you can buy a ready made Linux on a USB drive from
a site like http://www.osdisc.com or http://www.cheapbytes.com
Not all PCs, especially older PCs, can boot from the USB Drive. Even some newer PCs are beginning to ship with security features that can interfere with booting code. When it does work, you have to find out the proper way to boot the USB drive. You might have only a few seconds during reboot to enter the right key, or it will boot Windows (if Windows is installed). The key to get to the BIOS Boot Menu might be delete or escape or F10 or some other key (varies with PC motherboard manufacturer). A message on the screen that flashes by rather quickly might mention keys you can press. Boot to a specific device or changing boot order can also often be found in the BIOS setup.
There is a linux utility called unetbootin that will create a USB drive that will boot linux. It does not create a USB boot drive from a source code distribution, but rather from an ISO file representing a live CD or the live CD itself.
Since large USB drives (e.g. 32GB) are relatively inexpensive, if you want to compare systems or have multiple systems there is a way to have multiple linux and other operating systems on one USB drive and be able to choose which to boot into. See, for instance, http://www.pendrivelinux.com/ which has a wide variety of procedures for making a bootable USB using either windows or Linux to set up the USB and booting a variety of systems.
I have RHEL 5.4 source code - so how can download it into pen drive
and how much space is required?
RHEL 5.4 is a bit old. You need the Live CD, if there was one.
The ISO file can take up 600+MB. You want space left over to use the system. 2GB for the pen drive is OK. Sometimes you can get by with less.
What other functionality I can add apart from the OS - so that when I
boot from that storage device I can make use of them?
Upon boot the operating system will often recognize sound cards, other usb devices, the hard drives, etc. You need to know how to use these things within Linux, and how to enable them if they are not configured. Some Linux distributions have a place to put packages that are to be autoinstalled when a USB pen drive based system initializes. In this way you can "install" software from the distribution archives that are not included on the standard live system, even if you don't have internet access.
Can we download Linux OS into micro-controllers also?
People run it on raspberry pi and such, but the versions of Linux on non-PC hardware that has low memory are often quite tiny compared to a desktop version. They can be tiny enough to be challenging to work with or expand.

What is the workflow for automount in Gnome 2.30?

I have a ASUS laptop with Fedora 13. My problem is that any USB storage I connect does not automount. I have other computer with Fedora 13 which does not have the problem.
I have not be able to find any difference in configuration between my laptop and other computers that work.
So to try to trace down the problem I started to looomk for documentation on how it was supposed to work. I have looked at udev, devkit, hal , dbus, polkit, gnome and others.
I want to know which events, logs, config files and monitor programs that I can use to track down the events that takes place from when I attach an USB stick and until i have a window up and running in GNOME.
So far I have traced that udev detects the disk and creates /dev/sdb (and /dev/sdb1 for partition 1) and that event about device added is sent as messages on dbus. I am able to mount the disk manually with udisks but not with gnome-disk-utility (palmiset).
There is many different applications involved to automount a disk, I want to find out where in the chain of events does it fail.
I just found the reason it did not mount. I had a leftover file from earlier udev version. File 60-persistent-storage.rules existed in both /etc/udev/rules.d and in /lib/udev/rules.d . The former overruled the last one. When removing the one in /etc/udev/rules.d the USB drives mounted correctly again.

Resources