How to cut a big file into pieces of a certain size?
I want to archive a big file, then cut it to fit several CDs.
Then copy these pieces from CDs, and make these pieces one big file back again. How can I accomplish it? Thanks. |
It's probably "split" to cut, and "cat" to merge.
|
Perhaps something like:
tar -cvzf - source_file | split -b 700m - tarpiece- cat tarpiece-* > filename.tar.gz |
Thanks, makuyl.
|
Quote:
I have been looking for a way to split files. I think the line above may be what I want. If you could clarify for me. I have a main hard drive and and secondary hard drive. Every so often I back up my home directory with the following ( a friend gave it to me). su then cd / tar cvf /mnt/shared/homemonth.tar /home/nappy This creates a tar file on my second hard drive. I then burn them onto a cd. However the files are now too big to burn onto a cd. My last backup was 906mb. My second hard drive has now run out of space as I have 4.1gb of tar files. I presume I would have to do the above command and then burn the bits to cd? I am unclear about the above command and I would like to understand it before I use it. Do I type it as you have written it? I presume I would type: tar -cvzf - /home/nappy | split -b 650m - tarpiece- I have to have all those dashes? Would this then create the bits of the tar file in my home directory, which I could then burn to cd? Sorry if this sounds really basic:newbie: Nappy |
First, you'd better back up like this:
Code:
tar -cjf /mnt/shared/home_month.tar.bz2 /home/nappy Then you can Code:
split -b 700m /mnt/shared/home_month.tar.bz2 Code:
man split |
Quote:
Thank you so much for that. It makes more sense to me like that. Command, the size you want and the file to do it to. The tar files are already sitting on my second hard drive. So I tried it out, took me a while to find the bits. The original file was 906mb. I found the bits called xaa and xab in the root directory. I then burned them to CD. Just two questions, if I wanted to get the file back, now it is on two cds, what would I do? The second question is can I rename xaa and xab, to something more meaningful. I am being careful to write on all the cd's, but they are all going to have files called xaa and xab. Regards Nappy |
Of course, you can rename it. xaa, xab, etc are just parts of the splitted file.
You can merge them back this way: Code:
cat xa* > my_home_dir.tar.bz2 |
Quote:
Thank you very much again. Your explanations have been clear and concise. That's what you need when your a newbie. Now if I could get you to come around to my house and get my scanner, usb port, card reader and camera to work I'd be well away :D Happy New Year! Nappy |
If you check the HCL (link at the top of the page), which stands for "Hardware Compatibility List," for your specific hardware, you'll see the success stories of others and how they got that same hardware to work for them!
|
All times are GMT -5. The time now is 11:49 PM. |