• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

What's the best way to swap the mount points of two partitions?

On my Mandrake 10 server I have /home pointing to a big partition that's sitting unused and a much smaller /var that's almost full. I want to basically swap the mount points so the /home is the smaller partition and the /var is the bigger one. What's the best procedure? (No gui available)
0
billmercer
Asked:
billmercer
1 Solution
 
dufdufCommented:
All of this should be done as root in single user mode. First make a temporary mount point for that /var

mkdir /tmpvar

Now swap the mount points

mount --bind /var /tmpvar
mount --bind /home /var
mount --bind /tmpvar /home

Now your /home is bound to /var and vice versa. Now move all the stuff to right directories. I'd probably try something like this:

tar zcvf /var/home.tar.gz /var/*
remove every homedir from /var
mv /home/* /var
mv /var/home.tar.gz /home
cd /home ; tar zxvf home.tar.gz

Then edit your /ect/fstab to match the new setup.

Try not to get confused with /var and /home. I know I did. Thankfully all this was just a mental rehearse for me.
0
 
billmercerAuthor Commented:
Terrific answer, gave me exactly what I needed. Thank you very much!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now