1

My PC is running out of space. I need a temporary solution to store some files.

When I installed the system I created a partition where /var is mounted with 50GB, and currently it has around 40 GB free. Can I copy my files into that partition? What is the minimum space I should leave free under /var?

2
  • yes I've used /var to store data myself temporarily; but I have no idea how much you should leave. a quick look at my own (du -h /var) showed it at 5gb. the size you need in your directory is dependent on your usage (what is running, apps etc) as shown by your system using double mine. on my current workstation I'd happily use 30gb (if I had it free), but know on one server I'd not borrow any (its role uses /var quite a bit)
    – guiverc
    Nov 25, 2017 at 11:10
  • 2
    50gb on /var/? Why? :D What you can do is create a dir in /var, chown it to yourself and then copy files to it. As a temp(!) fix though. 5Gb is more than enough, I would advice to remove the mount and include /var in / .. /var used to be a mount for servers (mysql stores it database in /var by default). Not really needed for a desktop.
    – Rinzwind
    Nov 25, 2017 at 11:12

1 Answer 1

2

Can I copy my files into that partition?

Yes, use sudo mkdir /var/directory to create "directory" and then do a sudo chown $USER:$USER /var/directory and you can move/copy files to /var/directory. Use it as a temporary method though and not to permanently store files.

What is the minimum space I should leave free under /var?

0; with a partition a few Gb 1, 2, 5 is enough. I doubt it will use up extra space when just using your system. /var will get used when installing new software but to fix your space problem you can just not do that.

A desktop should not have a /var/ partition. For servers there is softwares that use /var to store data (like MySQL) and even those have settings to put the data somewhere else.

My PC is running out of space. I need a temporary solution to store some files.

  • you can also use a USB disk.
  • you can also store files on google drive.
  • you can also remove the /var/ partition (it is not really difficult but do consider making a backup 1st though).

    • Boot from a live media
    • You will have several disks on the launcher or on the desktop
      • Mount /var partition in /mnt/var
      • Mount the root directory in /mnt/root
    • Edit /mnt/root/etc/fstab and remove the line that holds the /var partition
    • Remove the old mount point with rmdir /mnt/root/var
    • Run cp -a /mnt/var /mnt/root/var
    • Boot the real OS

  • I would advice the following setup for desktops:

    • a /. 25 Gb is more than enough.
    • optionally a /home of 10 Gb.
    • /{datapartition}. Move the directories from /home/ do /datapatition, edit ~./config/users-dirs.dirs to point to that location.

With that you are 100% certain backup of /data/partition backups up all your data and when reinstalling you format /, /home (if you created that) and just mount /data/partition. When you have a SSD and HDD and you put the system on the SSD and the datapartition on the HDD you can even take out the harddisk, put it into another system and you have all your data available.

I once set my system up like that and have moved to 2 new notebooks (all with 2 harddisk slots) using a new SSD and the same 1Tb HDD.

3
  • Thanks! Very clear answer. I just have one question. I was once advised to put /tmp and /var on the HDD instead of the SSD, because these directories are frequently written to and an SSD has a limited number of read/write cycles. Can you give me your advice on this? Thanks again!
    – a06e
    Nov 25, 2017 at 17:28
  • 1
    Well. If the ssd ever fails I get a new one ;) I started using SSDs pretty early and have yet to have 1 die on me so I do not consider is an issue. The last bit of the answer: breaking my SSD was the reason for me to set it up like that: take the ssd out, put in a new one and install the OS. mount hdd and done.. Regarding /tmp/: that by default is a temporaty filesystem in MEMORY/RAM so does not need an actual partition (see df -h and notice the 'tmpfs' at the left ;)
    – Rinzwind
    Nov 25, 2017 at 17:35
  • @Rinzwind Why would one want to format /home. My home is a separate partition than root. Isn't it reinstalling just requires formatting root?
    – Porcupine
    Aug 18, 2021 at 22:29

You must log in to answer this question.

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