Is it possible to mount two or more disks (/dev/sda3, /dev/sda4) on one directory (/var/www)?

If yes, then how can I do this (Debian 5.0.6)?

Thank you!


It depends what you are trying to achieve.

If you want to merge to blocks of space into one large filesystem then you can use LVM to create a volume group over the two partitions and create a logical volume in that, or you can use RAID0 to merge the spaces (and get a performance boost for some access patterns too).

If you want to create some redundancy so both have the same content for redundancy's sake then you can use RAID1.

(You could also use LVM over RAID0 or RAID1 to pickup the flexibility of LVM as well as the benefits of the chosen RAID setup)

If you want to merge files and directories on two distinct filesystems then you need a union filesystem like AUFS. There are several union filesystems available, each with different goals+features and so different advantages and disadvantages, like AUFS and UnionFS which are kernel-level options and user-space ones like unionfs-fuse based on FUSE.

Which option is best for you (if any is suitable, of course) will depend exactly what you are trying to do - you should add more detail to your question if you can.

Edit: I've just realised that the two partitions you are talking about are on the same drive (sda). As pointed out by symcbean this makes RAID a bad option. RAID1 would not offer redundancy in this case (if the drive dies both mirrors are gone) and both RAID0 and RAID1 would decrease performance (where over multiple drives they can improve it) as they would add extra head movements to sequences of IO operations. This leaves you the LVM and union-fs options (depending on what you are trying to do and if the partitions are already in use or not) and adds the new option (as noted by symcbean) of replacing the partitions with a single one if they are currently empty.


Yep, that's what RAID is for. Depending on your needs, either RAID0 (not recommended) or RAID1 the two disks together using mdadm and you'll be all set.

Here's a decent tutorial that should be able to get you started.


As far as I know this is not possible. And what would you like to achieve with it anyway? If it is your intention to provide redundancy, then bind the two drives (well, they are actually partitions) into a RAID1 array.

But maybe you can explain what your aim is and then we can see what can be done.


Yes - others have already mentioned RAID - but note this presupposes that the partitions are currently blank.

But using partitions from the same physical disk rather defeats the whole purpose of RAID, and RAID-0/JBOD is certainly a rather stupid thing to do with partitions from the same disk.

Why not just delete the 2 current partitions and replace them with a single one?

Your question is very vague about what you are trying to acheive here. The right answer might be to mount one disk on /var/www and the other on, say, /var/www/more

OTOH you might want to have a look at overlay filesystems (e.g. unionfs)

Your Answer

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