LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 03-02-2005, 07:40 PM   #1
levicc00123
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 94

Rep: Reputation: 15
writing a filesystem from scratch?


What do I need to learn to be able to write my own filesystem? I'm not talking about writing an existing filesystem to a disk, I'm talking about creating a filesystem of my own from scratch for an experiment that I'm doing.
 
Old 03-02-2005, 08:30 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
I did this for an OS class that I took back in grad school. It's not terribly hard to do. I would suggest developing the filesystem in user space as much as possible using a ramdisk or file as filesystem methodology. Realize that filesystems are a middle layer between the kernel file access primitives (open, read, write, seek, etc.) and the physical hard disk. So your goal is to transfer file requests from the kernel to commands to read or write a particular sector of the hard drive.

You can simulate the hard drive in software by using a ramdisk as follows: malloc a large chunk of memory, and "read" or "write" a block from it by memcpy'ing one "chunk" of it to/from a fixed sized buffer provided by the caller. The size of the buffer should be "block size" of the file system, whichg can be whatever you want. If you actually incorporate your system into the kernel, you'd need to make this code talk to the driver that controls the underlying IDE or SCSI hardware and make it accept input from the VFS layer of the kernel (VFS abstracts out filesystem I/O to a standard set of calls -- makes it modular), but this should not be too difficult to do once you have the actual mechanism working.

Depending on the class requirements, you may be able to keep it on simulated hardware anyhow.
 
Old 03-02-2005, 08:40 PM   #3
levicc00123
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 94

Original Poster
Rep: Reputation: 15
but this isn't for a class, I'm thinking about writing my own operating system and I couldn't find an existing filesystem that did what I need it to.
 
  


Reply



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
A computer from SCRATCH!!! (and I mean SCRATCH) chutsu Linux - Hardware 10 11-11-2004 05:14 PM
DISCUSSION: Virtual Filesystem: Building a Linux Filesystem from an Ordinary File mchirico LinuxAnswers Discussion 0 10-28-2004 10:35 PM
Encrypted Root Filesystem HOWTO and /dev filesystem tmillard Linux From Scratch 0 10-18-2004 03:58 PM
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM
cd writing software which supports multisession writing jayakrishnan Linux - General 3 03-24-2003 05:51 AM

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

All times are GMT -5. The time now is 01:02 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
Open Source Consulting | Domain Registration