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

Re: Efficient Create Swap File?



Mikkel L. Ellertson wrote, On 03/27/2009 06:44 PM:
Todd Denniston wrote:
This brings up a question for me...
If using the first method, while in use or during the mkswap command,
does the  bits written to the file end up at the same physical locations
as the 0s they are replacing?
Yes - you are saving back to the same file. Not like a work
processor that makes a new file, and then renames it to the name of
the original file.
if they do, then the first method on a disk that is not fragmented,
would give you a contiguous swap space.
if they don't, then like you say, what is the point of writing all the
0s to disk?

So then do we have to think about our file systems?
msdos/vfat would write to the same locations I think.
ext2 would write to the same locations I think.
ext3 without journaling, would write to the same locations I think.???
This is the same as ext2. (ext3 is ext2 with journaling.)
ext3 with journaling, pathology???
ext4 with/without journaling, I have not used or read about.???
riser???
others???

Journaling should not make a difference. It is still reading/writing
the same file on the disk.

I am not sure how to explain this. You are accessing the file just
like you would access a hard drive. You are doing the equivalent of
accessing the track and sector of a hard drive. (Note: hard drives
are accessed as files under Linux/UNIX.) So if you read one block
from the file, modify it, and write it back to the same place, it is
also on the same place on the hard drive as the old block was.

Mikkel


My confusion sets in when I start thinking about the way the Journaling file system works, which I probably do not understand fully.

I thought that when you did a write, the file system (ext[34] in journal mode) would actually write to the journal area (which might be on different physical media) and then do the real write to the final physical media and after that was done it would mark the journal as done.... which, to me, might mean it was not writing to the same PHYSICAL location in the media. So yes everything is still a file to Unix, but are the gymnastics that are going on in the Journaling file system driver making all the nice setup not worth while?

Not enough time for me to investigate properly.
--
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter


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