Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2019 14:44:18 -0800
From:      Aleksandr Miroslav <alexmiroslav@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: silly (non-bsd) split/cat question (solved)
Message-ID:  <CACcSE1z0qd=M5o%2BeVUxJwp8_%2BB7iw8jj_ccC7dms6bEhm_EoOw@mail.gmail.com>
In-Reply-To: <CACcSE1zUtJLq5HD9S1c7cb-KUpkDpuqNEwKJd0zkabkGAXjP4w@mail.gmail.com>
References:  <CACcSE1zUtJLq5HD9S1c7cb-KUpkDpuqNEwKJd0zkabkGAXjP4w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 20, 2019 at 11:15 AM Aleksandr Miroslav
<alexmiroslav@gmail.com> wrote:
> So my question is this: if I have bigfile, which is about 12GiB in
> size, and I have 9GiB left of free disk space, how do I split bigfile
> into files of about 2GiB?

Figured it out. There's a command called "truncate" that will cut off
the end of any file in-place.

Using split, I cut up bigfile, but while the split is still running I
delete the first couple of files.

So for bigfile above, I ran "split -b 2g bigfile &" and then "rm xaa"
and "rm xab" after those files were created, but while the rest of the
files were being created. This left me with xac, xad, xae, and xaf,
ie. the last 4 chunks of the split.

I then used truncate to reduce bigfile to the size of the first two
chunks. I then ran the same split command again to create the first
two chunks.


This solved my problem.

(There's probably an easier way to do this with dd and its skip parameter.)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACcSE1z0qd=M5o%2BeVUxJwp8_%2BB7iw8jj_ccC7dms6bEhm_EoOw>