Home > ubuntu > Splitting files with 7zip without compression

Splitting files with 7zip without compression

I have to copy a large (12GB) file to an external USB Drive that’s formatted in FAT32, which is limited to a maximum of 4GB per file.

I can split the files with the split command, but the owner of the disk has Windows, so I decided to generate a multipart 7zipped file from command line. As the original file is already compressed, I use no compression switch:


$ 7z a <filename> -mx0 -v4092m <file_to_be_compressed>

The switches stands for:

  • -mx0: level of compression, where 0 means copy mode, i.e., no compression (usr/share/doc/p7zip-full/DOCS/MANUAL/switches/method.htm)
  • -v4092m: create volume size of 4092 MB (/usr/share/doc/p7zip-full/DOCS/MANUAL/switches/volume.htm)

If you use -v4g to generate 4GB chunks, this 4GB will be grater than the FAT32 4GB, and it will be impossible to copy to the FAT32 USB drive (thanks to @Nicolas R. for pointing -v4092m, better than -v4000m posted originally).

Once completed, you’ll have several files deppending on the size of the file to compress, named  filename.7z.001, filename.7z.002, …

Advertisements
Categories: ubuntu Tags: , , , ,
  1. Nicolas R
    May 24, 2017 at 14:18

    You can optimize the parameter with -v4092m (4 x 1023 MB is ok for FAT32, 4 x 1024 is the actual limit)

    Like

    • May 24, 2017 at 17:10

      Thanks Nicolas, I’ve updated the post with your suggestion.

      Like

  2. March 6, 2016 at 17:57

    Nice. This (splitting without compression) should have been implemented in gnome/cinnamon years ago.

    Like

  3. Jason
    July 6, 2015 at 22:52

    Hi! Thank you very much for this tutorial. I was curious if you knew a way to split a text file by lines instead of max size. We have txt file with a bunch of records on each line. When I split it by size, it cut some of the lines in half, which break the record and give us false-positives. Any info would be greatly appreciated!!

    Like

  4. varalakshmi
    June 27, 2014 at 7:25

    please help me regarding,how to merge 7z splitted files using c# code

    Like

    • June 28, 2014 at 16:58

      I’m sorry, but I can’t help you as I’m not familiar with C#

      Like

  5. Bostonian
    February 24, 2014 at 15:17

    Thanks for your post. How do you reassemble the split files into a single file?

    Like

    • February 25, 2014 at 9:25

      Hi @Bostonian, You don’t need to reassemble the files, as you get a multipart compressed file. You just have to open the first compressed file (<filename>.7z.001) with your file explorer (nautilus) and extract to the desired folder. Or extract the file via the command line using: 7z x <filename>.7z.001

      Liked by 1 person

  6. October 1, 2013 at 15:03

    I got this site from my friend who told me about this site and at the moment this time I
    am visiting this site and reading very informative articles here.

    Like

  7. August 28, 2013 at 4:31

    Nice tip. Though I think it should be `7z a -mx0 -v4000m `.

    Like

    • August 28, 2013 at 7:48

      You’re right!, I’ve updated the mistake. Thanks!

      Like

  8. July 2, 2013 at 3:50

    fantastic points altogether, you simply received a new reader.
    What might you suggest about your put up that you
    simply made a few days in the past? Any certain?

    Like

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: