I have an opensuse 13.2 install that was set up with /home on the root partition. I am using this more now and would like to move home to a new and larger partition. I have created the ext4 partition and now need to move the data from the current home partition.
My plan was to move the data and then use Yast2 to change the mount point of the new partition to /home. I can mount the new partition in dolphin, but if I do that I don’t have permission to write to it. I have tried adding my user to the partition with full permissions, but that doesn’t do anything. The partition seems to be owned by root. I could probably move everything off of the current home directory to some other location, but is seems as if I should be able to mount a new partition and write to it without too much difficulty.
Any suggestions? Will simply changing the mount point of the new partition to /home make it my new /home location?
That didn’t do anything but bork all of my desktop icons. Restarting seemed to fix this. I guess I should mount it somewhere else but I would appreciate some advice before I really mess things up here.
Sorry, for the double post but I couldn’t see how to edit my earlier post.
I do not think you want it at /home/user_name, but in the end you want it at /home.
Temporary you can mount on /mnt, so you can do the data transfer.
You talk about Dolphin, but Dolphin has no task here. None of the users using /home may be logged in during the datatransfer. Only root must be logged in (after all someone must do the transfer), but of course NOT in the GUI.
I have to do something else now. When you like a plan I can post one after about 1 and a half hour.
Go to the console (Ctrl-Alt-F1 or use run level 1) and log in as root.
mount /dev/sda5 /mnt
Copy the data. I use a rather old fashioned way
cd /home
tar cf - * | '{cd /mnt ; tar xvf - ; } '
Take care here, all white space shown here must be copied! (someone may post here an easier cp command that keeps ownership, etc.)
You can do a short check to see if everything in /mnt looks complete, owned by the correct user, etc.
umount /mnt
make an entry in /etc/fstab
/dev/sda5 /home ext4 defaults 1 2
mount -a
Now users should be able to log in and check if anything changed.
There is however one more thing to do after users give you their OK. All the data is still on the root file system and when you want to recover that space (understand that until now you did not destroy anything in the old home directories, you can still go back to the old situation):
Again, all user should log out and root logs in at the console.
umount /home
cd /home
rm -rf *
cd
mount -a
All clear.
One word about the /etc/fstab entry. You might want not to use /dev/sda5, but e.g. UUID=… . That is up to you.
I just did something like that a week ago. The runlevel change I did but I used rsync
rsync -avxz /source /destination
and edited /etc/fstab to reflect the changes like hcv did but I did not deleted the old home before I can confirm that everything is working on my new home.
Thank you for taking the time to write this out. That was kind of you.
I implemented the steps a bit differently.
log out of user and into root
make a landing space for the mounted drive,
mkdir /mnt/suse_data
mount the new partition to receive the copy of /home,
mount /dev/sda5 /mnt/suse_data
copy the data, I use the following,
cp -Rfp /home /mnt/suse_data/ 2>&1 | tee -a copylog.txt
This gives me a log file that will show if there were any issues in making the copy.
point /home to the new partition
open yast partitioner and select the current /home to not be mounted
close the partitioner
open yast partitioner again and select the new partition to be mounted at /home
I did use the UUID to mount since I agree that this is more reliable
restart
It would have been simpler to edit /etc/fstab directly but I didn’t have the UUID for sda5 copied anywhere and I thought that the GUI would be dependable.
This did what I needed. I now have a new, larger, home partition with all of my data. Looking back on your notes, I think that I neglected to delete the old copy of the data in /home. I will have to see if I can find where that data is living at the moment. I assume if I am root I will be able to find it.
Looks as if you did quite well, Of course, when you do understand what the steps do and why they are suggested in the way they are suggested, you can deviate on them.
One thiing that worries me (may be due to your short descriptions) is that you simply say you logged in as root without stressing that you did that NOT in the GUI. Also that when you say you use YaST, that that is NOT from a GUI (because no normal user should be logged in when you tinker with /home and user root should NEVER log in in the GUI), but from a console login (and thus YaST using ncurses). This specialy for those that come and read this thread to repeat the procedure on their own system.
About cleaning up the old data (and thus creating free space on your / file system). When you do a
df
you will notice that your / file system is as full as it was before. You did not delete all the data in /home that was there all the time. You can not reach that data as long as your new /home file system is mounted on /home. Noody can, not even root, because nobody can see it. It is hidden behind your mounted /home file system. Thus to delete the old data you must use root from the console with no users loged in and then delete. As I described above.
mount --bind / /mnt
cd /mnt/home
ls -l ### carefully check timestamps to be sure that this is the old "/home" and not the new one.
/bin/rm -f *
cd /
umount /mnt
The “–bind” mount does not apply to mounted file systems, so you can see what is in the original “/home”