User avatar
bugsy_malone 666
Posts: 289
Joined: Mon Dec 17, 2012 10:50 pm
Location: Basingstoke UK

Multiple usb disks as one with Pi?

Thu Oct 06, 2016 2:45 pm

I started looking online earlier and wasnt sure if it was possible, but I was looking into the idea of building an expandable server.

I thought at the moment I have a 1tb btsync server at home running a model B, its one of my few projects thats been successful, but it uses a WD 3.5" external hard drive thats large and 12v powered and I was thinking it would be nice to shrink it in size. 2.5" hard drives are the easiest solution, but I was actually thinking of building a multifunction device that was a bedside weather clock and a BTSync device and in the dead of night a 2.5" hard drive is still going to be super loud!

Ultimately USB memory sticks and SD cards would be the answer, but only come in certain sizes and are quite expensive, so I was thinking it would be useful if I could start with the amount I need (which is like 256gb straight away) then add more sticks later as funds permit, without worrying about how much it costs. So I could get a 256gb, then just add a 64gb, then maybe 128gb and so on.

I wondered if there was a method for which you could get the pi to mount a disk when it was inserted and essentially just add it on to existing storage?

User avatar
RaTTuS
Posts: 10365
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Multiple usb disks as one with Pi?

Thu Oct 06, 2016 2:47 pm

yes there is but in reality it is best avoided - if ones dies they all die...

you can add a new drive and mount it anywhere on the file system.

or also see SSD's for size and quietness.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Multiple usb disks as one with Pi?

Thu Oct 06, 2016 3:22 pm

bugsy_malone 666 wrote:I thought at the moment I have a 1tb btsync server at home running a model B,
if I could start with the amount I need (which is like 256gb straight away) then add more sticks later
If you already have the 1T server in the house, why does your bedside clock radio thing need 256+ gigs?

User avatar
bugsy_malone 666
Posts: 289
Joined: Mon Dec 17, 2012 10:50 pm
Location: Basingstoke UK

Re: Multiple usb disks as one with Pi?

Thu Oct 06, 2016 6:26 pm

RaTTuS wrote:yes there is but in reality it is best avoided - if ones dies they all die...

you can add a new drive and mount it anywhere on the file system.

or also see SSD's for size and quietness.
SSDs are not all that cheap and also are 2.5" memory sticks are a fair bit smaller.

The thing you say about the one that if it dies all die, that sounds a bit like RAID(in some cases), only surely thats not how it should work. I guess I am looking at the PI controlling its directory structure and storing the files on the drives.

User avatar
bugsy_malone 666
Posts: 289
Joined: Mon Dec 17, 2012 10:50 pm
Location: Basingstoke UK

Re: Multiple usb disks as one with Pi?

Thu Oct 06, 2016 6:30 pm

stderr wrote:
bugsy_malone 666 wrote:I thought at the moment I have a 1tb btsync server at home running a model B,
if I could start with the amount I need (which is like 256gb straight away) then add more sticks later
If you already have the 1T server in the house, why does your bedside clock radio thing need 256+ gigs?
The 1tb server is taking up a plug socket along with a Pi B downstairs, moving it upstairs is a piece of cake, however the 1tb drive is not exactly quiet or small, this coupled with the fact I find it a little extravagant to have a Pi as a clock, when I already have a Pi that only does stuff when new files are added and need to be backed up, therefore it seems more efficient to have an expandable file system all in one device which is the clock, only using one power socket in the house total, silent running freeing up space elsewhere in resources.

Then I can re-purpose my 1TB for additonal file storage for one of my PCs.

epoch1970
Posts: 3322
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Multiple usb disks as one with Pi?

Thu Oct 06, 2016 7:38 pm

I don't know how LVM works on Pi, I've stopped using that a long time ago.
But I have used a union filesystem (mhddfs, FUSE based) and it works very well when you want to provide a read-only, unified view of multiple volumes.
Unless unioning filesystems have made groundbreaking progress, using a union of multiple drives in R/W mode is fragile. But if you can manage to write to /mnt/A and /mnt/B directly, then a RO union (A+B) should work fine for servers and clients.
I have a raspbian Pi2 that inlines 6TB of data out of 2x3TB 2'5 hdds, works perfectly (and it's silent because it is accessed remotely through the LAN.)

Unioning works at file level, not storage block level. This is interesting for a low-maintenance, low-power server :
- You don't have to rush repairing the issue when a drive dies; by and large the machine can continue to operate normally, only with a smaller set of files.
- Each drive is independent and goes to sleep when not in use. (Spin-up takes some time but over the network it shouldn't show that much.)

(I'm not rooting for mhddfs, as I believe it is no longer supported. I'd like to know which is the current fs of choice for this.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

ejolson
Posts: 3224
Joined: Tue Mar 18, 2014 11:47 am

Re: Multiple usb disks as one with Pi?

Fri Oct 07, 2016 6:32 am

bugsy_malone 666 wrote:I wondered if there was a method for which you could get the pi to mount a disk when it was inserted and essentially just add it on to existing storage?
The feature you are looking for is provided by modern filesystems such as zfs on Solaris and btrfs on Linux. Raspbian uses a recent enough Linux kernel to have good btrfs support. The filesystem works by storing files in a data pool consisting of multiple drives. Drives may be added or subtracted from the pool at anytime. RAID levels 1, 5 and 6 are supported as well as snapshots that allow you to efficiently store multiple versions of the filesystem hierarchy with copy on write semantics when files are changed. You have to be careful that all volumes in the storage pool are online before mounting the filesystem. Subject to this caveat, btrfs seems to be exactly what you want.

User avatar
RaTTuS
Posts: 10365
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Multiple usb disks as one with Pi?

Fri Oct 07, 2016 6:49 am

I've used 1.8" SSD on a RPi before now on a RPi
they sit comfortably underneath ok
they are not as cheep as usb sticks I'll grant you - but they do perform more like a hard drive so random read / writes don't lock the system up .. [see deadline instead of CFS etc]
it's all down to space and needed

if you are just expanding randomly then LFS will do the trick, but a more measured approach is always better

mount points and judicious use of file tress work great
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
bugsy_malone 666
Posts: 289
Joined: Mon Dec 17, 2012 10:50 pm
Location: Basingstoke UK

Re: Multiple usb disks as one with Pi?

Fri Oct 07, 2016 6:56 am

ejolson wrote:
bugsy_malone 666 wrote:I wondered if there was a method for which you could get the pi to mount a disk when it was inserted and essentially just add it on to existing storage?
The feature you are looking for is provided by modern filesystems such as zfs on Solaris and btrfs on Linux. Raspbian uses a recent enough Linux kernel to have good btrfs support. The filesystem works by storing files in a data pool consisting of multiple drives. Drives may be added or subtracted from the pool at anytime. RAID levels 1, 5 and 6 are supported as well as snapshots that allow you to efficiently store multiple versions of the filesystem hierarchy with copy on write semantics when files are changed. You have to be careful that all volumes in the storage pool are online before mounting the filesystem. Subject to this caveat, btrfs seems to be exactly what you want.
This sounds more like the ticket. I am curious, you mention that all volumes in the storage pool are online before mounting the file system, in terms of having a USB stick, would this be a case of having an automount of USB drives and then just shutting down the server, inserting the additional storage then turning it back on?

That sort of downtime would be cool with me.

I suppose basically the plan being that the USB sticks would be in a 10 port hub, over time I may add or upgrade the storage amounts and because I have 2 BTsync servers if the files are missing from one they will automatically duplicate so I have 2 sets of files. Presumably if you remove a drive a replace it with a different one it doesnt affect the file structure like only complete files are stored on each device rather than single files over a couple of volumes?

ejolson
Posts: 3224
Joined: Tue Mar 18, 2014 11:47 am

Re: Multiple usb disks as one with Pi?

Fri Oct 07, 2016 6:57 pm

bugsy_malone 666 wrote:I suppose basically the plan being that the USB sticks would be in a 10 port hub, over time I may add or upgrade the storage amounts and because I have 2 BTsync servers if the files are missing from one they will automatically duplicate so I have 2 sets of files. Presumably if you remove a drive a replace it with a different one it doesnt affect the file structure like only complete files are stored on each device rather than single files over a couple of volumes?
In RAID level 5 or 6 mode btrfs will scatter bits of the files all over the storage pool. Due to bugs, it is probably best to use RAID level 1. In this case I think that complete copies of each file are kept on at least two of the drives in the pool. Thus, if a drive fails unexpectedly the system automatically recovers; however, if you are planning to remove a drive, it is better to use the "btrfs device delete" command to move the affected files to the other drives first. Adding a drive is accomplished by a "btrfs device add" command followed by a "btrfs balance" command.

It is an interesting idea to make a storage pool using 256GB thumb drives and a powered 10 port USB hub. If you do this, it would be quite nice to hear how it works out.

Return to “General discussion”