[clug] Cut a file in place.

Steven Hanley sjh at svana.org
Wed Sep 18 07:54:33 UTC 2019


On Tue, Sep 17, 2019 at 04:28:52PM +1000, Michael Cohen via linux wrote:
> man truncate explains that the size of the file can be shrunk reliably.
> AFAIK it is not possible to create a hole at the start of the file - only
> the end of the file can be truncated (or extended). So what you would need
> to do is use dd (seek and skip) to copy the last say 1gb off the file into a
> part, then truncate to truncate the 26gb file to 25gb. Rinse repeat until
> you get all the parts.

That is a really neat solution, I like it.

Chunks from the end of the file using dd to then truncate it as each chunk
is taken away.

Steve

> 
> 
> Thanks
> 
> Mike.
> 
> 
> On 9/17/19 12:24 PM, Andrew Janke via linux wrote:
> >Nope, sadly.
> >
> >For those asking it's on a laptop with a limited size SSD and no external
> >doo-dad.  Also, I want to know if it's possible, because it has to be! :)
> >
> >a
> >
> >
> >On Tue, 17 Sep 2019 at 11:05, Alastair D'Silva <alastair at d-silva.org> wrote:
> >
> >>On Tue, 2019-09-17 at 09:31 +1000, Andrew Janke via linux wrote:
> >>>Hi all,
> >>>
> >>>Let's say I have a 26GB compressed archive and 17GB of spare disk
> >>>space and
> >>>want to cut it up into chunks. The internet says no, but this list
> >>>typically doesn't fail me.
> >>>
> >>>Chop a bit off the front and then use truncate the file?  Seems a
> >>>risky way
> >>>but the option that I'll have?
> >>>
> >>>a
> >>Is the archive something you can recreate? If so, remove and recreate
> >>it with something like:
> >>
> >>tar jcvf - /some/dir | split -b 1M - outfile.
> >>
> >>--
> >>Alastair D'Silva           mob: 0423 762 819
> >>skype: alastair_dsilva
> >>Twitter: @EvilDeece
> >>blog: http://alastair.d-silva.org
> >>
> >>
> >>
> 
> -- 
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux

-- 
Steven Hanley sjh at svana.org http://svana.org/sjh/diary
whose name is printed in bigger type
you know i live in a world full of hope
not a world full of hype
   Egos Like Hairdos - Puddle Dive - Ani



More information about the linux mailing list