Sample Header Ad - 728x90

I have been trying to move /var to a new partition but the data disappears

1 vote
2 answers
650 views
I have been attempting to move my /var folder to a new partition. I am using Debian 10.7 and have an 8GB processor so am trying to save space. I have tried several things but part of the data always seems to disappear. Here is what I have tried: 1. Create new partition /dev/sda7 2. mount /dev/sda7 to /mnt/newvar in /etc/fstab 3. boot into single user mode 4. mount / -rw -o remount 5. cp -arpPv /var/* /mnt/newvar (when I examine the /mnt/newvar folder, it is the same size as the /var folder so I assume the copy worked correctly, all folders appear to be there) 6. mv /var /var.old 7. mkdir /var 8. edit /etc/fstab and mount /dev/sda7 on /var 9. restart system When the system comes up, several folders are not viewable in /var, but if I boot to a rescue USB I can see all the folders on /var from there. Can I delete the /mnt/newvar folder? and the /var.old folder? If I do that then I seem to permanently lose the unviewable folders/files. I wanted to move this folder to a new partition in order to make the rest of the system read-only and would like to conserve space. if I can't delete the old folders then using a different partition does not help much with that. Can anyone tell me why some folders are not viewable and how do I keep from losing my data permanently?
Asked by newBird (11 rep)
Jun 23, 2021, 10:07 PM
Last activity: Sep 10, 2022, 07:32 AM