1

I have a USB stick permanently mounted to my Pi to increase its storage capacity and to reduce strain on the ever so volatile SD card.

At present, the USB stick is mounted to one of the users' home directories to be used as file storage for an FTPS server which is all working fine.

I've come to realise, however, that I also need to move my MySQL files off the SD card due to the ever increasing size of the databases and so the logical solution is to drop that onto a USB too.

I don't want the MySQL files and home directory files to be accessible in the same place (the FTPS clients shouldn't have access to the databases) and I don't have any free USB slots to mount another USB stick therefore I need both sets of files on the same USB stick but without being in the same place (logical, I know...).

I initially tried mounting different folders on the USB to different locations however this ended in failure. My second thought is to split the USB into two partitions, put each set of files on each partition and mount each partition to the location I want.

My question is this, would I be going down the right road to partition my USB stick, to mount two folders on the USB stick in a different way (which actually works) or to use another method completely?

Thanks in advance for any help anyone can provide me with.

1 Answer 1

3

Partitioning the flash drive is a decent solution and one I use in my own setup. The downside to this method is that the drive will no longer work on a Windows environment, since Windows will only recognize the first partition on removable media.

Alternatively, you can mount the drive under /mnt/usb, and then create two folders: /mnt/usb/database, and /mnt/usb/myuser. Once done, you can either move the user's home path to the flash drive (what I would do) or put a symbollic link to that folder in their exisiting home directory. If their permissions are set correctly, there shouldn't be any cross play.

1
  • 2
    +1 For mentioning symbolic links -- this could all be arranged that way. They are created with ln -s; there are some examples in that wikipedia page, and see man ln. Symbolic links can "dangle", that is, if their target disappears because it was into a mounted filesystem that's now gone, they'll still exist even though they are now useless. If you then mount the same filesystem on the same path later, those dangling links will work again.
    – goldilocks
    Jan 22, 2015 at 19:35

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