0

Ok, so I am attempting to do a clean install of Ubuntu 24.04 from Ubuntu 22.04

I wanted to have my /home directory intact on a different hard drive so I could get info back after the install.

I thought I could use the mv command to do that just before I did the install and I did this. I went to where the hard drive is mounted and did a mv command.

mv /home /media/don/Archive/savedhome

This seemed to have work but I have some questions. This command created a directory structure on the other hard drive and it appears all the directories and files are there as well. I expected the original /home directory to disappear after the command was completed but it is still there.

So did the mv command really work? It is like I did a cp instead of a mv. This is fine as all this will be destroyed when I install the new OS but it is contrary to my understanding of the mv command.

If you do a mv command across hard drives is it supposed to behave like a copy command? Am I safe to just go ahead and do the install or do I need to use a cp command or something?

I really would like to have a better understanding of what is happening with the mv command. I tried to research this but I haven't found any discussion about using the mv command from one hard drive to another.

If you need any additional info please let me know. Thanks

2 Answers2

0

using mv on your home directory would be a rather bad idea, as your home directory also contains many configuration files - most hidden - that are necessary for your current session to operate correctly. and, as you have pointed out, your old home directory is going to be wiped anyway so there is no reason to not leave it intact for the moment.

a far safer approach would be to go into the file manager and do a copy-and-paste from your home directory to the backup location. this way you have some visual indication that the files are being copied, as well as retaining the originals. you can then even compare the two locations to make sure that everything has been successfully copied.

in general, it far better (where available) to do things using the GUI rather than using typed in commands.

0

mv should, like you expect, copy the directory and its contents to the other partition, and delete the original. It is not expected that your original copy is still fully there upon move.

Depending on the permissions that you have while executing the mv command, some directories or files may not be able to be deleted. Such files will remain with their directory structure. For example, directories and files of which you are not the owner will not be deleted from the source. You should however see error messages if that is the case.

If your original directory is still there with all its content, then I suspect that you should double check whether you effectively used the mv command, or rather copied the contents.

vanadium
  • 97,564