I moved the /var directory to a new disk/partition, this part worked well, but I forgot to delete/move the old /var path and it is still using space on / (root) partition. How could I delete the old /var without redo all the process? Any ideas?
This is what I did so far:
fdisk -l
mount /dev/sdb /mnt/newvar/
df -h /mnt/newvar/
rsync -aqxP /var/* /mnt/newvar/
umount /mnt/newvar/ /mnt/var/
umount /mnt/newvar/
umount /disk2/
umount /mnt/newvar/
ls -la /mnt/newvar/
df -h
vim /etc/fstab
fstab content:
UUID=c7c73822-b6e8-4aa4-a4b2-41a70c29568f /boot ext2 defaults 0 2
/dev/mapper/zabbix--vg-swap_1 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
UUID="3195ad53-3aaa-418c-bdc0-d341e33d76d3" /var ext3 defaults 0 2
Result of the above command:
df -P / /var
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/zabbix--vg-root 11758232 10103908 1033988 91% /
/dev/sdb 25671996 8720916 15640360 36% /var
/varmountpoint? – polemon Oct 06 '21 at 15:34df -P / /varwould confirm that you have/varon a different partition. – doneal24 Oct 06 '21 at 17:59/var. Then they make filesystem B, containing only the contents of/var, and mount that on/var. Now the contents of/varon filesystem A are not visible, since fs B is mounted on top of that. Deleting/varwould remove the contents of B, probably causing some trouble, but would leave the now useless "invisible" stuff in place. So no, you can't look at that as just deleting a directory. – ilkkachu Oct 06 '21 at 18:13/dev/fd0on your system? Haven't seen an automounted floppy drive in a while. – doneal24 Oct 06 '21 at 18:39/varis created and used before/dev/sdbis available. Moving/vardoesn't seem like the best choice. Readman hieror https://www.man7.org/linux/man-pages/man7/hier.7.html – waltinator Oct 06 '21 at 21:28/dev/sd?devices become available to initrd at the same time. – doneal24 Oct 07 '21 at 12:28