4 ms·
I don't know but doesn't that mean that if a swap file had holes, the kernel will write to the holes hence corrupting any data present in the files stored at th
by hashhar 10y ago
I don't know but doesn't that mean that if a swap file had holes, the kernel will write to the holes hence corrupting any data present in the files stored at those holes?
We need a kernel maintainer here.
- jabl 10y agoFrom http://www.man7.org/linux/man-pages/man8/swapon.8.html http://www.man7.org/linux/man-pages/man8/swapon.8.html: > The swap file implementation in the kernel expects to be able to write to the file directly, without the assistance of the filesystem. So apparently it can work with a file that has holes, but then it cannot entirely bypass the filesystem, I guess.
- tinus_hn 10y agoIf by a file with holes you mean a file that has unallocated blocks (a sparse file, which is quite rare) such a file cannot be used as a swap file, the kernel will refuse it. If you mean a fragmented file, it works but it is slightly slower but not by a relevant amount. The kernel just remembers which blocks are in the file and uses these. As the swap file typically is created during installation it is unlikely to be fragmented anyway.