|
| 1 | +Users working on **TU HPC** need to transfer files between their local systems and the HPC cluster. **Globus is not available**, so users must use standard **secure file transfer methods** like `scp`, `rsync`, and `sftp` for **safe and efficient data transfer**. |
| 2 | + |
| 3 | +## 1. Secure File Transfer Using SCP |
| 4 | +The `scp` (Secure Copy Protocol) command allows users to copy files **securely over SSH**. |
| 5 | + |
| 6 | +### **Uploading a File to HPC** |
| 7 | +From your local machine, use: |
| 8 | +```bash |
| 9 | +scp myfile.txt username@tu-hpc-ip:/home/username/ |
| 10 | +``` |
| 11 | +This copies `myfile.txt` from your local system to your **home directory** on TU HPC. |
| 12 | + |
| 13 | +### **Downloading a File from HPC** |
| 14 | +```bash |
| 15 | +scp username@tu-hpc-ip:/home/username/myfile.txt ./ |
| 16 | +``` |
| 17 | +This downloads `myfile.txt` from the HPC system to your local system. |
| 18 | + |
| 19 | +### **Transferring Entire Directories** |
| 20 | +```bash |
| 21 | +scp -r myfolder username@tu-hpc-ip:/home/username/ |
| 22 | +``` |
| 23 | +The `-r` flag copies entire directories recursively. |
| 24 | + |
| 25 | +## 2. Efficient File Transfer with Rsync |
| 26 | +For **resumable and optimized** file transfers, `rsync` is recommended. |
| 27 | + |
| 28 | +### **Uploading a Directory with Rsync** |
| 29 | +```bash |
| 30 | +rsync -avz myfolder username@tu-hpc-ip:/home/username/ |
| 31 | +``` |
| 32 | +The `-a` (archive), `-v` (verbose), and `-z` (compression) flags ensure efficient transfer. |
| 33 | + |
| 34 | +### **Downloading Files Using Rsync** |
| 35 | +```bash |
| 36 | +rsync -avz username@tu-hpc-ip:/home/username/myfolder ./ |
| 37 | +``` |
| 38 | +If a transfer is interrupted, simply rerun the same command to resume from where it left off. |
| 39 | + |
| 40 | +## 3. Interactive File Transfer with SFTP |
| 41 | +For interactive file transfers, use `sftp`: |
| 42 | +```bash |
| 43 | +sftp username@tu-hpc-ip |
| 44 | +``` |
| 45 | +Once connected, use: |
| 46 | +- `put myfile.txt` (Upload file to HPC) |
| 47 | +- `get myfile.txt` (Download file from HPC) |
| 48 | +- `ls` (List remote files) |
| 49 | +- `bye` (Exit SFTP session) |
| 50 | + |
| 51 | +## 4. Large File Transfers & Storage Guidelines |
| 52 | +- **Use Rsync** for large datasets to avoid re-transfers of unchanged files. |
| 53 | +- Store files in **appropriate directories** (`/home/username/` for personal data, `/mnt/storage0/` for temporary large-scale computations). |
| 54 | +- **Do not store unnecessary files** in `/home/`, as space is limited. |
| 55 | + |
| 56 | +## 5. Automating File Transfers |
| 57 | +To automate regular file transfers, add your SSH key for passwordless authentication and create a cron job: |
| 58 | +```bash |
| 59 | +crontab -e |
| 60 | +``` |
| 61 | +Example cron job to sync a folder daily at midnight: |
| 62 | +```bash |
| 63 | +0 0 * * * rsync -avz /local/folder username@tu-hpc-ip:/home/username/ |
| 64 | +``` |
| 65 | + |
| 66 | +## 6. Troubleshooting File Transfers |
| 67 | +- If `scp` or `rsync` is slow, try adding `-e "ssh -C"` for compression: |
| 68 | +```bash |
| 69 | +scp -C myfile.txt username@tu-hpc-ip:/home/username/ |
| 70 | +``` |
| 71 | +- If the connection fails, ensure your **SSH keys** are correctly set up. |
| 72 | +- Check available space using: |
| 73 | +```bash |
| 74 | +df -h |
| 75 | +``` |
| 76 | + |
| 77 | +> _Efficient and secure file transfer for HPC workflows!_ 🚀 |
0 commit comments