Score:0

Move /usr to new partition on running Oracle Linux 7/8 server?

ng flag

I need to move the /usr directory to a new partition on a running server and delete the old /usr directory without "crashing" the system and no live CD is allowed. The new ssd is already build in and partitioned with fdisk and a filesystem is written on it with mkfs. I created a new directory /ousr for the original /usr directory and mounted sdb1 to /mnt. I copied the /usr files with all dependencies, owners, groups etc. to /ousr and /mnt. I want to make linux use /ousr while I delete the original /usr, umount /mnt, mount /dev/sdb1 to /usr and update /etc/fstab with the new mount. While I do my changes I'm running init 1

How do I make linux use /ousr instead of /usr and change it back after work is complete?

There were some "tricks" with mounting the ssd over the old /usr directory and snatch the underlaying old directory with mount --bind / /mnt and then deleting the /mnt/usr* directory but this didn't work either.

I also tried using export PATH=$PATH:/ousr/new/path with all needed paths to sbin and bin. Well I learned that this also doesn't work.

in flag
I doubt that this is possible without at least a reboot. The way Linux handles file pointers will just keep the files on the old partition open, even when they are deleted. They will only vanish after the processes have been stopped.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.