## Moving Files to SMB Shares
1. Simple Copy for Empty Directories:
```bash
# For a single file
cp /path/to/source/file.txt /mnt/nas_mount/
# For a directory
cp -r /path/to/source/directory/ /mnt/nas_mount/
```
2. Using rsync for Large Transfers:
```bash
# Basic rsync with progress
rsync -av --progress /path/to/source/ /mnt/nas_mount/
# Resume interrupted transfer
rsync -av --progress --partial /path/to/source/ /mnt/nas_mount/
# Preserve timestamps and permissions
rsync -av --progress --times --perms /path/to/source/ /mnt/nas_mount/
```
3. For Time-Critical Transfers:
```bash
# Use multiple threads with parallel
find /path/to/source -type f -print0 | parallel -0 cp {} /mnt/nas_mount/
# Or use tar for better performance
tar cf - /path/to/source | (cd /mnt/nas_mount && tar xf -)
```
4. Verify File Integrity:
```bash
# Generate checksums for source
find /path/to/source -type f -exec md5sum {} \; > source_checksums.txt
# Generate checksums for destination
find /mnt/nas_mount -type f -exec md5sum {} \; > dest_checksums.txt
# Compare checksums
diff source_checksums.txt dest_checksums.txt
```
### Best Practices
- For initial large transfers:
- Use `cp` for empty directories (faster than rsync)
- Consider network bandwidth and time of day
- Split very large transfers into smaller batches
- Monitor system resources during transfer
- For incremental updates:
- Use `rsync` to sync changes efficiently
- Enable the `--partial` flag for resumable transfers
- Use `--delete` carefully to mirror deletions
- For critical data:
- Always verify transfers with checksums
- Keep source data until verification is complete
- Consider using compression for large text files
- Monitor for transfer errors in system logs
### Performance Tips
- Network considerations:
- Use wired connections for large transfers
- Transfer during off-peak hours
- Monitor network utilization
- Consider jumbo frames if supported
- File system optimization:
- Clean up unnecessary files before transfer
- Avoid copying system/temporary files
- Use appropriate block sizes for large files
- Consider file compression when appropriate
### Common Issues
- Slow transfer speeds:
- Check network connection quality
- Monitor CPU and memory usage
- Verify SMB protocol version
- Consider splitting large transfers
- Failed transfers:
- Use rsync's resume capability
- Check available space
- Verify permissions
- Monitor system logs for errors
See also [[How to Test TrueNAS SCALE Network & Drive Speed]]