How to Use the rsync Command to Transfer Files (Linux Crash Course Series)

Поділитися
Вставка
  • Опубліковано 5 лип 2023
  • The Linux Crash Course series teaches you a valuable Linux-related skill, in one video at a time. In this video, the rsync command is shown.
    Check out the dedicated tutorial on apt here ➜ • Linux Crash Course - T... *🎓 FULL LINUX COURSES FROM LEARN LINUX TV*
    • Linux Crash Course ➜ linux.video/cc
    • Learn tmux ➜ linux.video/tmux
    • Learn vim ➜ linux.video/vim
    • Bash Scripting Series ➜ linux.video/bash
    • Proxmox VE ➜ linux.video/pve
    • Getting Started with Ansible (Udemy) ➜ learnlinux.link/ansible
    • LPI Linux Essentials Workshop (Udemy) ➜ learnlinux.link/linux-essentials
    🌐 LEARN LINUX TV ON THE WEB
    • Main site ➜ www.learnlinux.tv
    • Community ➜ community.learnlinux.tv
    • Official Github Account ➜ github.com/LearnLinuxTV
    • Enterprise Linux Security Podcast ➜ enterpriselinuxsecurity.show
    • The Homelab Show Podcast ➜ thehomelab.show
    • Jay on Udemy ➜ www.udemy.com/user/jay-lacroix-3
    • Jay on Twitter ➜ x.com/JayTheLinuxGuy
    • Content Ethics ➜ www.learnlinux.tv/content-ethics
    • Request Assistance ➜ www.learnlinux.tv/request-ass...
    ⚠️ DISCLAIMER
    Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. Always make sure you have written permission before working with any infrastructure and that you are compliant with all company rules, change control procedures, and local laws.
    #Shorts #Linux #Howto
  • Наука та технологія

КОМЕНТАРІ • 91

  • @cristoforopontikas
    @cristoforopontikas Рік тому +11

    i would like to let you know something very useful to your guide. When you using the -a archive option you must be aware that using this include and preserve all those options (-r recursively, -p permissions, -t modifcation time, -l symlinks, -g group, -D devices) so you don't need to use the -r option as in your example when using the -a option. Hope this make the rysnc -a option more clear... thank you

  • @jim7smith
    @jim7smith 9 місяців тому

    Thanks so much for your linux series. I especially like the way you provide links in the ...more under the video so that we can have a TOC to help us find the desired content. Blessings on you and yours from the banks of the Suwannee River in North Florida.

  • @Wandering_Horse
    @Wandering_Horse Рік тому +7

    I have a server in LA, and when I am at school working on my coding, I can upload my work, go home download it, work on and upload it and have fresh code available all the time. Also prevents me from having to use the schools horrifically slow vpn. Also while the other kids are struggling to get there homework open in eclipse, I am already rocking my code in Vim on a remote server in LA!

  • @AustroPower
    @AustroPower Рік тому +6

    Man Jay i am forever grateful and thanful for all the knlowledge and tuts you are dropping every week, i learned so much from you when it comes to Linux, i am now looking forward to buy your books :)🙏💯

  • @ronaldronald8819
    @ronaldronald8819 Рік тому

    rsync is an excellent tool and worth your while spending some time learning it's options.

  • @matteocassino3172
    @matteocassino3172 5 місяців тому

    Easy to understand and very helpful. Thx!

  • @CaptZenPetabyte
    @CaptZenPetabyte Рік тому +1

    Thanks for this tutorial, it will become very useful I think ... I am ditching Wordpress and going back to static websites, and have decided I will simply update the files locally and rsync them to the website. Though having said that there are a few people that argue the ssh vs ftp and reliability issues, so I am still working some things out

  • @lawman2112
    @lawman2112 7 місяців тому

    Loving the content here!! Thx!!!

  • @OXIDE777-is6gs
    @OXIDE777-is6gs Місяць тому

    Awesome video, thanks man!

  • @cbmeeks
    @cbmeeks Рік тому +2

    Really loving your videos. I would like to see you do one on rclone as well.

  • @jonathanchevallier7046
    @jonathanchevallier7046 Рік тому +3

    Very nice explanations. Thank you Jay. Do you use a program in particular for your markdown notes, or just a text editor ?

  • @PswACC
    @PswACC 9 місяців тому

    Excellent explanation. Thanks

  • @PhilipBonev
    @PhilipBonev Рік тому +1

    Thanks for the tutorial. I am working with linux for a long time now, but still I watch your basic tutorials there is always some little bit that surprise me. Little comment on the tutorial - I think 'command' is bash specific. Better use 'which' in my opinion.

  • @marioandresheviacavieres1923
    @marioandresheviacavieres1923 2 місяці тому

    Thanks for another great one

  • @rcdenis1
    @rcdenis1 Рік тому +3

    Rsync will resume tranfers if the link drops, with scp you'll have to start the transfer over in that case. Also, the OpenSSH folks declared scp deprecated a few years ago. Rsync -avP is how I use it.

  • @PaPaTheGMan1215
    @PaPaTheGMan1215 Рік тому +1

    Thanks for the video. it is very informative. One question, how do you add a password to the destination address? Many of my systems have a password for access and don't have ssh keys. Thanks.

  • @nathan445
    @nathan445 4 місяці тому

    Awesome video! I'm going to try and use this to back up my Ubuntu Minecraft server to my WSL

  • @denalimike8159
    @denalimike8159 Рік тому

    GREAT VIDEO! YOUR THE BEST! FROM DETROIT MI!

  • @gabriele8332
    @gabriele8332 11 місяців тому +1

    Hello, can you also compare rsync with unison for file sync? Thank you.

  • @sussusamogus7831
    @sussusamogus7831 10 місяців тому

    great video

  • @readwriter
    @readwriter Рік тому

    I have studied a lot about rsync recently!
    My simple use case is to maintain backups of files to an external attached drive.
    I was disappointed to see that in backing up from macOS to exFat, the metadata/resource fork stuff created by Mac (or some other cause) causes MANY unchanged files to be transferred again unnecessarily.
    I just saw a Reddit post that said, now, in macOS Ventura, inclusion of the standard “--modify-window=1” flag fails to be useful due to a kernel flaw.
    This topic is probably not substantial enough for a separate video, but I look forward to your comment.

  • @KILLERTX95
    @KILLERTX95 Рік тому +1

    I always use:
    Rsync -Pavh --dry-run blah blah
    Progress
    Archive
    Verbose
    Human readable
    Super useful

  • @jebucaro
    @jebucaro Рік тому

    ¡Gracias!

  • @QuimChaos
    @QuimChaos Рік тому +1

    Isn't the -a option (archive) the same as doing -rlptgoD ? if so the -r (recursive) option is not needed?

  • @peterjansen4826
    @peterjansen4826 Рік тому

    I used rsync to clone my Arch-install from one SSD to another (faster). It was easy, just looking up the exact parameters on the wiki (I needed an extra one for VM's) and everything went well. All I had to do after that is install the bootloader again and I could boot on it.

  • @GooogleGoglee
    @GooogleGoglee Рік тому

    How and where do you set that ssh banner message for every ssh connection to the server?

  • @zinkzxd2891
    @zinkzxd2891 Рік тому

    Cheers!

  • @mitchellpayne3674
    @mitchellpayne3674 Рік тому

    Can you share your .md note files? Or is there somewhere you've already published them so we can look at them?

  • @fvgoya
    @fvgoya Рік тому +1

    16:50 Hey Jay, and how we can do a real sync? Is there a command for that?

  • @tigreonice2339
    @tigreonice2339 Рік тому +1

    I've a question related with linux (not this vid): How to install fingerprint reader: U.ARE.U 4500 fingerprint reader Digital Persona, inc (crossmatch patented) on Linux mint? 😢
    Any way that works and is safe?

  • @jamesbaxter2812
    @jamesbaxter2812 18 днів тому

    I got my RSYNC working. I am thinking. the cache file. I dont know if deleting it is good. But when RSYNC is done. Can it leave the cache alone.

  • @rhb.digital
    @rhb.digital Рік тому +1

    Thanks.

  • @ChadsHobies
    @ChadsHobies Рік тому +4

    Gentoo's Portage package manager uses rsync to synchronize your package list to the current in the repo. It also uses it when issuing commands with emerge to install packages. Rsync is an intragal part of the initial tool kit required for the installation of that distro. Rsync is really cool.

    • @wyfyj
      @wyfyj Рік тому +1

      Another Gentoo enjoyer I see.

  • @littlenewton6
    @littlenewton6 Рік тому

    Another rsync problem with multi hosts: I CANNOT use auto completion when I type the full path of destination! Each time I have to ssh to the destination host and pwd the full path, then copy and paste.

  • @Handelsbilanzdefizit
    @Handelsbilanzdefizit Рік тому +1

    If you do PXE Diskless-Boot, you have to transfer the entire Root-Directory to a remote system.
    What's the best way, to do this? So that no files go lost, because of access rights and other stuff.
    The only reliable way I found, is: Create a complete partitionimage "rootpartition.img" , and then mount it on the remote system.
    That's the only way that works for me.

  • @vPeteWalker
    @vPeteWalker Рік тому

    Thanks for the video! I gotta ask, where'd you get that shirt! I want one for my daughter and I! :) Much appreciated!

  • @paullee107
    @paullee107 Рік тому +2

    Oh cool- I'm glad you covered rsync. I'm an intermediate user, but you touched on an 'issue' that I just experienced on 16TB of backup data. I was using the --delete flag (and -av) for backing up my NAS drives... at some point the NAS went down, but my backup server kept diligently running its daily rsync. GASP, when I found all backup folders were EMPTY. --delete did what it does, and... poof. Any solution here? My local NAS mounts weren't present and I lost backup data. Is there a solution you might suggest while still using rsync?
    Second; I've been looking at borg-backup since that issue... I don't love it. Any other suggestions?
    Thanks!!

    • @shanent5793
      @shanent5793 Рік тому +1

      You have to be careful with the design, it sounds like what you were doing wasn't really a backup at all. Any accidentally deleted file would have had at most one day of protection. There's no way around keeping multiple copies.
      For example you could rsync to a different destination directory each time. If bandwidth is limited, first make a copy of the destination, then rsync. Those are the safest ways, consuming a lot of redundant storage. Unfortunately doing anything too clever to save space is a risk. Filesystem-level deduplication or snapshotting are probably the lowest risk, or you could triage the data and reduce the retention accordingly. The risks are a bug in the filesystem or putting valuable data in the wrong retention level. Define some requirements and how you're going to evaluate them, choose your level of risk, keep some offline copies and test thoroughly

    • @paullee107
      @paullee107 Рік тому

      @@shanent5793 I don't understand what yer saying.

  • @sandeepvk
    @sandeepvk Рік тому

    I learned that I can *ls* the subdirectory using: ls/backup/notes. Never knew that.

  • @gwojcieszczuk
    @gwojcieszczuk Рік тому +2

    One limitation with (-a) archive option is that it won't preserve ownership/group unless you're syncing to target as user "root".

    • @QuimChaos
      @QuimChaos Рік тому +6

      or super user (SU/SUDO). -a is a group of flags that has the -o option that means: preserve owner (super-user only)

  • @onknight
    @onknight Місяць тому

    Is there a way to transfer files from an open media vault server to a Synology server?

  • @cybersekkin
    @cybersekkin Рік тому

    the -a option includes the -r so when you added it, you can remove the -r as no longer necessary. The -avh --delete is so ingrained in my fingers (muscle memory) I have to pause when I want anything else and think about it.

  • @davocc2405
    @davocc2405 Рік тому +2

    In a practical sense RSYNC is sometimes over-used by some sysadmins - I remember it being used for large-group transfers (entire database filesets across 100mbit, we're talking instances of 40gig) and they were creating a huge overhead on the disk packs on both sides in one chunk. The database files were a mixture of some which changed heavily a a lot which didn't but every time you ran RSYNC with the checksum calculation the overhead on the disk was kinda wild. A later admin saw this and changed to a process where he created an MD5 checksum separately and worked out the files which had actually changed that needed to be replicated to the target; he then used RSYNC on only those files. To boot he had a checksum file which he could also transfer to the target to do a validation offline without involving the source system. This was on a shared SAN so disk utilisation spikes had to be considered, this method reduced peak demand quite a bit; the way they were using RSYNC before it was initially creating its internal block checksums on every single file every time (I think they didn't use the change date/time metric).
    This guy got me into checksum files as a standard practice and I've done them for everything - I archived data to several thousand DVD-R's and produced a checksum for each file set (burnt with the target files to disc) so when retrieved we could work out if there'd been any degradation or loss of files on the optical media. It's a bit of due diligence which can really save your arse especially if your processes are audited.

  • @CDE.Hacker
    @CDE.Hacker Рік тому +1

    Weird, everything I've read about backing up says to use rsync. But Syncthing seems to work so much better.
    I use it as a live backup or clone of my work files and do an off site backup periodically. It's mostly to protect against system or drive failures. If something goes wrong, a full up to date copy is always ready.
    What do you think?

    • @ultimatedjX
      @ultimatedjX Рік тому +2

      It's because in reality rsync has old architecture, operates on a signle thread etc. It's a very popular tool and it's been there since... Always? When it comes down to syncing large amount of files or big ones, syncthing is going to be better in a lot of cases. There is a modernized version of rsync called rclone that is much more efficient and ready for nowadays workloads. PS: I use both syncthing and rclone (and rsync in the past).
      People tend to not write all over the Internet about their problems with rsync. They rather move to something else instead, like rclone which is very similar. This is how the legend of mighty rsync goes on and on :-)

  • @camaycama7479
    @camaycama7479 8 місяців тому

    The link for Akamai is missing

  • @mojoblues66
    @mojoblues66 Рік тому

    8:54 What do you mean with "and DNS is often a problem" ???

  • @ultimatedjX
    @ultimatedjX Рік тому

    Rclone is so much better than rsync in any way... So many times I've been having problems with rsync's low transfer rates due to unknown reasons. It's an old software, guys. Rsync on the other hand does the same, is breeze to use, and didn't fail me even once!
    I imagine people still use rsync due to the habit mostly (like I did).
    An example of functional superiority of rclone: it has a buil-in mechanism for hashing ssh passwords of the hosts you want to sync with. Very handy.

  • @littlenewton6
    @littlenewton6 Рік тому

    谢谢!Thank you for your tutorial. Now I use Rsync to do replication between two NAS. The only pity is that Rsync has no windows version.

    • @ironfist7789
      @ironfist7789 Рік тому

      maybe you could use Windows Subsystem for Linux (WSL) but it might be a pain

    • @-aexc-
      @-aexc- Рік тому

      ​@@ironfist7789wsl has extremely poor disk performance iirc

    • @ironfist7789
      @ironfist7789 Рік тому

      @@-aexc- ah ok, that sucks

  • @hansphung
    @hansphung Рік тому +1

    May you share what Linux distro you’re using and the theme? Maybe not

    • @SlideRSB
      @SlideRSB Рік тому

      I'm guessing Debian.

  • @absmustang
    @absmustang Рік тому

    Is that a rhel or Debian server?
    sorry, I didn’t catch that the first 20 times…😂
    Great tool, great video.

  • @pop7297
    @pop7297 Рік тому

    $ command -v rsync -->> what is command in this??
    $ which rsync --->> usually this was used to check if it is installed.

  • @hmbird47
    @hmbird47 Рік тому

    waiting for an episode about kill command 😁

  • @lawman2112
    @lawman2112 7 місяців тому

    I assume SAMBA is installed on both the source and target machines?

    • @deadlinerhorus
      @deadlinerhorus 4 місяці тому

      smb client always is - at most distros while the server part has to be installed, that is correct.

  • @ChrisJackson-js8rd
    @ChrisJackson-js8rd 4 місяці тому

    rsyncd.conf should be covered next time you return to this topic

  • @JohnnieWalkerGreen
    @JohnnieWalkerGreen Рік тому

    I hate it whenever I forget to put a slash "/" at the end of the folder name.

  • @roadkill9173
    @roadkill9173 Рік тому

    Are your notes published to the public?

  • @davidmutua6971
    @davidmutua6971 11 місяців тому

    I use scp command for the same including the -r flag. Works same way. Don't see any difference Jay

  • @ArifKamaruzaman
    @ArifKamaruzaman Рік тому

    Eyy Im fast af boi.

  • @squalazzo
    @squalazzo Рік тому +1

    are you sharing that notes folder somewhere? interesting

  • @TheSecurityAgency
    @TheSecurityAgency Рік тому

    Wow, a dry run, I can't even imagine what a "wet" would do, but it certainly gonna be a liquidfall?

  • @gauravkalpasi
    @gauravkalpasi Рік тому +1

    First viewer

  • @RAYJOS
    @RAYJOS Рік тому

    I haven't seen the difference between rsync and scp.

  • @readwriter
    @readwriter Рік тому +15

    Concerning the single-directional nature of rsync (without ‘delete’ flag), the *best* wording I saw to describe this is, “Rsync is ADDITIVE”

    • @jameswhite1910
      @jameswhite1910 Рік тому +2

      Yes, seems an important distinction if one is looking for a .photoslibrary backup, for instance.

    • @mariozamora9684
      @mariozamora9684 Рік тому +1

      For backup, yeah. But if you are migrating data from OS version 6 to OS version 8, you may want to preserve some of the new files generated on version 8.

    • @sureshkrishna3425
      @sureshkrishna3425 7 місяців тому

      😊

    • @sureshkrishna3425
      @sureshkrishna3425 7 місяців тому

      😊

    • @user-sb7qi4bn4z
      @user-sb7qi4bn4z 7 місяців тому

      BB❤ VP❤❤b❤❤​@@jameswhite1910

  • @kazialireja262
    @kazialireja262 Рік тому

    Kisuka dil jeet ka tum tumra hak adaya karna joga❤❤

  • @kazialireja262
    @kazialireja262 Рік тому

    Tumhumra pas sa kaya sikhsa
    Mila tumko etni jara bat ka liya
    Tum gio sisa ka umra gana sunna abhisa etna lachar aga baro dakho kaya hota hai❤❤

  • @BHUPENDRA._.JOGI9
    @BHUPENDRA._.JOGI9 Рік тому

    😅😅9m
    😅9😅😅
    Nn
    KN
    nHistory HiKstory
    oion0lpm9
    9nnn
    899mm
    Nn
    Nnnnn😅.lmko

  • @ZubairKhan-vs8fe
    @ZubairKhan-vs8fe Рік тому

    Why do you need command lines in linux. That is so old days. Like using dos when you have windows

    • @SlideRSB
      @SlideRSB Рік тому +2

      Because command lines are super leet

    • @johnbaines9580
      @johnbaines9580 Рік тому +1

      If you are allergic to using the terminal there are GUI front-ends. It's linux - so you can choose!

    • @hpalvz
      @hpalvz Рік тому

      Also... even Windows have a tool like this one! (robocopy)

    • @ZubairKhan-vs8fe
      @ZubairKhan-vs8fe Рік тому +1

      Thanks thanks for explaining

    • @christianemden7637
      @christianemden7637 Рік тому

      Also for the purpose of explaining rsync, using it on the terminal it becomes completely independent on what distribution you are running, the commands are always the same, and the output looks the same.

  • @Jorokusaki
    @Jorokusaki Рік тому

    Which emulator do you use?

  • @ssh-dev
    @ssh-dev 8 місяців тому +1

    Hey this is a great video. rsync is a great tool and with argument -a
    -a, --archive
    This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything. :)