Large file split and join in linux

Let’s assume we have a large file of 102 GB and named as “vzdump-lxc-103-2021_07_19-12_05_06.tar.lzo”. We’d like to split this large file into 10GB of partial file. Let’s apply the split command as below-

split -b 102400M vzdump-lxc-103-2021_07_19-12_05_06.tar.lzo repo.

Wait for a while, the execution continues, and once over, you’ll find 11 split files altogether-

root@ktlhost4:/mnt/pve/nfs-1/dump# ls -lah
total 203G
drwxr-xr-x 2 root root 4.0K Jul 19 15:04 .
drwxr-xr-x 7 root root 4.0K Jul 14 19:39 ..
-rw-r--r-- 1 root root 10G Jul 19 14:53 repo.aa
-rw-r--r-- 1 root root 10G Jul 19 14:54 repo.ab
-rw-r--r-- 1 root root 10G Jul 19 14:55 repo.ac
-rw-r--r-- 1 root root 10G Jul 19 14:56 repo.ad
-rw-r--r-- 1 root root 10G Jul 19 14:58 repo.ae
-rw-r--r-- 1 root root 10G Jul 19 14:59 repo.af
-rw-r--r-- 1 root root 10G Jul 19 15:00 repo.ag
-rw-r--r-- 1 root root 10G Jul 19 15:01 repo.ah
-rw-r--r-- 1 root root 10G Jul 19 15:03 repo.ai
-rw-r--r-- 1 root root 10G Jul 19 15:04 repo.aj
-rw-r--r-- 1 root root 1.3G Jul 19 15:04 repo.ak
-rw-r--r-- 1 root root 102G Jul 19 13:23 vzdump-lxc-103-2021_07_19-12_05_06.tar.lzo

Now it’s time join the split files, so here it goes-

cat repo.?? > vzdump-lxc-103-2021_07_19-12_05_06.tar.lzo

Your slit files are not joined in a single file again.

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.