How To Install the Raspbian OS to your USB Flash drive
Page 1 of 1
How To Install the Raspbian OS to your USB Flash drive
Step 1 – Download Raspbian from Raspberry Pi
You will need the standard Raspbian OS image, you can download this from the official Raspberry Pi website. Once you’ve downloaded it, unzip it. It’s around 400mb in size, so should only take a couple of minutes over a broadband connection.
The list of attached disks will show up with their identifiers. Important – make a note of the correct identifier, you can do some serious damage by choosing the wrong one!
In the screen shot above, I can see that /dev/disk2 is the correct identifier for my Sandisk USB Flash Drive. Yours may be different so change to suit your configuration. Next we’re going to unmount the USB Flash Drive. To do this enter the following command:
Yet again, be really careful to change disk2 to whatever your computer identifies the USB Flash Drive as. You will get a message saying
cd ~/Downloads/
Now run this command to begin the copy:
As with before, make sure you change disk2 to whatever your computer identifies as being the USB Flash Drive, and change 2013-02-09-wheezy-raspbian.img to whatever your image file is called. The blocks will now begin moving to your USB Flash Drive from the Raspbian OS image. This takes anything from 5 to 20 mins depending on the speed of your USB Flash Drive. Go stick the kettle on and have a brew!
To see progress of dd
Eventually, you will see something similar to the above, and it probably took a while too. The next step is to configure your SD Card to give the correct boot instruction to start the OS from the USB Flash Drive
(simply hit ‘w’ after deleting the partition to make sure it works)
Once you’ve done this, you’ll notice on your Desktop, there are two mounted volumes; one is your USB Flash Drive, the other is your SD Card.
Open up the USB Flash Drive volume and copy all the files from that onto your SD card. This copies the all-important files and instructions to tell your Raspberry Pi to boot from the USB Flash Drive. We’re almost done at this point, only one more step to go.
root=/dev/mmcblk0p2
To this:
root=/dev/sda2
This will instruct your Raspberry Pi to boot from the USB Flash Drive instead of from the SD card. Save the cmdline.txt file and close the Finder window. We’re almost done!
Doesn’t work on USB Flash drives. This isn’t essential, but if you have the extra space on a USB Flash Drive, why not use it all?
From your Raspberry Pi, type the following command to start FDisk:
Then press p and enter to see the partitions. There should only be 2. What we’re going to do now is delete the Linux partition, but before we do this, we make a note of the start position for the linux partition sda2. Press d and then when prompted type 2 and then hit enter. This will delete the partition.
Now we’re going to create a new partition, and make it large enough for the OS to occupy the full space available on the USB Flash Drive. To do this type n to create a new partition, when prompted to give the partition type, press p for primary. Then it will as for a partition number, press 2 and hit enter.
You will be asked for a first sector, set this as the start of partition 2 as noted earlier. In my case this as 12280 but this is likely to be different for you.
After this it will ask for an end position, hit enter to use the default which is end of disk. Now type w to commit the changes. You will see a message about the Kernel using some table yaddah yaddah, just ignore this. Type the following to reboot:
Once your Raspberry Pi has rebooted, we need to resize the partition. To do this type the following command:
Be patient, this will take some time. Once it’s done reboot again. Then type:
This will show the partitions and the space, you’ll see the full USB Flash Disk has all the space available now. That’s it, all done!
http://raspipress.com/2013/05/install-and-run-raspbian-from-a-usb-flash-drive
You will need the standard Raspbian OS image, you can download this from the official Raspberry Pi website. Once you’ve downloaded it, unzip it. It’s around 400mb in size, so should only take a couple of minutes over a broadband connection.
Step 2 – Install the Raspbian OS to your USB Flash drive
Plug in your USB stick and launch Terminal. The first thing we’re going to do is get the device identifier for your USB Flash drive. To do this run the following command:- Code:
diskutil list
The list of attached disks will show up with their identifiers. Important – make a note of the correct identifier, you can do some serious damage by choosing the wrong one!
In the screen shot above, I can see that /dev/disk2 is the correct identifier for my Sandisk USB Flash Drive. Yours may be different so change to suit your configuration. Next we’re going to unmount the USB Flash Drive. To do this enter the following command:
- Code:
diskutil unmountDisk /dev/disk2
Yet again, be really careful to change disk2 to whatever your computer identifies the USB Flash Drive as. You will get a message saying
Now we can begin the copy. For ease, I’ve changed the directory in Terminal to where the Raspbian image is located, which in this case is my downloads folder. If you’ve downloaded and unzipped the disk image to your downloads folder, running this command should take you there:“Unmount of all volumes on disk2 was successful”.
cd ~/Downloads/
Now run this command to begin the copy:
- Code:
sudo dd bs=1m if=2013-02-09-wheezy-raspbian.img of=/dev/disk2
As with before, make sure you change disk2 to whatever your computer identifies as being the USB Flash Drive, and change 2013-02-09-wheezy-raspbian.img to whatever your image file is called. The blocks will now begin moving to your USB Flash Drive from the Raspbian OS image. This takes anything from 5 to 20 mins depending on the speed of your USB Flash Drive. Go stick the kettle on and have a brew!
To see progress of dd
- Code:
sudo watch -n 1 kill -USR1 $(pidof dd)
Eventually, you will see something similar to the above, and it probably took a while too. The next step is to configure your SD Card to give the correct boot instruction to start the OS from the USB Flash Drive
(simply hit ‘w’ after deleting the partition to make sure it works)
Step 3 – Configure your SD card
Using Disk Utility, format your SD Card using FAT32. It’s dead easy, choose your SD Card from the devices listed on the right, then click on ‘Erase’, choose FAT32 in the Formats list and click on ‘Erase’.Once you’ve done this, you’ll notice on your Desktop, there are two mounted volumes; one is your USB Flash Drive, the other is your SD Card.
Open up the USB Flash Drive volume and copy all the files from that onto your SD card. This copies the all-important files and instructions to tell your Raspberry Pi to boot from the USB Flash Drive. We’re almost done at this point, only one more step to go.
Step 4 – Change the boot path on your SD card
Once you’ve completed step 3, you need to change the default boot path to tell the Raspberry Pi to boot from your USB drive. Open a new Finder window and go to your SD card. Open up the file called cmdline.txt in TextEdit or similar and amend the line which reads:root=/dev/mmcblk0p2
To this:
root=/dev/sda2
This will instruct your Raspberry Pi to boot from the USB Flash Drive instead of from the SD card. Save the cmdline.txt file and close the Finder window. We’re almost done!
Step 4 – Boot from your USB Flash Drive on your Raspberry Pi
Now unmount both your USB Flash Drive and your SD card and pop them both into your Raspberry Pi and switch it on. If all goes well, it should boot from your USB Flash Drive which you’ll find substantially quicker than your SD Card.Step 5 – Expand the Raspbian partition on your USB Flash drive to fill it
Finally, we’re just going to do a little housekeeping to utilise all the available space on your USB Flash drive as the method using- Code:
raspi-config
Doesn’t work on USB Flash drives. This isn’t essential, but if you have the extra space on a USB Flash Drive, why not use it all?
From your Raspberry Pi, type the following command to start FDisk:
- Code:
sudo fdisk /dev/sda
Then press p and enter to see the partitions. There should only be 2. What we’re going to do now is delete the Linux partition, but before we do this, we make a note of the start position for the linux partition sda2. Press d and then when prompted type 2 and then hit enter. This will delete the partition.
Now we’re going to create a new partition, and make it large enough for the OS to occupy the full space available on the USB Flash Drive. To do this type n to create a new partition, when prompted to give the partition type, press p for primary. Then it will as for a partition number, press 2 and hit enter.
You will be asked for a first sector, set this as the start of partition 2 as noted earlier. In my case this as 12280 but this is likely to be different for you.
After this it will ask for an end position, hit enter to use the default which is end of disk. Now type w to commit the changes. You will see a message about the Kernel using some table yaddah yaddah, just ignore this. Type the following to reboot:
- Code:
sudo reboot
Once your Raspberry Pi has rebooted, we need to resize the partition. To do this type the following command:
- Code:
sudo resize2fs /dev/sda2
Be patient, this will take some time. Once it’s done reboot again. Then type:
- Code:
df -h
This will show the partitions and the space, you’ll see the full USB Flash Disk has all the space available now. That’s it, all done!
http://raspipress.com/2013/05/install-and-run-raspbian-from-a-usb-flash-drive
Similar topics
» Questions Answered for Questions about nc (netcat) in Raspbian
» fix flash and java issues with linux
» Fix vulnerability Flash upgrade for Security on Linux
» 2 TB USB Thumb Drive
» odin for kali linux to flash android phones
» fix flash and java issues with linux
» Fix vulnerability Flash upgrade for Security on Linux
» 2 TB USB Thumb Drive
» odin for kali linux to flash android phones
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum