I have a production server for which I would like to move the /home, /opt, /tmp, /user, /var to the ~300GB partition specially created for this purpose.

No straightforward explanation found on how to do this, except that I can put every folder specified above on a separate partition, but I don't want to do that. Reasons:

  1. I don't know how much space these folders might use in the end, so one drive with all of it will do nicely.
  2. I see it much simpler for me. I don't want to have tons of partitions on the same drive.
  3. I will install a server app, that will do much I/O and a MySQL server, and I don't want it to slow down the system hard drive or interfere with it.
  4. Intelligent partitioning

Is there any way to achieve what I want, so all would work as if the folders are on the same hard drive?

P.S. These are the most rellevant links I've found so far:




Thank you!


All mounted!

UUID=rootUUID / ext4 errors=remount-ro 0 1
UUID=swapUUID none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
UUID=otherDriveUUID /mnt/sdb2 ext4 defaults 0 1
/mnt/sdb2/tmp /tmp none defaults,bind 0 2
/mnt/sdb2/local /usr/local none defaults,bind 0 2
/mnt/sdb2/home /home none defaults,bind 0 2
/mnt/sdb2/opt /opt none defaults,bind 0 2
/mnt/sdb2/var /var none defaults,bind 0 2

  • Edited. Please review the on hold state and off-topic.
    – XMight
    Nov 19, 2015 at 17:55
  • 1
    If you think it is expensive to replace an unreliable hard drive, then you probably don't know how much it can cost to keep using an unreliable hard drive.
    – kasperd
    Nov 19, 2015 at 21:28

1 Answer 1


What you're looking for is bind mounts. See http://man7.org/linux/man-pages/man8/mount.8.html for details.

Here is a step by step guide to moving /home, /opt, /tmp, /usr, and /var to a single separate partition.


I am not responsible for any damage or loss of data caused by following this guide. As always, ensure all important data is backed up before proceeding.

Step 1

Boot from your favourite live CD. Example: https://www.debian.org/CD/live/

Switch to root shell. This can often be done with sudo su -

Step 2

Mount your primary and secondary partitions. We'll assume that they are /dev/sda1 and /dev/sdb1 for the purpose of this guide.

mkdir /mnt/sd{a,b}1
mount /dev/sda1 /mnt/sda1
mount /dev/sdb1 /mnt/sdb1

Step 3

Move existing folders/data from primary to secondary partition. This may take a few minutes depending on the size of the folders and speed of your drives.

mv /mnt/sda1/{home,opt,tmp,usr,var} /mnt/sdb1/

Step 4

Create empty folders on the primary partition to give us mount points.

mkdir /mnt/sda1/{home,opt,tmp,usr,var} /mnt/sda1/mnt/sdb1

Step 6

Edit your fstab to automatically mount the secondary partition and bind mount the appropriate folders. This step is largely subjective to your current configuration and may not work as a direct copy/paste.

Edit /mnt/sda1/etc/fstab with your favourite editor.

You can find detailed information on the fstab at http://man7.org/linux/man-pages/man5/fstab.5.html

First we need to mount the secondary partition before we can bind mount to it. This partition may already be in your fstab. If so, edit/remove the configuration accordingly. Here, we'll assume it's an ext4 partition with default options.

/dev/sdb1 /mnt/sdb1 ext4 defaults 0 2

Next, configure the bind mounts.

/mnt/sdb1/home /home none defaults,bind 0 0
/mnt/sdb1/opt /opt none defaults,bind 0 0
/mnt/sdb1/tmp /tmp none defaults,bind 0 0
/mnt/sdb1/usr /usr none defaults,bind 0 0
/mnt/sdb1/var /var none defaults,bind 0 0

Save your changes to the fstab.

Step 7


  • Thank you very much for the reply. I will try all steps, and if these will work, I will accept the answer. Also, very nice done and pretty explicit!
    – XMight
    Nov 18, 2015 at 21:49
  • What I get is: mounting /mnt/sdb2/usr on /root/usr failed: No such file or directory, though I created the empty folder under root, and the other one contains all the data I moved. Also, fstab contains: /dev/sdb2 /mnt/sdb2 ext4 defaults 0 2 and /mnt/sdb2/usr /usr none defaults,bind 0 0 (Also with all other folders). What could be the problem?
    – XMight
    Nov 19, 2015 at 22:31
  • As you are mounting in /root, I assume you are sand boxing the mounts first. Have you run mount -a (mounts all entries in /etc/fstab) or rebooted after updating your fstab? Nov 19, 2015 at 22:37
  • I modified everything using debian live CD as you suggested. Rebooted. The message appears just after reboot, with some failed messages after it. Did not run any mount -a
    – XMight
    Nov 19, 2015 at 22:42
  • Are you intentionally trying to mount in /root? Does /root exist anywhere in your fstab? Nov 20, 2015 at 0:09

Not the answer you're looking for? Browse other questions tagged .