Page 1 of 1

how to install keeping old /home?

Posted: 2019/11/09 02:22:16
by jeepster
I have a PC with 2 hard drives. One was /home and the other drive held all the rest. So I try to install Centos 7 from DVD. I have done fresh install a few times before. Now I select custom partitioning for the installation destination. It shows "Scientific Linux 7.1" (what was there before). sda has /home
Since it was another RHEL clone, the uid gid would be the same, I presume one could keep the user directories.
So I delete the other partitions from sdb and add them again with mount points and sizes, and select reformat.
I do not touch other sda /home and it had format option unchecked. Then accept the changes (destroy and recreate on sdb)
However it still shows errors in the Installation Summary screen, and I cannot proceed.

Re: how to install keeping old /home?

Posted: 2019/11/09 09:54:05
by jlehtone
"shows errors": We cannot advice you about the errors that we do not see.


Installer allows you to select an existing filesystem and fill in where you want to mount it (like '/home').


User information is within /etc. If you define a regular account in the installer, then it might get same name/uid/gid as in the other system, but will also attempt to create a home directory. Not sure how it reacts to existing directory.

It is possible to recreate user-info exactly with 'groupadd' and 'useradd', or you could copy data from current system's /etc.

Re: how to install keeping old /home?

Posted: 2019/11/09 13:22:48
by tunk
It is possible to migrate from RHEL to CentOS without reinstall.
This may be possible in this case as well. I haven't read through
it, but this may be a starting point:
https://www.openlogic.com/blog/step-ste ... -centos-74

Re: how to install keeping old /home?

Posted: 2019/11/09 13:28:56
by TrevorH
Personally I always keep /home as a separate filesystem and do not let the installer touch it. Post-install I then edit fstab and add it manually.

Re: how to install keeping old /home?

Posted: 2019/11/10 01:33:15
by desertcat
jeepster wrote:
2019/11/09 02:22:16
I have a PC with 2 hard drives. One was /home and the other drive held all the rest. So I try to install Centos 7 from DVD. I have done fresh install a few times before. Now I select custom partitioning for the installation destination. It shows "Scientific Linux 7.1" (what was there before). sda has /home
Since it was another RHEL clone, the uid gid would be the same, I presume one could keep the user directories.
So I delete the other partitions from sdb and add them again with mount points and sizes, and select reformat.
I do not touch other sda /home and it had format option unchecked. Then accept the changes (destroy and recreate on sdb)
However it still shows errors in the Installation Summary screen, and I cannot proceed.
OK I have been here and done that. I do ONLY a Custom install. In general the way you have done it is the way I have done it in the past, but in my case /home was on the same drive, not a different drive. The trick involves erasing any reference to the OS already installed even if the OS already installed is an older version of say CentOS 7 that I had just created not more than 15 minutes ago, otherwise you duplicate partitions and that confuses things. Doing it this way you only have one set of files that are located on the drive pointing to the same point on the drive. In the event I have two different OS's I try to have them on different drives and then modify GRUB2 so that the other drive and OS appears on the menu entry. You do this my modifying /etc/grub.d 40_custom, then you dual boot two or more OS's from a single menu.

OK you get to where you carve up the the drives. Before you start carving you will see a list of all the currently installed OS's For this this example we will call one RHEL 7. RHEL 7 has all your partitions --/boot, /var/, /etc, /tmp , /usr, /, and SWAP. Drive "B" contains /home. First you need to disable DRIVE B. I usually do this by simply going into the guts of the machine and physically removing the cable that connects DRIVE "B". This way you don't accidentally overwrite the contents on Drive "B". Now when you run Custom Install all you will ONLY see the contents on drive "A" that says "RHEL 7", now ERASE "RHEL 7" so that you have a CLEAN DRIVE (You could also do this through gparted and reformat the drive which might be easier), now go ahead and carve up the drive. You could try to do this without a /home directory, but if complains that you need a /home go ahead and create one as a place saver. At some point you can possibly rename the partition to something else say /home1, or /backup, or /.... Do your install as normal, create your root password and create a bogus users account (if need be) and password. Once the installation has been completed login with your bogus account and finish the install.

The next step is to reconnect drive "B" you need to discover its UUID and then modify the fstab in drive "A" so that it has a pointer so that it knows that /home is located on drive "B". Ask our gurus how to -- if possible -- you can rename /home on Drive "A" to something else or append /home on Drive "A" to /home on Drive "B".

Re: how to install keeping old /home?

Posted: 2019/11/10 12:50:53
by c00ter
Instead of fighting with the very limited Anaconda installer to accept a '/home' on a separate drive, it is much simpler for me to create symlinks to the data directories on that second drive. Takes all of 2 seconds once the system is up and running.