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've recently just installed ubuntu 14.04 and i'm still very new to linux/ubuntu. I've got a laptop in which i have installed an 120GB SSD and a 750GB HDD. Currently, i have ubuntu installed on the SSD and mounted the HDD through fstab to /mnt/var. Now the thing is i want to have programs installed on the HDD and keep the SSD clean for ubuntu. As far as i understand programs are installed in the /var directory, and so i have been trying to copy the current data from /var to /mnt/var and then editing fstab to mount the HDD to /var. But whenever i reboot i get alot of different issues. First it said it couldn find drivers etc. Than after another try doing it a bit different it just plainly couldn't find /var. So my question here is, and i'm sorry if this has been asked before but i followed a bunch of different guides and none worked for me, how do i properly set it up they way i want?

share|improve this question
1  
Hmm, it just feels like the 750gb drive is there for nothing than. The way i used to manage my stuff on windows was to put everything i don really use often and uses alot of space on the HDD and the stuff i used regularly and wanted to be fast on the SSD. Is there no way to manage my stuff the same way on ubuntu? –  Taerus May 25 at 14:41
    
Also, my drive might get filled up really fast. It's only 120gb. How would i use the 750GB optimally? –  Taerus May 25 at 14:42
    
possible duplicate of How can I store /var on a separate partition? –  bain May 25 at 15:53
3  
Do you use another OS on your SSD? If you only use Ubuntu on the SSD, you will have lot of free space. My full installation of Ubuntu only uses 6 GB (my /home/ has its own partition). –  A.L May 25 at 15:55
    
@bain I suggest giving Taerus a chance to decide for himself if storing /var on a separate partition is the best way for him to do it before the question is flagged as a possible duplicate. –  karel May 25 at 15:59

3 Answers 3

up vote 15 down vote accepted

That's a bad idea. If you put the installed applications on the SSD you'll get a more stable operating system and better performance. You've got a 120GB SSD, so you should not hesitate to use it for your installed applications.

Your 750GB hard drive is certainly not there for nothing. Here is my suggestion for how to use the 750GB hard drive optimally. Install Ubuntu on your SSD, including your /home directory, EVERYTHING goes on your SSD. Then use your 750GB hard drive as a data drive to store your personal files. No matter what happens to your operating system, your personal files will be protected and accessible on the 750GB hard drive. Even if your operating system becomes completely unusable or if you do a fresh install of Ubuntu, all of your personal files will still be there intact on the 750GB hard drive.

You don't need to worry about your 120GB SSD being too small. A 120GB SSD has more than enough space to install Ubuntu in this way. In fact even a 60GB has more than enough space for Ubuntu and a lot of installed applications.

On my Ubuntu there are a few files that I use regularly. In order to improve performance and open these files fast, I keep these files on my SSD too in my /home directory. I don't have many of these files, so my /home directory is quite small.

share|improve this answer
    
Thanks for the advice, and i will stick to this. Maybe in the future somewhere when i have more expertise with Ubuntu/Linux i might reconsider this. Although if disk space issues will not arise i probably will stick to it forever. Thanks again, highly appreciated. –  Taerus May 25 at 16:10
6  
What I do is to put my home directory on the SSD, but I put documents, downloads, music, video, etc on the larger hard drive, and just add links to the home directory. I will probably try mounting them instead of using links, but I've been doing it this way for a long time, and it works. Also, if I install another OS, I can share the media files easily. –  Marty Fried May 25 at 17:14
1  
Hah, just so happens to be i just did the same :-) You can edit their folder paths somewhere in /home/user/.config/user-dirs.dirs. –  Taerus May 25 at 17:25
1  
@MartyFried I am with you there. I symlimk the directories in /home/ to my 2nd disc. –  Rinzwind May 25 at 18:17
    
@Taerus - Yeah, I learned about that; but I also learned that if you delete, then add the link right away, it's not necessary. I also realized that symlinks might be better than mounting, because my backup automatically does not follow them, so I can backup the media separately. –  Marty Fried May 25 at 20:05

Ok, first, the answers I have seen do not address the 2 most important issues.

First, although I applaud your diving in and trying something, the reason you have run into problems is due to an incomplete understanding of the linux directory structure. Please confirm what follows before blindly following my advice as I am not a regular user of the *buntu flavors of linux, but...

Applications are not (in my experience) generally found in /var, (there are exceptions), most applications are found below the /usr directory, /var is (in ubuntu) used for server related files, logs and caches. also things which would be lost on reboot if stored in /tmp.

There is a tradeoff to be made. /var on a fast drive (such as an ssd) will improve system performance, but due to specifics of ssd drives, may reduce (somewhat) the life of the drive due to more frequent writes.

Nutshell, faster performance, /var on ssd, longer drive life, /var on your 750GB drive.

For reference, all of my system files (openSUSE 13.1) and the whole system directory structure (including /var) exist on a single 64GB ssd.

Karel's information about your data is a little misleading (I believe), in that your data and /home directory are closely tied. My suggestion, mount /home on a partition on the 750GB Drive. This will simplify file management in the long run.

My data and website are the only things not on the ssd, my data (/home, /srv/http are kept on separate drives to ease upgrades or moving to other distributions. (I have files in my /home directory that were created in 1998)

I will answer how to move /var in a post that follows

share|improve this answer
    
You're right. I'd add that software is also installed in other places (/bin, /lib, /opt, &c.). They commonly store things like database files in /var, though. "your data and /home directory are closely tied" Sure, but you can be more flexible, and put stuff outside it. (Or symlink/bind mount so you can use another device but it still looks like it's inside ~.) –  Matt Nordhoff May 25 at 22:46
    
Why two answers? –  Braiam May 26 at 12:48

Me again, BTW I do agree w/ Karel that doing your base install to the ssd is the best option. I also recommend reading a few other tutorials before following my directions.

NOTE: it is much easier to configure your system during a fresh install,

Now if you do wish to create a new mount point for /var there are numerous things to consider.

Some directories will be harder to move because files may be in use, /var is one of these problem children. Anytime your system is active it is likely that data is being written to /var

Another consideration is maintaining the correct file attributes, copy will not do this without the proper flags.

these links could help get you started,

http://lists.opensuse.org/opensuse/2001-11/msg01343.html

http://dev.digi-corp.com/2009/09/moving-opt-data-to-new-partition-in-linux-due-to-low-disk-space

NOTE: I prefer using tar over cp, it is faster and I know it will preserve my file attributes, something like the following (a quick example, some steps have been left out for simplicity)

DO NOT FOLLOW THESE DIRECTIONS WITHOUT UNDERSTANDING WHAT IS BEING DONE

  • Boot from live USB.
  • Use fdisk and mkfs, to create and format a new partition on your 750GB drive, 50GB should be plenty.
  • Mount the new directory.

Like this

mkdir /mnt/var2
mount -a /dev/sdxx /mnt/var2

(replace sdxx with the 50 GB partition you created for your new /var, for example /dev/sdb1)

mount your ssd as /mnt/oldroot

mkdir /mnt/oldroot
mount -a /dev/sdxx /mnt/oldroot

(here /dev/sdxx is the / partition on your ssd, probably /dev/sda1 or similar) You should be able to navigate your old filesystem now, starting at /mnt/oldroot

now you will copy the files from the old /var directory to the new one

cd /mnt/oldroot/var
tar cSpf - . | (cd /mnt/var2 ; tar xvSpf - )

when the copying finishes, compare the 2 directories, if everything looks good rename the old /var directory

mv /mnt/oldroot/var /mnt/oldroot/var.0ld
mkdir /mnt/oldroot/var

All that is left is to edit /mnt/oldroot/etc/fstab to add the new partition as the mountpoint for /var (I will leave this to your imagination)

then

umount /mnt/var2
umount /mnt/oldroot
reboot

If all went well, when you reboot the new partition should be mounted as /var

share|improve this answer

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.