[clug] Cut a file in place.

Michael Cohen scudette at gmail.com
Tue Sep 17 06:28:52 UTC 2019


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.


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
>>
>>
>>



More information about the linux mailing list