Spreadfirefox Affiliate Button
Custom Search

Friday, October 31, 2008

SPLIT AND JOIN FILES

We have a file which size is too big to save in USB Flash drive.
To split it to be a small size so its fit to store in USB is easy in linux platform, use "split" command which has been bundled in GNU Coreutils.

1. As example, we have an iso file (ubuntu-8.04-desktop-i386.iso) which size is 699 Mb
root@hardy:/home/bearisusanto/test# ls -alh
total 700M
-rwx------ 1 bearisusanto root 700M 2008-06-02 03:22 ubuntu-8.04-desktop-i386.iso

2. Before doing split process, first make MD5 file from ubuntu-8.04-desktop-i386.iso for ensuring that there is not a change for the file when its join again
root@hardy:/home/bearisusanto/test# md5sum ubuntu-8.04-desktop-i386.iso > MD5SUM.txt
root@hardy:/home/bearisusanto/test# cat MD5SUM.txt
8895167a794c5d8dedcc312fc62f1f1f ubuntu-8.04-desktop-i386.iso

3. For splitting ubuntu-8.04-desktop-i386.iso to be a file which the size maximal 400Mb for each file, we type the command
root@hardy:/home/bearisusanto/test# split -d -b 400m ubuntu-8.04-desktop-i386.iso ubuntu-8.04-desktop-i386.iso.part

4. If we check in the directory, there is two 2 which is the result from splitting process
-rwx------ 1 bearisusanto root 700M 2008-06-02 03:22 ubuntu-8.04-desktop-i386.iso
-rw-r--r-- 1 root root 400M 2008-10-31 23:13 ubuntu-8.04-desktop-i386.iso.part00
-rw-r--r-- 1 root root 300M 2008-10-31 23:13 ubuntu-8.04-desktop-i386.iso.part01

5. To join the two file to be one file as the same with the original file, we use "cat" command but the original have to be deleted first.
root@hardy:/home/bearisusanto/test# rm ubuntu-8.04-desktop-i386.iso
root@hardy:/home/bearisusanto/test# cat ubuntu-8.04-desktop-i386.iso.part00 ubuntu-8.04-desktop-i386.iso.part01 > ubuntu-8.04-desktop-i386.iso

6. For ensuring that there is no difference with the original file, we have to validate with using MD5SUM.txt which have made for the first time.
root@hardy:/home/bearisusanto/test# md5sum -c MD5SUM.txt
ubuntu-8.04-desktop-i386.iso: OK

No comments: