Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

contiguous file system on RAID 1

Status
Not open for further replies.

yi

Programmer
Aug 9, 2000
4
US
i have installed redhat linux 6.2 on this machine and have a hardware RAID hooked up to it. it seems like i can't use the standard C functions read/write to put data onto the RAID or pull data off it. is there a way i can create a contiguous file system on the RAID to store data? the thing is i need to keep track of the start block and size of each file on the RAID so i need a contiguous file system where files/data are stored right next to each other instead of scattered all over the place.

any help would be greatly appreciated. [sig][/sig]
 
If you're using hardware RAID, then Linux should just see the drives that are part of the RAID array as one big drive. (Assuming that's how they've been configured.) This means that you should be able to use the standard C read/write functions to put data onto the RAID array.

When you installed RedHat and created a filesystem, the filesystem will have been set to span the disks that you configured in the RAID BIOS. This gives you your contiguous filesystem. (Well, as contiguous as a filesystem spread across several disks can be.)

Your final query, about having a file system where files are stored directly next to each other, isn't possible. This is for two reasons:

* Fragmentation. Files will become fragmented. There's not a lot you can do about it. The standard Linux/Unix filesystems are very good at keeping fragmentation to a minimum, so I wouldn't worry about it too much. If anyone knows a filesystem that avoids this, please let me know!

* The RAID hardware may be controlling the disk heads at a very low level to ensure that they are in a certain position for journal writing, for example. You would have to control the RAID array directly. Tricky...

Trying to program your way around either of these is going to cause you a whole lot of pain. I'd stay away from it and try to find another to whatever solution you are trying to create.

[sig]<p> Andy Bold<br><a href=mailto: > </a><br><a href= > </a><br>"I've probably made most of the mistakes already, so hopefully you won't have to..." Me, most days.[/sig]
 
thanks andy that was helpful.
the reason why i worry about file fragmentation is that i need to use the C write function to read data off the RAID (assume a file system has been created on the RAID and data has been written onto it). i would have to give the start block and size of that file so that the system can locate the file on the RAID and read it off till it reaches the size. in this case, if a file is fragmented and spread all over the place, then i wouldn't be able to locate all the pieces and their sizes which makes it impossible to implement the write function.
any solutions? thanks. [sig][/sig]
 
I thought that the standard C 'write' function took a file descriptor that pointed to a file opened for writing? All of the writing to the file in it's actual disk locations should be taken care of for you by the 'write' function. In other words, 'write' will locate all of the pieces for you no matter where on the RAID array they may be. What does the &quot;man&quot; page for your write function say? [sig]<p> Andy Bold<br><a href=mailto: > </a><br><a href= > </a><br>"I've probably made most of the mistakes already, so hopefully you won't have to..." Me, most days.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top