Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have /var on a separate drive and now I want to add /backup to that same drive. How would I do that?

When I installed Ubuntu, I put / on an 80 GB drive and had a 250 GB drive use /var. I want my backups to reside on the 250 GB drive since they can take up quite a bit of space.

share|improve this question
    
Do you want them as separate partitions or to link to separate paths on the same partition? –  neon_overload May 3 '12 at 5:17
    
Separate paths on the same partition I guess. –  Mike Wills May 3 '12 at 5:23
    
Do You want to Mount the same device on multiple path ? If Yes, then its possible but not at all good idea. I would suggest you to link. –  user59847 May 3 '12 at 5:24
    
I clarified some on why I am asking. –  Mike Wills May 3 '12 at 5:30

1 Answer 1

up vote 1 down vote accepted

Since you specified you'd like them both to be on the same partition on that drive, I'll give you some pointers:

  1. Your existing /var mount probably mounts the entire partition, ie the root of that partition. You can therefore only do that once.

  2. You could, however, have both a /var and a /backup on that partition, ie have both of them one level down. So instead of the root of that partition being your /var, the root of your partition will contain a "var" and a "backup" directory.

    You would then need to mount that drive to one specific mount point, say /mnt/mydrive.

    Then, set up bind mounts from /var and /backup to directories within your /mnt/mydrive, eg to /mnt/mydrive/var and /mnt/mydrive/backup.

    The use of bind mounts allows you to have them in your /etc/fstab just like a normal mount, but it allows you to mount only a particular directory, not the whole partition.

share|improve this answer
    
Would it mess stuff up if I add /var/backup then just create an alias at the root? –  Mike Wills May 3 '12 at 13:46
    
That is a good idea. Keep in mind that a directory called /var/backups is commonly used by certain software, so to avoid confusing the two very similar names you may want to consider a more unique name. But that's up to you. You could also put it as a subdirectory of /var/backups. You could use it as it is there, or bind mount it to /backup as you originally wanted. –  neon_overload May 4 '12 at 1:38

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.