Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to create a .tar backup of some files on my laptop and send them to my server. My laptop's HDD is not large enough to hold both the original and backup copy of the file. I would like to break the tar archive into 10GB pieces.

Here's what I have so far:

tar cvf - /backupdir/ | ssh user@host "split -b 10G -d backup.tar."

And the result is

split: cannot open 'backup.tar.' for reading: No such file or directory

Of course, I could just tar | ssh "cat > backup.tar" and then open an SSH shell and split the file then, but I want to be fancy and do this all in one fell swoop.

share|improve this question
1  
you've got an extra . after your backup.tar –  Thom Wiggers Dec 8 '13 at 0:30
    
@Thom Wiggers: The split manpage says split takes the following form: split [OPTION] [INPUT [PREFIX]] there's an extra period because I would like my files to be named backup.tar.00 and so on. –  curios Dec 8 '13 at 3:22

1 Answer 1

up vote 1 down vote accepted

You need to tell split to read from STDIN.
The following should work:

tar cvf - /backupdir/ | ssh user@host "split -b 10G -d - backup.tar"

Hope that helps.

share|improve this answer
    
Ah, thanks @Wolfie. –  curios Dec 8 '13 at 3:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.