Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

4 Answers 4

up vote 3 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.