0

I have a bunch of machines on Ubuntu 20.04 as well as a storage server on Ubuntu 20.04.

I'm looking to transfer quickly files of 100 Gb+ to the storage server with Netcat.

I would like to be able to easily transfer the content of a folder with multiple files without having to name them to a folder on the server.

So far I haven't been successful at using Netcat so I would appreciate if someone could give me simple commands that I could just replicate.

Also tell me how to chose the right ports for the transfer.

Lets's assume that I want to transfer all the files that are in /mnt/disk1/files (only the files, not the folder) on a computer with an IP of 192.168.1.22 to /dev/sdc2/folder1 on a computer with an IP of 192.168.1.30.

Example on the receiving computer I used the following command nc -vl 44444 > /dev/sdc2/folder1 and then on the sending computer I used the following command nc -N 192.168.1.30 44444 < /mnt/disk1/files/* I was told that I had to use * when I wanted to send all the files in a folder but it doesn't work. is port 44444

muru
  • 193,181
  • 53
  • 473
  • 722
  • 1
    Why do you need/want to use netcat? Can you give examples of the commands you are trying and more details about why they aren't working? – Nmath Sep 03 '21 at 00:56
  • Is mounting a samba share and copying across the network as though it were a local file system insufficient? – matigo Sep 03 '21 at 01:17
  • I need to transfer quickly files that are over 100Gb and samba is way too slow for that. I know for a fact that Netcat is way faster than anything else over a 10G network. I do not want to compress the files as it takes too much time. following my example in my question, on the receiving computer I used the following command nc -vl 44444 > /dev/sdc2/folder1 and then on the sending computer I used the following command nc -N 192.168.1.30 44444 < /mnt/disk1/files/* I was told that I had to use * when I wanted to send all the files in a folder but it doesn't work. is port 44444 ok? – OlivierLA75 Sep 03 '21 at 01:40
  • @OlivierLA75 Just use `tar` without compression. – muru Sep 03 '21 at 06:57
  • Please [edit] your post to add new information, properly formatted. Information added via comments is hard for you to format, hard for us to read and ignored by future readers. Please click [edit] and add that vital information to your question so all the facts we need are in the question. Please don't use Add Comment, since that's our uplink to you. All facts about your system should go in the Question with [edit] – waltinator Sep 03 '21 at 14:48
  • If you do `nc ... > /dev/sdc2/folder1` you will destroy the 2nd partition of your `sdc` disk! To copy folders and files, you need to copy to a mounted partition, not a raw partition. If you want to use `nc` rather than the usual `rsync` or a mounted NFS or Samba share, then use `tar` as suggested by @muru. – mivk Sep 03 '21 at 22:10

0 Answers0