How can I clean parition /var ?
- deleted, cause of damage preventition -
I would not advice it. It contains app data. If you know what you do you can clean /var/log
@marcelemm82m4 can you share your solution/answer please, otherwise we’d better delete this topic?
PS: there’s no need to modify the topic title—you can mark a post as the solution.
I don’t know if I can because answear was deleted and Creator of the script delete that answear so he doesn,t want to share. create the topic once again maybe he send the answear again.
It is likely he realized that the script was dangerous and could easily damage a system and break it so the script was removed.
Some things in /var/log/ and some things in /var/spool/ could be deleted, but not much and only with extreme care for system integrity.
I really have no clue why you would want to “clean partition /var” since that is one of the system partitions and is used for operating the system.
What is the purpose of doing so? Is it lack of drive space?
Quite possibly if you tell us what the actual problem is, a better answer can be provided.
yup, that was me.
I copy-pasted a script to clean under /var/log and after reading it here I notized that some important sign’s in the script were delete.
the culprit were lines like this one
sudo rm ${RM_OPT} /var/log/journal//{@,~,1001};
while editing all star’s “*” are visible and in the preview (or what you see now) all star’s are delete
it should look like this
sudo rm ${RM_OPT} /var/log/journal/*/{*@*,*~,*1001*};
I got not enough time to fix that.
if you had copied/run the script it maybe had damaged your box, so I pulled it.
If you or someone other drop’s me a mail I’ll attach the script to an reply-mail
could you please elaborate what “app data” that are ?
I see only log files.
Afaik, you’re able to delete all files [1] under /var/log without harm.
just reboot and the most [2] deleted files are there again
[1]
not the folders !
maybe the folders too, but it’s not tested by me so far
[2]
e.g. clamav had made some trouble in the past, if I deleted it’s log file, but in my scripts I did a “sudo touch /var/log/<clamav-log-file>” for that case
I mean /var contains application runtime data. For example Postgresql data by default are in /var subdirectory.
Try out the preformated text </>
button or use Ctrl+Shift+C to add code
I personally also not would use a script to clean the /var directory. Since i checked mine today i saw that i had 73GB of data in it. I use libvirt and the default images are all in /var/lib/libvirt/images. This would kill your virtualization.
Thank You for writing to me. Yes only problem is that with lack of free disk space on partition /Var however i prepare it for 20GB. I know that I can’t clean all data from that partition so many thanks for that script . It works , script cleaned from 51% to 41% . I taked that risk because I thinked that last way I reinstalled system fedora preparing usage of partitions in that way: /boot - 4GB, swap - 22GB, /root - 100GB, /home - 100GB and /var - 600GB because of huge needs space of /var partition . Can You tell me why in fedora /var partition grow up so quickly ? Yes i know that i can install fedora on one partition /. but for more security it’s recommended to install every data /boot, /home/ swap, /var , and / root on other partitions.
Sixpack13 thank you very much for that script you have special thanks once again and award from me in the future
Thank You for response. I reboot system and everything is ok for this time. Last way I reinstall system . Many thanks greetings
it seems here is a misunderstanding with my script.
it mainly cleans under /var/log, not /var/
with one exception: in cleans the coredumps under /var/lib/systemd/coredump/
that said: the OP’s cleanup of 10 % should have been coredumps and journals
anyway, the OP wants to clean under /var/, I haven’t overread this.
I know libvirt saves it’s images under /var/
@marcelemm82m4
if you maybe in the next weeks upgrade to F34 and want to avoid such disk space shortages reformat your disk (after an user data backup) as the following
- 1-2 Gb for /boot as ext4 (enough for usually only 3 kernels !)
- only if you really need a swap partition: ~4GB for an desktop [1] (F34 has no swap partition per default)
- and the whole rest [2] of the disk as an btrfs pool
- create btrfs subvolumes for /, /home (maybe /var)
advantage:
all disk space in that btrfs pool is dynamically assigned to your subvolumes
[1]
usually you only need a swap partition for hibernation, but - AFAIK - that’s no more an option under Fedora - I guess - since last release or so
hibernation saves the currently content of RAM to the swap partition and I doubt on desktop’s that the RAM gets filled > 2 GB (see: free -h).
additionally the RAM gets compressed during hibernation process, so - for an desktop - 4GB swap partition is enough (see also: free -h)
the only advantage I see with hibernation is: you could lay off your work and restart as the same point where you layed it off after an reboot, e.g. editing a libreoffice document or such.
with ssd’s in the box [3] it seems that this is the only advantage, but you’ve to take all the hazzle with hibernation into the account, e.g. unload and reload kernel modules and such. I guess nvidia graphic card user know where I’m talking about.
[2]
if your disk is an SSD: leave 10-15% unused (not belonging to btrfs pool) (google “Over-Provisioning”)
[3]
rebooting out of hibernate was an advantage with rotating disk too.
Thank You