Showing posts with label pen drive. Show all posts
Showing posts with label pen drive. Show all posts

Saturday, November 1, 2014

How to Create Bootable USB Drives and SD Cards For Every Operating System

How to Create Bootable USB Drives and SD Cards For Every Operating System

clip_image001

Creating installation media for your operating system of choice used to be simple. Just download an ISO and burn it to CD or DVD. Now we’re using USB drives, and the process is a little different for each operating system.

You can’t just copy files form an ISO disc image directly onto your USB drive. The USB drive’s data partition needs to be made bootable, for one thing. This process will usually wipe your USB drive or SD card.

From a Linux ISO

Ubuntu recommends the Universal USB Installer for creating bootable Linux USB drives on Windows. This tool can create bootable disc images for many different Linux distributions.UNetbootin is another popular alternative.

Download the Linux distribution you want to use in .ISO form. Run the tool, select your desired distribution, browse to your downloaded ISO file, and choose the USB drive you want to use. The tool will do the rest.

clip_image002

You can use similar tools on Linux. For example, Ubuntu includes a Startup Disk Creator tool for creating bootable Ubuntu USB drives. UNetbootin also runs on Linux, so you can use that too.

clip_image003

From an IMG File

Some operating system projects provide an IMG file instead of an ISO file. An IMG file is a raw disk image that needs to be written directly to a USB drive.

Use Win32 Disk Imager to write an IMG file to a USB drive or SD card. Provide a downloaded IMG file and the tool will write it directly to your drive, erasing its current contents. You can also use this tool to create IMG files from USB drives and SD cards.

clip_image004

Linux users can use the dd command to directly write an IMG file’s contents to a removable media device. Insert the removable media and run the following command on Ubuntu:

sudo dd if=/home/user/file.img of=/dev/sdX bs=1M

Replace /home/user/file.img with the path to the IMG file on your file system and /dev/sdX with the path to your USB or SD card device. Be very careful to specify the correct disk path here — if you specify the path to your system drive instead, you’ll write the contents of the image to your operating system drive and corrupt it

clip_image005

From a Windows 7 ISO

Provide the ISO file and a USB flash drive and the tool will create a bootable drive.

clip_image006

From a Windows 8 or 8.1 Product Key

If you have a Windows 8 or Windows 8.1 product key, you can download installation media directly from Microsoft and create a USB drive all at once. Download the appropriate tool from the Upgrade Windows with only a product key page. Run it, provide your product key, and tell the wizard you want to create a bootable USB drive.

Note that Windows 8 and Windows 8.1 have different product keys, so you’ll need to jump through hoops if you want to install Windows 8.1 with a Windows 8 product key. You may just want to install Windows 8 and upgrade to Windows 8.1 from within Windows 8 — that’s Microsoft’s officially supported method.

clip_image007

From a Windows 8 or 8.1 ISO

If you already have a Windows 8 or 8.1 ISO file and you want to create installation media without redownloading anything, you can actually use the Windows 7 USB/DVD download tool for this.

Just provide the Windows 8 or 8.1 ISO file when prompted. The tool will happily create Windows 8 or 8.1 installation media if you provide the appropriate ISO file.

clip_image008

If you need to boot into DOS to use a low-level firmware upgrade, BIOS update, or system tool that still requires DOS for some reason, you can use the Rufus tool to create a bootable DOS USB drive.

Rufus uses FreeDOS, an open-source implementation of DOS that should run whatever DOS program you need to use.

clip_image009

From Mac OS X Installation Files

You can create a bootable drive with Mac OS X on it by downloading the latest version of OS X from the Mac App Store. Use Apple’s included “createinstallmedia” tool in a terminal or by run the third-party DiskMaker X tool.

The Mac OS X drive can be used to install OS X on other Macs or upgrade them to the latest version without any long downloads.

clip_image011

From a Windows ISO for Mac

If you plan on installing Windows on a Mac via Boot Camp, don’t bother creating a bootable USB drive in the usual way. Use your Mac’s Boot Camp tool to start setting things up and it will walk you through creating a bootable Windows installation drive with Apple’s drivers and Boot Camp utilities integrated.

You can use this drive to install Windows on multiple Macs, but don’t use it to install Windows on non-Apple PCs.

clip_image012

Some of these tools overlap — for example, Rufus can also be used to create bootable drives from Linux ISOs, IMG files, and even Windows ISO Files. We suggested the most popular, widely recommended tools for each task here.

Image Credit: USBMemoryDirect on Flickr

Taken From: http://www.howtogeek.com/191054/how-to-create-bootable-usb-drives-and-sd-cards-for-every-operating-system/

Tuesday, July 8, 2008

Installing Ubuntu Linux (and others) on a Usb PenDrive

How-to:

This tutorial will show how-to install Ubuntu on a usb stick. Even though this tutorial uses Ubuntu as its base distribution, you could Installing Ubuntu Linux on a usb pendrivevirtually use any type of Linux liveCD distribution.

Being able to run Linux out of a usb bar is a great way to enjoy the live CD experience (being able to use Linux on any computer you might get by) and the big advantage of being easier to carry around than a CD.

1. Requirements

In order to reproduce this tutorial, you will need a few items such as:

  • a ubuntu liveCD
  • a usb bar of at least 1G
  • a running Linux operating system

Now that you have all this, it is time to prepare you USB bar do host the Ubuntu liveCD files.

2. Setting up the USB disk

2.1. Finding the device

In the first place, you need to plug your usb drive and check under which device it is associated. To find out the device, run:

$ sudo fdisk -l

On my system, the device appears as being /dev/sdb, I will therefore use /dev/sdb as a reference for this tutorial, please replace it accordingly to your system (might be sda, sdc ...).
Once you found your device, you are going to create the partitions.

Using the wrong device name might destroy your system partition, please double check

2.2. Making the partitions

Make sure every of your already mounted partition are unmounted:

$sudo umount /dev/sdb1

and then launch fdisk, a tool to edit partition under linux:

sudo fdisk /dev/sdb

We are going delete all the partition and then create 2 new partition: one fat partition of 750M which will host the files from the live CD iso, and the rest on another partition.

At fdisk prompt type d x where x is the partition number (you can simply type d if you only have one partition), then:

  • n to create a new partition
  • p to make it primary
  • 1 so it is the first primary partition
  • Accept the default or type 1 to start from the first cylinder
  • +750M to make it 750 Meg big
  • a to toggle the partition active for boot
  • 1 to choose the 1 partition
  • t to change the partition type
  • 6 to set it to FAT16

Now we have out first partition set up, let's create the second one:

  • n to create yet again a new partition
  • p to make it primary
  • 2 to be the second partition
  • Accept the default by typing Enter
  • Accept the default to make your partition as big as possible
  • Finally, type w to write the change to your usb pendrive

Partitions are now created, let's format them.

2.3. Formatting the partitions

The first partition is going to be formated as a FAT filesystem of size 16 and we are going to attribute it the label "liveusb".

$ sudo mkfs.vfat -F 16 -n liveusb /dev/sdb1

The second partition is going to be of type ext2 with a blocksize of 4096 bytes and the label casper-rw. Mind that it has to be labeled as casper-rw otherwise the tutorial won't work!.

$ sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2

At this stage, our usb pendrive is ready to host the liveCD image. Now, let's copy the files to the usb bar.


How-to: Installing Ubuntu Linux on a usb pendrive -- page 2

3. Installing Ubuntu on the USB stick

3.1. Mounting Ubuntu liveCd image

In the first place we need to mount our ubuntu iso. Depending if you have the .iso file or the CD, there is 2 different ways of mounting it.

3.1.1. Mounting from the CD

People using Ubuntu or any other user-friendly distro, might just have to insert the cd and it will be mounted automatically. If this is not the case:

$ sudo mount /media/cdrom

should mount it.

3.1.2. Mounting from an .iso image file

We will need to create a temporary directory, let say /tmp/ubuntu-livecd and then mount our iso (I will be using a feisty fawn iso).

$ mkdir /tmp/ubuntu-livecd
$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd

Once the cd image is ready, it is time to mount the newly created usb bar partitions:

3.2. Mounting the usb bar partitions

Same here, you might be able to get both your partition by simply replugging the usb pendrive, partition might appears as: /media/liveusb and /media/casper-rw. If this is not the case, then you will need to mount them manually:

$ mkdir /tmp/liveusb
$ sudo mount /dev/sdb1 /tmp/liveusb

All the partitions we need are now mounted, let's copy the files.

3.3. Copying the files to the usb bar

Let positionned yourself on the CD image directory (in my case: /tmp/ubuntu-livecd , but it might be /media/cdrom , and copy at the root of your usb first partition:

  • the directories: 'casper', 'disctree', 'dists', 'install', 'pics', 'pool', 'preseed', '.disk'
  • The content of directory 'isolinux'
  • and files 'md5sum.txt', 'README.diskdefines', 'ubuntu.ico'
  • as well as files: 'casper/vmlinuz', 'casper/initrd.gz' and 'install/mt86plus'

$ cd /tmp/ubuntu-livecd
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /tmp/liveusb/

It might complain about symbolic links not being able to create, you can ignore this.

Now let's go to the first partition of your usb disk and rename isolinux.cfg to syslinux.cfg:

$ cd /tmp/liveusb
$ sudo mv isolinux.cfg syslinux.cfg

change /tmp/liveusb according to your settings

Edit syslinux.cfg so it looks like:

DEFAULT persistent
GFXBOOT bootlogo
GFXBOOT-BACKGROUND 0xB6875A
APPEND file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL persistent
menu label ^Start Ubuntu in persistent mode
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL live
menu label ^Start or install Ubuntu
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL xforcevesa
menu label Start Ubuntu in safe ^graphics mode
kernel vmlinuz
append file=preseed/ubuntu.seed boot=casper xforcevesa initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL check
menu label ^Check CD for defects
kernel vmlinuz
append boot=casper integrity-check initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL memtest
menu label ^Memory test
kernel mt86plus
append -
LABEL hd
menu label ^Boot from first hard disk
localboot 0x80
append -
DISPLAY isolinux.txt
TIMEOUT 300
PROMPT 1
F1 f1.txt
F2 f2.txt
F3 f3.txt
F4 f4.txt
F5 f5.txt
F6 f6.txt
F7 f7.txt
F8 f8.txt
F9 f9.txt
F0 f10.txt

Woof, finally we have our usb disk almost usuable. We have a last thing to do: make the usb bootable.

3.4. Making the usb bar bootable.

in order to make our usb disk bootable, we need to install syslinux and mtools:

$ sudo apt-get install syslinux mtools

And finally unmount /dev/sdb1 and make it bootable:

$ cd
$ sudo umount /tmp/liveusb
$ sudo syslinux -f /dev/sdb1

Here we are :D , reboot, set your BIOS to boot from the usb bar and enjoy Ubuntu linux from a pendrive

4. Troubleshooting

If you are having trouble booting on the usb bar, this might be due to your MBR being corrupted. In order to fix it up, you can use lilo (I installed lilo on my box only for thid purpose).

$ lilo -M /dev/sdb

will fix the MBR on device /dev/sdb


Taken From: http://duncanbrown.org/linux/system_administration/usb_flash_system/