LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2016, 08:54 AM   #16
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,731

Rep: Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125Reputation: 2125

Why do you think the recommendation for allocation of a swapfile is to use dd ?.
 
Old 04-16-2016, 09:21 AM   #17
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,469

Rep: Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523Reputation: 1523
Quote:
Originally Posted by syg00 View Post
Why do you think the recommendation for allocation of a swapfile is to use dd ?.
Using dd does not guarantee a contiguous file. It uses normal write(2) calls to fill the file, and the filesystem code in the kernel allocates the blocks wherever it sees fit. Prior to ext4 there was no mechanism for requesting pre-allocation of blocks for a large file, so the allocation was always done in small chunks as the file was written. There is no way to ensure that a file in an ext2/3/4 filesystem is contiguous, and for files larger than 128MiB it is impossible for them to be contiguous. There is a maximum of 32768 4K blocks in a block group, and then the allocater has to skip over the next group descriptor and set of inode blocks.

Furthermore, for a non-empty filesystem, it is unlikely that there is any 128MiB block group that is completely empty, and therefore the maximum available contiguous space would be less than 128MiB. (The allocation strategy tries to equalize the usage of the block groups, thus increasing the likelihood that a file's data blocks can be located near the inode that references them.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem resuming from suspend to disk with multiple swap partitions guanx Slackware 2 10-02-2013 08:57 AM
Partioning a single partition into multiple partitions. Grtyop Linux - Newbie 4 07-05-2013 03:28 PM
Is it possible to use two swap partitions for multiple uses? texasone Linux - General 9 09-07-2011 06:32 AM
Multiple SWAP partitions: what is priority number?? coolblue Linux - Newbie 1 05-01-2007 02:26 PM
Multiple swap partitions? [GOD]Anck Slackware 10 01-01-2004 11:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration