linux - Splitting and removing a file? -
i trying split big (9gb file) smaller chunks read database 1 @ time. unfortunately, have 20gb ssd in machine (it inexpensive vps) , have 8gb free, hence splitting file can read , delete. while did think of scaling vps short period of time apparently cannot @ time, stuck looking other options.
i wondering, therefore, if possible utilize split command break file 9 parts while incrementally removing old file fit, instead of copying (as split does).
i have looked in manpages , see no reference process.
thanks!
you utilize tail -c 1g bigfile >lastchunk
save lastly gb bigfile lastchunk, truncate -s -1g bigfile
remove lastly gb bigfile (and free disk space). repeat until have handy sized chunks.
of course, problem how easy wrong. if truncate removes different number of bytes compared number of bytes read out tail either lose bytes or have duplicates resulting in corrupt data. using multipliers g should cut down possibility of harm. still, have backup , test run before.
linux split
No comments:
Post a Comment