Re: Efficient Create Swap File?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike McCarty wrote:
> 
> $ diff -s file1 file2
> Files file1 and file2 are identical

Identical? Try this:
  du file1 file2

and you will see that one of them has not allocated disk blocks,
it is sparse (has holes).
IIRC sparse files are unacceptable for swap (the recent "swap files
are as fast as swap partition" feature actually means that the kernel
identifies where the file is on the disk and uses those blocks as a
sort of "fragmented partition").
And even if it works, it's a bad idea: the swap file will allocate
blocks in a very fragmented way in the future
(and there would be a "out-of-space" risk at the filesystem level
during a swapout..., brrrr).

You are right in one thing: writing the zeroes should not be
needed; it happens to be that writing something is the
only way to allocate disk blocks in most filesystems
(persistent preallocation in ext4 will change this).

> My guess is that when the swap file with a "hole" first gets used, there
> will be a long(ish?) pause while some part or parts of the sparse file
> get filled in. This is not so good for a swap file, but when one
> is actually going to rewrite most of the file anyway, and is only
> using the file itself as more or less an indicator of the size, then
> it might make sense.

In theory, but you would risk: fragmentation and possible disk-full.

Best regards.
-- 
   Roberto Ragusa    mail at robertoragusa.it

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux