Move /var directory to a new partition

skp18

New Member
Joined
Dec 4, 2022
Messages
16
Reaction score
1
Credits
152
I'd like to move /var directory to a new partition on the SAME disk. I'm not adding any new hard disk.
I tried the following commands to do so. Can someone help with the last 2 commands? Also, how do I make sure it doesn't use old /var anymore?

lsblk
mkdir /mnt/newvar
blkid
mount /dev/xvda1 /mnt/newvar
df -h /mnt/newvar/
rsync -aqxP /var/* /mnt/newvar/

umount /mnt/newvar/ /mnt/var/
the above command throws no mount point specified.

vi /etc/fstab
how to add the new partition in fstab?
 


I'm not really sure, as I've never done it. Someone here will likely know - and will hopefully share.

On some forums they'd likely just tell you to not do that, 'cause /var is maybe a few GB in size, and then not actually help you. Here, I'm sure someone'll help you *if* they know how. This sounds like something @f33dm3bits would know, actually.

But, I do wanna know what your motivation is. Why would you want to put /var on its own partition?
 
Why would you want to put /var on its own partition? The disk size is 200GB. I have 150 GB of free space. I can set 50GB for /var. Moreover, it's a requirement that I have to create a new partition.
 
Moreover, it's a requirement that I have to create a new partition.

Ah, this is schoolwork?

We *help* with schoolwork but seldom give exact instructions, 'cause... Well, you know... It's schoolwork and folks should be learning.

Don't worry, I'm not slagging on you or anything, it's cool to ask questions when you need help.
 
Why would you want to put /var on its own partition? The disk size is 200GB. I have 150 GB of free space. I can set 50GB for /var. Moreover, it's a requirement that I have to create a new partition.
On a desktop system putting /var on it's own partition isn't going to give you any advantage on a server it will in case some log files or directories grow during the night when you are away and the /var filesystem runs out of disk-space. You will have to do it during live boot when no changes are being made my the system, otherwise there might be a chance that some file can get corrupted when syncing the files from the old to the new partition. For fstab just name of the volume or partition mount location filesystem option, just have a look at /etc/fstab as to see what / looks like.
 
Ah, this is schoolwork?

We *help* with schoolwork but seldom give exact instructions, 'cause... Well, you know... It's schoolwork and folks should be learning.

Don't worry, I'm not slagging on you or anything, it's cool to ask questions when you need help.
Maybe, but how many people do schoolwork on Christmas Eve?

If it is schoolwork, the teacher could be one of the members here, watching for new threads. Hey, they could be me. ;-)

I agree, it is cool to ask questions.
 
Maybe, but how many people do schoolwork on Christmas Eve?

Those who are behind on their work, 'cause they're stuck figuring out how to move /var to its own partition?

I used to do schoolwork pretty much any day of the year. In a way, I kinda miss it.
 
Use gparted to first shrink your /home by 4-5GB. Add a partition of same size and format it.

edit you etc/fstab file to depict changes made.

NOTE: some prefer a non-journaling file system for /var
 
In Puppy, we'd simply move /var to a new location, delete the old one, then sym-link it back. But most of us run multiple Puppies; we'd do this from a different Puppy, and the moving would all be done manually, by actually digging around in the file-system! (*shock, horror!*) I'd do this in about 2 minutes, tops.....without even thinking about it.

Not exactly relevant here, I suspect. Hell. We're highly "unorthodox" in Puppy-land..... :D

(*shrug*)

Mike. :p
 
We're highly "unorthodox" in Puppy-land.....
I never fell under the bell curve, anyways! Long Live Puppy!

Happy New Year!
 

Members online


Top