简体   繁体   中英

tar a folder into multiple files over SSH

Here is the thing

I have a server with total 85 GB disk space and right now i have a folder with the size of 50 GB which is containing over 60000 files .

Now i want to download these files on my localhost and in order to do that i need to tar the folder but I can't tar the whole folder because of disk space limitation.

So i'm looking for a way to archive the folder into two 25 GB tar file like part1.tar and part2.tar but when the first part is done it should wait for asking something like next part name or permission or anything so I can transfer the first part to an another server and then continue archiving to part2. Or a way to tar half of the folder like first 30000 files and then tar the rest.

Any idea? Thanks in advance

One of the earliest applications of rsync was to implement mirroring or backup for multiple Unix clients to a central Unix server using rsync/ssh and standard Unix accounts.

I use rsync to move compressed (and uncompressed) files between servers.

I think the command should be something like this

rsync -av host::src /dest

rsync solution was good enough but i found the solution for main question:

tar -c -M --tape-length=30000000 --file=filename.tar foldername

After reaching 29GB you will need to change the tape(in my case transferring the first part and removing it) and hit enter for continue.Additionally it is possible for give next parts name:

Prepare volume #2 for `filename.tar' and hit return:

n filename2.tar

Because it is going to take time i suggest using screen session over SSH : http://thelinuxnoob.com/linux/screen-in-ssh/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM