LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-14-2007, 08:06 AM   #1
j0hn_galt
LQ Newbie
 
Registered: Jun 2005
Location: Bangalore , India
Distribution: Fedora Core 4, Suse 10.1
Posts: 27

Rep: Reputation: 15
purposely create noncontiguous blocks in ext2


hello,

i need to create an ext2 filesystem, in which i can be assured that a file is physically noncontiguous on the ext2 fs.

must be a weird request but i need to do this for a simulation which is related to my study. i can create the file of the required size with some programming, however i am confused of how to assure that it would be noncontiguous.

if i have a file of 2000 bytes and i create an ext2 partition of block size 1024 would i be assured that it is noncontiguous?
do i have to also specify that i need only 1 block group?
if i have 2 block groups of block size 1024 would the 2000 bytes file be noncontiguous?

thanks!
 
Old 05-14-2007, 08:33 AM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
What is it exactly that you are trying to do? Are you trying to emulate disk fragmentation or do you simply want the file to be split up?
 
Old 05-14-2007, 11:15 PM   #3
j0hn_galt
LQ Newbie
 
Registered: Jun 2005
Location: Bangalore , India
Distribution: Fedora Core 4, Suse 10.1
Posts: 27

Original Poster
Rep: Reputation: 15
precisely i wish to write a program which reads a file sequentially (and random) in an ext2 filesystem. now i wish to show the effects of fragmentation and non-contiguous allocation in ext2. therefore it would be necessary for my file to be spread in a non-contiguous manner so that ultimately when the program displays the time required for access it would prove that due to non-contiguous allocation, the time required is more.

I need to do this because it would be a comparison with another filesystem which i am working on, which guarantees contiguous allocation-provided the programmer specifies exactly the no of blocks he requires...anyways that is the subject of another topic...right now i need to understand how fragmentation can be achieved

say if i create a really huge file- about 400-500 mb and create it in the / directory. would i be sure of it being noncontiguous?
also is there any command with which i can check the block size, number of block groups on my existing ext2 partition?

thanks!
 
Old 05-14-2007, 11:19 PM   #4
j0hn_galt
LQ Newbie
 
Registered: Jun 2005
Location: Bangalore , India
Distribution: Fedora Core 4, Suse 10.1
Posts: 27

Original Poster
Rep: Reputation: 15
@jay73-therefore in a direct sense i could reply to that question by saying- yes i want to split a file up. but of course splitting it at the disk level. not at the users end.

thanks
 
Old 05-15-2007, 12:16 AM   #5
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410

Rep: Reputation: 141Reputation: 141
Depending on the amount of memory you have, the size of the file, and the design of the process you use to read it, you may not actually notice any difference between a file that is badly split and a file that is on the disk optimally for the filesystem. You might want to experiment with randomly accessing files of different sizes. By randomly, I mean design access methods that access the file sequentially for x blocks then skip a bunch and continue somewhere else. To see any sort of useful results, you will probably want to use a computer with the bare minimum amount of memory necessary to get it to boot. If that's not possible, you may have to resort to something like turning swap off and doing a very large mmap in some process in order to reduce the possibilty that caching will alter your test in such a way that it doesn't show anything useful. OTOH, the whole purpose of the assignment might be to have you demonstrate to your teacher that you understand the power of the disk caching system in the Linux kernel.
 
Old 05-15-2007, 12:17 AM   #6
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
I'm afraid you'll find ext2 to be quite resilient when it comes to fragmentation. It may become noticeable, however, when writing to a partition that is barely large enough to hold a new file: if the unused contiguous space is too narrow to store all of the new file in contiguous space, the system will have to look for any "holes" left open by previous writes; fragmentation then becomes inevitable. I imagine this situation could be reproduced by creating a fairly small partition and writing a multitude of files until the available space is (almost) used up. Fragmentation should then increase as the available space runs out, especially when the last files are a of the larger type. Fragmentation rates can be checked using this command:

e2fsck -nv /dev/hda?|grep config
 
Old 05-15-2007, 06:38 AM   #7
j0hn_galt
LQ Newbie
 
Registered: Jun 2005
Location: Bangalore , India
Distribution: Fedora Core 4, Suse 10.1
Posts: 27

Original Poster
Rep: Reputation: 15
@jay- thanks for that tip. i think i ll try that out- create a small partition and place a large file on it.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can I create a email server when my isp blocks port 25 reeseslover531 Linux - Server 3 11-24-2006 11:18 AM
Displaying bad blocks list on ext2/ext3 MikeBike Linux - Hardware 1 05-31-2006 04:55 PM
Acceptable fsck noncontiguous percentage? Vgui Linux - General 2 08-10-2005 01:16 AM
Can Mac OS X create & mount ext2 image? deoren Other *NIX 1 05-23-2005 10:31 PM
Noncontiguous blocks in ext2 filesystem kwisi Red Hat 3 04-27-2005 02:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:05 AM.

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
Open Source Consulting | Domain Registration