How to split and merge files inplace?

In the command line to slice or merge chunks of files without occupying additional space?
split and cat make a new file. And it is necessary to redistribute existing data across multiple files and Vice versa.
Something similar does fallocate (linux) - stupidly reserves under file existing free blocks.
I need something the same, but with pearl buttons.
Under the 3 OS and CLI.
April 4th 20 at 00:34
2 answers
April 4th 20 at 00:36
On the basis of the standard file API is likely impossible. Let me explain why. Linux operates on a file level API commands open/close/seek/read/write. This is the basis which works for all file systems. If you go down to the level of a specific file system (e.g. vfat) then you can probably cut the file into pieces is a multiple of the block size of the file system without re-allocations. But it's a dirty hack which will only work under root only for a specific file system. And only for special conditions (boundary block). In General, technically it can be done but the use of this utility will be "devastating" nature of the utilities like parted, fdisk, mkfs.* and others. I seriously doubt that such tools will be useful and relevant. It is better to use the normal API.
No, well, it is clear that this is not "Hello world" write - it is necessary to work directly with units of FS.
And it is clear that this gun is quite good, can shoot in the leg.
But sometimes very necessary.
For example, if it is urgent to cut 50-gig partition on the pieces of 2 gig (upload to mylabel) and glue back then. And extra 50 gigs for manipulation just physically not (or not as much time).

Somehow we need to find how to "pass" the blocks from one file to another. Without the release (or reserve freed blocks). - Marvin43 commented on April 4th 20 at 00:39
I bekapy and archived database. Oracle if there is insufficient space on the local server. Look mknod (FIFO). I think with pauses and stops your task can be realized.

mknod -p file01
mknod -p file02
split 50gigfile file01 file02 ... e.t.c.
- Lester.Mueller commented on April 4th 20 at 00:42
April 4th 20 at 00:38
It is impossible to do so.
You can cut the particular file using truncate, but that of one to make a few - will not work.

fallocate does not, he creates a file of the right size, but fills it with data, just telling the filesystem how much space it needs. But fallocate does not control a specific area of the disc, and slice the already existing data can not in principle.

The only option is to read the file into memory, delete it on the disk and to burn a few already from memory. But it is clear that the size of the file with limited capabilities. You can write. And in any case will be read/write.

Find more questions by tags LinuxSystem administrationmacOSWindows