3

How would I make my RPi boot from the SD card, then immediately direct to my thumb drive (USB/Flash Disk) to run the Root FileSystem. I need to do this because I will be doing some quite heavy storage stuff on my RPi and I need more space, thus I'm moving to the thumb drive. How would I (step-by-step please) be able to do such thing?

  • While this isn't too hard, two questions first: do you have another unix (linux, OSX) at hand and more importantly why move the rootfs? Does 'heavy storage' imply you also need the speed or is it just about 'more space'? In the latter case it would be a lot easier to just mount the usb drive someplace and leave the root where it is. – Max Mar 27 '13 at 17:42
  • @Max I do have another Unix system at hand. And I'm moving it primarily because of space but also because of speed. The reason why Im moving it, is because I only really use command line, and doesnt matter where i look I find how to mount the thumb drive but at the same time can't figure out how to use it so it stores packages downloaded with apt-get. If you could tell me how to use it for packages without have to swap the disks because it'd decrease my SD card's life, I'd appreciate it. Otherwise show me how to do as I asked above. Thanks. – Safixk Mar 27 '13 at 20:44
4

Rather than moving the whole root partition, you could create a partition on the USB stick, and then pick a mount point for this where the space is required. For example, if you needed more space for downloaded apt packages, which live in /var/cache then you could mount the new partition on /var meaning that everything under this path would be stored in the USB drive.

Basically you need to:

  1. Create a partition on the USB stick (This is well documented), and format that partition, for example # mke2fs -j /dev/sdb1 to create an ext3 partition, assuming the USB device is /dev/sdb

  2. Mount it in a temporary location, and copy the existing contents of /var to that location. Something like:

    # mkdir /mnt/temp

    # mount /dev/sdb1 /mnt/temp

    # mv -v /var/* /mnt/temp

    # umount /mnt/temp

  3. Set up an entry in /etc/fstab so that the file system is mounted at boot time. Something like this would work:

    /dev/sdb1 /var ext3 defaults 0 0

  4. Reboot the RaspberryPi, and when the system starts up /var should be on the external partition. You can verify this with the mount or df commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.