Moving /home partition

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Moving /home partition

Postby lightblue » Dec 2nd, '15, 22:26

Hi amigos,

I have an SSD and an HDD,
I used to have my /home and swap partition on my HDD and my /root on SSD,
as Doktor mentioned
doktor5000 wrote:If I where you, put /, swap and a small /home on the SSD, and then add a symlink inside your /home to the HDD for folders where you need more space.
Otherwise the SSD benefits are wasted halfway.

It's better to move them on SSD and use a symlink,
I moved my swap to SSD, fixed fstab and ..., and finally it works just fine,

now I wanna move my /home and use a symlink,
How can i do so?

I found these two links useful, but I think there might be a better way to so so:
https://help.ubuntu.com/community/MoveMountpointHowto
https://help.ubuntu.com/community/Parti ... ome/Moving


thanks
User avatar
lightblue
 
Posts: 45
Joined: Jun 10th, '14, 20:52

Re: Moving /home partition

Postby doktor5000 » Dec 2nd, '15, 22:44

Why do you want to use a symlink?

lightblue wrote:I found these two links useful, but I think there might be a better way to so so:
https://help.ubuntu.com/community/MoveMountpointHowto
https://help.ubuntu.com/community/Parti ... ome/Moving

The first link is only about changing mount points, not about transferring contents.
The second link is about moving the contents of /home to a separate partition. If I understood correctly, you currently have a separate /home partition, right?

Basically it's just a matter of creating a new partition and filesystem on top.
Then go to single-user mode via init 1 as root or by appending 1 to the kernel options at boot.
Mount your new partition somewhere ( e.g. to /mnt/newpartition ) and then copy the contents of /home to the new partition, via e.g.
Code: Select all
cp -a /home/* /mnt/newpartition/

or
Code: Select all
rsync -avzP /home/* /mnt/newpartition/


Get the UUID of your new partition via blkid or lsblk -f and adjust the UUID of /home to the one of the new partition in /etc/fstab.
Reboot and you should be done. You can then remove the old /home partition.

This is described via e.g.
http://unix.stackexchange.com/questions ... -partition
http://askubuntu.com/a/50539
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18058
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Moving /home partition

Postby jiml8 » Dec 3rd, '15, 01:00

Why do you want to use a symlink?


Why not? That is how I have done it for many years on my workstation. It is just easier when I want to move things.

My /home is a directory on an encrypted partition (sdd5) and /home is a symlink (/home->/mnt/sdd5/home). It works very well.

As for moving stuff from an old /home partition to a new /home directory on some other partition, it's easy enough. Just be logged in as root, and have no human user (who has a home directory in /home) be logged in. Probably a good idea to drop to init 1 for this, just to make sure nothing is being used in /home.

Establish the directory home wherever you want it and copy everything from /home to /path/to/home. Once the copy is complete, umount /home, delete the /home mountpoint from /, remove the entry from fstab, and replace with ln -s /path/to/home home.

If you are unable to umount /home because something is using it, just remove the entry from fstab and reboot into init 1 in order to delete the mountpoint and create the symlink.

Because I choose to not encrypt my / partition (it is just a PITA if recovery is needed) I also symlink /var and /tmp to directories on other encrypted partitions in order to guard against information leaks.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Moving /home partition

Postby lightblue » Dec 3rd, '15, 17:07

Hi Doctor and thanks for your reply,
I'm going t to do whatever you said, :)

Just 2 short questions,
Is that okay to have a home with xfs file system for Mageia? (Does it have any advantage over ext4?)
how can i share my /home with 2 distros?


Regards
Last edited by doktor5000 on Dec 3rd, '15, 18:40, edited 1 time in total.
Reason: removed fullquote
User avatar
lightblue
 
Posts: 45
Joined: Jun 10th, '14, 20:52

Re: Moving /home partition

Postby lightblue » Dec 3rd, '15, 18:09

Hi jiml8 and thanks for your solution,

I'm not sure that I got all the steps :D,
but i'm gonna do it and try my best to make it work :)
As i think it's really handy
Last edited by doktor5000 on Dec 3rd, '15, 18:40, edited 1 time in total.
Reason: removed fullquote
User avatar
lightblue
 
Posts: 45
Joined: Jun 10th, '14, 20:52

Re: Moving /home partition

Postby doktor5000 » Dec 3rd, '15, 21:10

FWIW, basically jiml8 describe the same as I did, but more high-level. The only difference he does is using a symlink to another mountpoint instead of directly mounting it as /home,
as he has an encrypted partition where he probably has several folder including home, var and maybe more. If you simply want to move home to a new partition, I don't see the necessity for using a symlink.

Also you can use any filesystem you like. E.g. I'm using btrfs for /home and / . xfs has advantages with bigger files, you can use it if you think it works better for you.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18058
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest