Context
I recently migrated Windows 10 and Gentoo to 2 separate 250 GB SSD's and left my old traditional SATA HDD Drives in to use for Storage.
- I put
Users
on a HDD for Windows during a new install. - I used a GParted LiveCD to shrink my root file system, and copied it to the new drive, rebooted, and then deleted the old root I'm leaving
/home
and a swap partition on my HDD Drive. This all works great, as I'm booting using the UUID's.
Since I'm on Gentoo, I need to move just the /usr
directory from the SSD back to the original HDD I copied it from, so that the Portage Tree doesn't hog the small SSD space during updates. I'm not tagging this with gentoo until now(See Update Heading), because this question is related to the proper command options needed for rsync
For a bit of context, the portage tree is Gentoo's package repository. The entire repository is downloaded to the user's local machine before updating. Downloading it to the SSD would cause needless wear, as the tree is updated daily.
Issue
I found the following two questions related to what I'm trying to accomplish:
Now I need an answer to a few of my own questions:
- Can I use the
rsync
command to move/usr
while in the Gentoo install where/usr
needs to be moved? The ServerFault question hints at this. - If #1 isn't possible, and I use the GParted Live USB to issue the
rsync
command, do the file/directory owners change since the LiveUSB is based on a Debian distribution? - What are the proper options for
rsync
besides-a
for archive? The comments in the selected answer at AskUbuntu hint at adding-H
to ensure hardlinks are followed, but then the OP contradicts the comments in his own answer.
Visual Aids
I need to move the /usr
directory from the partition squared in red to the empty partition squared in blue, while the entire partition squared in red is running, or use a LiveCD to do so, without harming or changing the current permissions.
Update
This question turned out to be a mountain that can be conquered, but I don't know if I conquer it:
- I am/was able to move
/usr
to a new partition usingrsync -avAHPX /mnt/gentoo/usr /mnt/new_usr
. I can't give credit for a partial answer as I'm still stuck. - It does no good, as systemd complains that the root filesystem doesn't contain a valid init because the init system is in the partition that can't be mounted. Do you see the issue here? (Systemd is located in
/usr/lib/systemd
) - I need early userspace mounting in order to fix the issue, but in order to do that, I'd lose my Plymouth boot screen initramfs with the initramfs it takes to mount
/usr
early. See also Custom Initramfs and Initramfs/Guide. - Support and or other Gentoo users not complaining that "Systemd Sucks" are hard to come by (which is one of the reasons, I started contributing here). As such, if I post a question in our official resources, I get booed.
If anyone can tell me the proper tools to use that combine both a plymouth bootsplash and early /usr
mounting in the initramfs/intramfd, I'd appreciate it, and I'm thinking about offering a bounty, if this question sits. Also know that since Gentoo is source based that even though I linked the Gentoo Wiki articles, that I can use the tools from other distributions.
/usr
into a running system? If so, then no, much safer to use a live USB. I presume GParted has rsync, but if you are worried, then just use the Gentoo live USB instead. I'd use-aP
at a minimum. I'm not sure if there'd be any hardlinks on/usr
, but no harm doing-H
if there isn't. (By the same token, you could use-AX
too.)man rsync
to read the options you posted, but do you mind explaining the reasons I should add-X
or-P
? And to clarify, I need to copy the /usr folder from a running system into some free space. I'll post a screen capture of GParted./usr
on a live system shouldn't be a problem,/usr
is (or was, originally) designed to be able to be mounted read-only, and shared between multiple systems, as its contents should only change when upgrades are done.-P
is shorthand for--partial --progress
which doesn't affect the final result of the rsync transffer.-X
preserves extended attributes if you use those.rsync -a --progress /usr/ /path/to/usr/
(don't forget trailing slashes otherwise you could end with folder being copied to /path/to/usr/usr