After a long time, we are back to talking about some more cool tech things you can do with a USB flash drive. Today’s topic will focus on booting the Linux operating system from a USB stick. The purpose of booting Linux from a USB drive, at least the purpose of this guide, is to recover files from a broken installation of the Windows operating system or any other operating system. We can also safely run virus scans from the Linux distribution without infecting other PCs or having to boot the infected PC.
What you will need:
* A 512mb to 2GB USB stick (depending on distribution)
* A main board capable of booting from a USB device.
* and about 15 minutes plus download time.
Software to use:
* Latest stable version of UNetbootin
Step #1: Prepare the USB drive
Once you have all your materials together, plug in the USB drive and back up any files you may have on the drive.
Step #2: Installation on the USB
Start UNetbootin and select the following:
1. Use the first radio button “Distribution”. This will automatically download and install the distro you want.
2. Select SystemRescueCD. We’re going with this because it’s easy, the ntfs file system driver comes pre-packaged so no further customization is required.
3. Next, select your flash drive.
NOTE: Be sure to select your flash drive and not your Windows partition or primary partition, because doing so will destroy the currently installed operating system.
4. Finally, click “OK”.
The UNetbootin options to select are shown in an image in the source article linked at the bottom of this article.
Step #3: Bios Settings
We will need to configure your computer to boot from the USB stick. To do this, firstly, the motherboard will need to support this feature, and secondly, you will need to do some configuration.
1. Restart your computer and press “F2? or “del” depending on your motherboard to enter BIOS setup.
2. Find the section labeled Boot Sequence or a similar name. Sometimes this will be filed in a separate section, such as advanced BIOS features, or similar.
3. Move Removable or USB to the top of the list. If you don’t see these options listed, your motherboard most likely doesn’t support USB booting. Please refer to Google for more information on this.
4. Reboot the computer with the drive plugged in.
Step #4: Boot Linux
We are going to start at the command line for this guide. There are options to load a GUI for those of you who cringe at CLI. I must warn you though Command Line is much easier and faster.
1. Once your computer passes the post, you will see the bootloader screen. Navigate to “VMLinuz64″ and press enter.
After a bunch of OKs on the screen and most likely 1 red FAIL, the message “root@sysresccd /root %” will appear. This would indicate a success.
Step #5 – Copy files from a Windows partition to an external hard drive.
For this you will need an external medium in which to move your files, have it ready to receive your data. You can also use the USB stick you booted from, if of course there is enough space on it.
1. First we will need to identify our units. I will assume that you have two storage devices connected, one is the flash drive and the other is your Windows hard drive. Run the following command:
fdisk -l | less
Disk /dev/sda: 160.0 GB, 160000000000 bytes 255 heads, 63 sectors/track, 19452 cylinders Units = 16065 * 512 cylinders = 8225280 bytes Disk Identifier: 0xd0f4738c Device Boot Start End Blocks Id System /dev/sda1 * 1 19451 1562401 7 HPFS/NTFS Disk /dev/sdb: 2085 MB, 2085617664 bytes 2 heads, 63 sectors/track, 32329 cylinders Units = 126 cylinders * 512 = 64512 bytes Disk Identifier: 0x00502bcd Device Boot Start End Blocks Id System /dev/sdb1 *1 32330 2036720 6 FAT16
NOTE: To exit this exit screen press “q”.
2. Mount the Windows drive so that we can access the files on it. Run the mount command below:
mount /dev/sda /mnt/windows
3. Let’s find out if we mount the correct device now. Run:
ls /mnt/windows
4. Time to get out our backup device. Plug it in and wait a few seconds, then run the fdisk command again:
fdisk -l
cat /proc/scores
Mount this device to the premade backup folder using the mount command again:
mount /dev/sdc /mnt/backup
If you want to copy your entire Windows drive to your backup drive, run this command:
cp -R /mnt/windows/* /mnt/backup/YOUR_FOLDER_NAME
Additional useful commands:
* Sometimes a virus can infect the first bit of code that runs on your system, the MBR (Master Boot Record). Fortunately, we can clean this up relatively easily on Linux. Executed:
dd if=/dev/zero of=/dev/sdb bs=512 count=1
* Maybe you don’t have an external device to back up, but you have another computer with a shared network. Well, let’s mount that network share so we can copy files to it. Create a mount point:
mkdir /mnt/network
mount -t smbfs //hostname/folder /mnt/network -o username=user1,password=mypasswordhere
To mount a share without a password, use:
mount -t smbfs //computername/folder /mnt/network