0

Clearing the apt packages cache does not help, neither do I have any extra update packages. Whenever I try to apt install something, it tells me I have no space left. df -h says my /var/ is full, so I'm trying to resize it, but neither fdisk or lvextend seem to work. Do I need a reinstall?

edit: df output

Filesystem       Size  Used Avail Use% Mounted on
udev             7.8G     0  7.8G   0% /dev
tmpfs            1.6G  1.8M  1.6G   1% /run
/dev/nvme0n1p6    23G   15G  7.3G  67% /
tmpfs            7.8G     0  7.8G   0% /dev/shm
tmpfs            5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1p9   1.8G  156K  1.7G   1% /tmp
/dev/nvme0n1p7   9.1G  8.6G   23M 100% /var
/dev/nvme0n1p10  864G   46G  775G   6% /home
tmpfs            1.6G   80K  1.6G   1% /run/user/1000
5
  • but neither fdisk or lvextend seem to work. fdisk by itself won't help, it may allow you to increase the size of that partition if there is unused space directly after that partition, but then you'd still have to resize the partition into the newly added space ... lvextend would help if you were even using LVM, which does not seem to be the case - add the output of fdisk -l /dev/nvme0n1 to the question Jun 8 at 23:22
  • Rearranging partitions on your disk is risky. If you go down that route, ensure you have backups. Before doing that, though, I would use du -s /var/* | sort -n to find out which subdirectory occupies the most space, then drill down if necessary. Or use a user-friendly tool like ncdu. You may be able to delete some of the data in /var. Jun 9 at 1:57
  • Note: go to /var/cache and remove files from there. You may have a lot of old package binaries, and other not more used stuff. Check also /var/tmp. And check if there are backups files (e.g. database) in /var/lib/... but google twice before removing such files (but on cache and tmp: is should be fine). Also clean up /var/log (old logs). lvextend extend the disk, but then you need to expand the volume inside it Jun 9 at 9:11
  • We don't know what else is on there - but in the absence of websites/databases/other stuff, 9G is a LOT of space for /var. Please read the Kali FAQ.
    – symcbean
    Jun 9 at 9:36
  • i literally installed kali like 3 days ago there shouldn't be a space problem albeit Jun 10 at 2:08

1 Answer 1

0

If you originally setup your partitions using LVM then lvextend should just work. If you did not then it is possible to migrate to LVM (replaced your existing partitions with LVM partitions), but that's a whole task in itself.

If there's space on the drive not yet allocated to a partition then you can create a new, larger one using fdisk, then dd the contents across, and finally resize2fs to make the filesystem fit the larger partition (or, you can create a fresh new filesystem and cp -a the data across after). When you're happy the new partition is good you can edit your fstab to swap out /var, and delete the old partition (beware of having two partitions with the same label and/or UUID).

If there is no unallocated space (or not enough), then you can mv one or more of the /var subdirectories to /home (for example), and replace the original directory with a softlink (or bindmount).

Actually, that last option is also the easiest. Just be lazy and do that. :)

2
  • the problem is var having 9gb full for some reason even though it should be empty, even with the last step i cannot do that during runtime Jun 10 at 2:12
  • OK, but that's not the question that you asked. Also, yes, you probably want to boot from a "live" CD/USB to make these changes when the OS is not active.
    – ams
    Jun 12 at 10:12

You must log in to answer this question.

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