Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am installing an SSD and would like to put / on the SSD and /home, /var, and /tmp on the HDD. My current distro is Kubuntu but I would not mind trying another distro if this procedure can be accomplished easier there. I have installed many different Linux OSes on multiple partitions, however I know of no installer that lets one mount multiple directories on a single partition. I would rather not use three separate partitions as particularly /home, /var, and /tmp are prone to large changes in size and it is not practical to allot each of them some arbitrary maximum.

Note that I am discussing a new install, not moving the current system to the SSD / HD split.

share|improve this question
2  
If the installer doesn't support this just do it manually afterwards. – scai Sep 5 '12 at 12:05
    
@scai: /etc/fstab maps partitions to directories, not directories to partitions. – dotancohen Sep 5 '12 at 12:13
1  
I don't see the problem, you can for example use the bind option of mount. – scai Sep 5 '12 at 12:26
    
Thank you, I have not heard of mount's bind option. – dotancohen Sep 5 '12 at 13:16
up vote 19 down vote accepted

There are two approaches you can use. For either approach, you need first mount your hard disk partition wherever (for example, under /hd) and also add it to /etc/fstab, then create home, var, and tmp inside the mount.

  1. Use symlinks. Then create symlinks from /home to /hd/home, etc.

  2. Instead of symlinks, use bind mounts. Syntax is mount --bind /hd/home /home. You can (should) also put that in fstab, using 'bind' as the fstype.

The basic way to get it to install like that is to set up the target filesystem by hand before starting the actual install. I know its easy enough with debian-installer to use the installer to create your partitions, mount, and then switch to a different terminal (say, alt-f2), cd into /target, and create your symlinks (or bind mounts). Then switch back to alt-f1 and continue the install. Ubuntu's (and I assume Kubuntu's) installers are based on debian-installer, so I assume similar is possible.

share|improve this answer
    
Thank you. In fact Ubuntu is soon dropping support for debian-installer! I will play around with the two approaches, I am not familiar with mount's bind option. – dotancohen Sep 5 '12 at 13:16
2  
For a comparison between symlinks and bind mounts, see this question: unix.stackexchange.com/questions/49623/… – Flimm Jul 3 '13 at 16:26

To answer the original question, yes it is able to. No symlinking, mounting or binding is needed, the installer can do it itself. I just tried it today while playing with an x64 Kubuntu 12.04 LTS alternate on VirtualBox. My revised plan was to create 3 partitions on two separate disks.

1) /root - 8 GB sda/sda1

2) swap - 4 GB sda/sda2

3) /var, /tmp, /home (noatime and nodiratime set for speed) - 120 GiB sdb/sdb1

Using VirtualBox I gave 120 GiB dynamically expanding space for the partitions, then started the installation and went through the steps until I arrived to partitioning.

The steps I've taken during partitioning.

  1. I chose Manual partitioning instead of guided.
  2. Selected SCSI1 (sda) disk 120 GiB
  3. Chose pri/log 120 GiB FREE SPACE
  4. Created a partition for /root and another for swap using the Create new partition option
  5. Selected SCSI2 (sdb) disk 120 GiB
  6. Created a third partition for /var, /tmp, /home using the Create new partition option, then selected free space and let the partitioning tool use all available space.

During the creation of the third partition, I went to the Mount point, there I hit ENTER again and chose, Enter manually. Here I added the following, only separated by a comma ,

**/var,/tmp,/home**

Next was Mount option, here I set noatime and nodiratime.

/var,/tmp,/home on a different disk, using the same partition, mounted by the installer

I've tried the desktop installer version too, in this case the noatime and nodiratime options weren't available.


I wish to clarify, that this example was created this way for the sake of simplicity, to give a simple solution to simple question related to a complex topic. Please see it as a proof of concept, nothing more.

The VirtualBox dynamic disk allows for growth until the size limit is reached and I did not state that the fixed size disks will grow automatically. I did not plan to cover partition resizing in my post.

I've changed this post based on the discussion below to match the asker's question more adequately.

share|improve this answer
    
This is misleading and doesn't answer the original question, which is about mounting multiple directories on the same partition. What you did is to partition your (virtual) hard disk into four separate partitions each with fixed allocations of space. – Wildcard Feb 26 at 22:41
    
Let me cite the question: "I would not mind trying another distro if this procedure can be accomplished easier there. ... I have installed many different Linux OSes on multiple partitions, however I know of no installer that lets one mount multiple directories on a single partition." For the sake of simplicity I used only one disk with four partitions. The method is the same for two disks with whatever number of partitions. As you can see the sda2 partition has /var and /tmp mounted. Believe me it's a dynamically allocated storage under VirtualBox. – elbedoit Feb 26 at 23:03
    
It seems you ignored the rest of the question: "I would rather not use three separate partitions as particularly /home, /var, and /tmp are prone to large changes in size and it is not practical to allot each of them some arbitrary maximum." Your setup is dynamically allocated under VBox but that's dynamic at the wrong layer of abstraction; the /home partition, for instance, is a fixed-size 10 GB and you will have to research "extending MBR partitions" if you want to let it grow bigger—a very non-trivial task. – Wildcard Feb 26 at 23:31
1  
About the size issues. In my reading the asker wanted to put all those folders on a single large disk, and didn't want to care about resizing. In this context the example may help the asker to achieve his goals. – elbedoit Feb 26 at 23:53
1  
@Wildcard: Tanks for the comments, first I thought tat you are just trolling, but I see that I can improve my post :) – elbedoit Feb 28 at 10:25

Your Answer

 
discard

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

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