Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently got an SSD for my computer. Therefore I reinstalled my system and mounted / on /dev/sda1 (which is a partition on the SSD).

To protect the SSD, I managed to mount /tmp on the RAMdisk. However, I would also want some other folders to be outsourced, not on the SSD but on my RAID1.

The following folders should be outsourced:

  • /var/log
  • /var/cache
  • /var/games
  • /var/tmp
  • (do you have any other suggestions?)

I tried to simply mount those folders on a RAID-partition, just like I did with /tmp (find a part of my /etc/fstab below). Now I know, this was not the right way, instead I would have to use bind.

I would need your help for the following issues:

  • What preparations are necessary on the RAID (what about permissions, especially)?
  • What are the propper mount options in /etc/fstab?
  • Now that I have done it the wrong way, how would I migrate the data to the correct place (and is this even necessary for those folders?)

a wrong part of my /etc/fstab
<raid uuid> is the same for all of these lines

UUID=<raid uuid> /var/log ext4 noexec,nodev,nosuid 0 0
UUID=<raid uuid> /var/cache ext4 noexec,nodev,nosuid 0 0
UUID=<raid uuid> /var/games ext4 noexec,nodev,nosuid 0 0
UUID=<raid uuid> /var/tmp ext4 noexec,nodev,nosuid 0 0
share|improve this question
    
Are those UUID=<raid uuid> the same or 4 different ones? –  John Siu Feb 7 '13 at 21:20
    
Have you considered mounting /var instead of 4 individual partitions? And why not use standard defaults options when mounting? –  Karlson Feb 7 '13 at 21:25
    
I just wanted to outsource folders with frequent write operations - the choice of those four folders traces back to a german page (wiki.ubuntuusers.de/SSD/Auslagerung#Unterverzeichnisse-von-var). I also copied settings from there... however, I don't know if this is a good choice - I'm very open for arguments! –  Marcel Feb 7 '13 at 21:30
    
@JohnSiu the same - one of the reason why it's wrong! –  Marcel Feb 7 '13 at 21:32
1  
Why 2 cache? Is it a typo? –  John Siu Feb 7 '13 at 21:52
show 1 more comment

1 Answer

up vote 2 down vote accepted
  1. Mount the raid partition to /mnt/var

    UUID=<raid uuid> /mnt/var ext4 defaults 0 0
    

    Create mount point /mnt/var

    cd /mnt; mkdir var
    
  2. Reboot

  3. Copy content into /mnt/var

    cp -a /var/log /mnt/var
    cp -a /var/cache /mnt/var
    cp -a /var/games /mnt/var
    cp -a /var/tmp /mnt/var
    
  4. Modify fstab as follow to mount them to /var on next boot

    UUID=<raid uuid> /mnt/var ext4 defaults 0 0
    
    /mnt/var/log   /var/log   none bind 0 0
    /mnt/var/cache /var/cache none bind 0 0
    /mnt/var/games /var/games none bind 0 0
    /mnt/var/tmp   /var/tmp   none bind 0 0
    
  5. Reboot

share|improve this answer
    
thank you! I would rather have all folders in the same partitions (as I then don't have to care about what size each partition needs). Is this possible? –  Marcel Feb 7 '13 at 21:53
    
Yes, that will need to use the bind option. I will update. –  John Siu Feb 7 '13 at 21:55
    
thank you very much! –  Marcel Feb 7 '13 at 21:56
1  
Verify that they are mount as intended, type mount. –  John Siu Feb 7 '13 at 22:11
1  
thanks! I also want to add that df -h is good to verify that everything worked. –  Marcel Feb 7 '13 at 22:22
show 2 more comments

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.