Issues after moving home folder from external drive to /home

Hey guys,

I have a problem with Manjaro after relocating my home folder. I moved it from an external drive to /home inside system root. During installation, I used a separate disk for /home but it turns out I need that drive for something else.

This is what I did so far. After booting machine into LIVE-USB, I have moved everything from the disk to /home in the system / partition. Essentially, I did following

# mount /dev/sda3 ./system
# mount /dev/sdb1 ./manjaro-home
# cp -rp ./manjaro-home/* ./system/home

/dev/sda3 is the root / and /dev/sdb1 was mounted to /home.

I also commented a part of fstab to avoid /home being mounted to the external drive.

After rebooting, Manjaro seems to be OK and starts without complaining about anything. However, things get odd when I use terminal. It kind of flickers when I move cursor around its window or gets even hidden, until I mouseover bottom task bar. It also flickers if It loses or gains focus.

Keyboard in the terminal also does not work correctly. For instance, I can’t type `l`, or typing `a` takes time. There’s an issue with showing content because all commands I type are executed.

What could go wrong?

Thanks

… and you didn’t check whether your cp command did what you intended it to have done?

to ensure that the stuff ended up where it was supposed to end up?

and then comment out the /etc/fstab entry referring to the old location of /home

simply list the contents of /home or /home/your_user
on /dev/sdb3
before and after …

cp -a
has served me well :wink: - it preserves everything you might care about

I also used rsync for the purpose
but cp -a should do the job just fine

1 Like

Check the permissions of the new home, and chown if needed.

2 Likes

I wonder why nobody uses the usermod -d -m command, when makes this task in automatic mode… :thinking:

Probably because most people aren’t familiar with it. :wink:

3 Likes

It’s the wrong tool for the job.

It changes the path of a user’s home directory which is stored in /etc/passwd, and moves the files to the new directory.

However the OP wants to move the contents of /home to a different partition. In this case the / partition, but either way the path will be the same once finished, so changing it is counterproductive.

Further Explanation if needed

Two cases:

Running system - either no current home partition or partition is mounted at /home

/home → /mnt

I’m not sure if bind mounting the root partition to /mnt would work for OPs case (home partition → root partition), if not then we’d have to use a live USB.

Live USB - neither partition is mounted at /home

/mnt/home/ → /mnt/root/home/


The destination is never /home/username - so there’s no way to use usermod as cp without breaking the configuration, necessitating another usermod -d /home/username username to fix it.

Alternatively we can just use cp (or rsync, etc) and do it all in a single command - without unnecessarily editing /etc/passwd twice for each user. :smiley:

It may be useful if you want to move a single user from the root (or home) partition to another partition - but that’s a little weird. :zany_face:

4 Likes

OK, so it should have been cp -a. I’ll remember that. I thought preserving attributes (-p) would be enough.

As to rsync, I guess I also should add the option -a similarly to cp.

Can you recommend when I actually should use rsync -a over cp -a?

Thanks

from man cp
(that is the manual page for the program cp, describing usage and options …)

-a, --archive
        same as -dR --preserve=all

as for rsync:

man rsync starts with:
rsync - a fast, versatile, remote (and local) file-copying tool

It is more complex and also more versatile.

… incremental backups, for instance
or
backup over the network …
using compression for the transfer …

the -a option is but one of many
and has different implications:

--archive, -a
              This is equivalent to -rlptgoD.  It is a quick way of saying you want recursion and want to preserve almost everything.  Be aware that it does not include pre‐
              serving ACLs (-A), xattrs (-X), atimes (-U), crtimes (-N), nor the finding and preserving of hardlinks (-H).

No.
Depends on what you actually want to achieve.
Incremental backup, for instance - only transfer what has been changed (again: for instance)

For a complete local backup: cp might be easiest.

As you did not mention that you created ./system and ./manjaro-home folders: Could it be that these folders were not empty?

I agree, cp -a is probably the easiest command to do this job as no special links etc. are expected in the /home folder, usually.

At least I would double-check if ownership has been taken over by the normal user. The /home folder itself (not the content) is usually owned by root.

1 Like