You are not logged in.
I am trying to restore a backup of my boot partition with rsync. So I sync my external media with my boot directory, but everytime rsync creates another directory in my boot directory and it doesn't sync with the existing files but simply copies the folder, i.e.:
rsync -aAX --delete /mnt/backup/boot /boot
After executing the command, rsync doesn't sync "/mnt/backup/boot/initramfs-linux.img" with the "/boot/initramfs-linux.img" but creates a "/boot/boot/initramfs-linux.img".
How can I prevent the creating of "/boot/boot" with rsync? I tried:
rsync -aAX --delete /mnt/backup/boot/* /boot
But it said:
rsync: link_stat "/mnt/backup/boot/*" failed: No such file or directory (2)
Thank you!
Last edited by daankata (2018-02-03 13:54:27)
Offline
The trailing / is important for sync targets....
/mnt/backup/boot will copy the literal "boot" to whatever you told it whereas /mnt/backup/boot/ will copy the CONTENTS of "boot" not the directory itself.
What is the output of `ls -l /mnt/backup/boot`
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
While I love rsync for all the cool things it can do, you aren't doing any of those cool things. Just use `cp -a`.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
The trailing / is important for sync targets....
/mnt/backup/boot will copy the literal "boot" to whatever you told it whereas /mnt/backup/boot/ will copy the CONTENTS of "boot" not the directory itself.What is the output of `ls -l /mnt/backup/boot`
/mnt/backup/boot contains the exactly the same things as /boot does:
grub
initramfs-linux-fallback.img
initramfs-linux.img
initramfs-linux-lts-fallback.img
initramfs-linux-lts.img
intel-ucode.img
vmlinuz-linux
vmlinuz-linux-lts
But when syncing with rsync, /boot `ls -l` output is:
boot
grub
initramfs-linux-fallback.img
initramfs-linux.img
initramfs-linux-lts-fallback.img
initramfs-linux-lts.img
intel-ucode.img
vmlinuz-linux
vmlinuz-linux-lts
Where nothing has updated except /boot/boot was created.
Also adding the trailing slash doesn't copy anything.
rsync -aAX --delete /mnt/backup/boot/ /boot
Note: The content of the files of the source and /boot are different.
Thank you!
Last edited by daankata (2018-02-03 14:48:01)
Offline
While I love rsync for all the cool things it can do, you aren't doing any of those cool things. Just use `cp -a`.
If there isn't a way with rsync I will probably use `cp -a`, but I do not want everytime to copy the contents to /boot, but simply sync it. Is there a way to achieve this?
Thank you!
Last edited by daankata (2018-02-03 14:51:40)
Offline