How to reuse old /home in Fedora with a new username?

Hello,
So I’ve finally installed Fedora and really love it so far!
During the installation I kept the old /home from a previous linux distro, but I created my user in Fedora with a different username (let’s say “fedorauser”). When I ls the /home, I can see both the new “fedorauser” and the old “anotheruser” folders.
My question is: how do I properly move that old data to the new “fedorauser” and keep all the permissions and structure correct?

Thank you!

Look here for more details. Your command should look like this one, then:

rsync -avz source destination

First of all, thank you for replying.
It looks like this command is going to preserve all the permission, but that’s not what I need. Sorry if my initial question was not clear. I would like the permissions to be transferred the the new “fedorauser” so that I can access and manage all my files from the old user without problems.

Thank you

After the steps described above, you can simply do a chown -R newuser /home/newuser on the newly filled user-directory.

Also: The rsync command above preserves user-id - not(!) user-name. So it might even work correctly without the subsequent chown command.

1 Like

Hello @d10nysus ,
Welcome to :fedora: !
The old home can simply be cp’d to the new home as this is BTRFS (if you stuck with install defaults) and the action is happening on the same subvolume therefore it will be a reflink type of copy not a total meta and data copy. This allows you to exploit the COW (copy on write) functionality of BTRFS and is is fast, read seconds instead of the length of time rsync will need to physically transfer. Then delete the old user dir, change ownership of the files as @anon71016743 describes above and your off to the races.

2 Likes

@anon71016743 @jakfrost thank you for the help, folks! COW sounds very interesting, but I already went with the rsync and it turned out well for me.