-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External disk support #48
Comments
I am more animalistic about implementing a file system. |
Great! If I work on this topic I will:
trait Disk {
fn read_block(&mut self, lba: usize, buf: &mut [u8]) -> Result<usize /* # of bytes actually read */, DiskError>;
fn write_block(&mut self, lba: usize, buf: &[u8]) -> Result<usize /* # of bytes actually written */, DiskError>;
}
First, I recommend you to learn how file I/O works in major operating systems like Linux and FreeBSD. I think this book is a good start point to learn the internals. |
A great plan, thanks, I will first understand the implementation of the linux file system by reading this book. |
Yes. I agree ext2 is the best for the first file system implementation because ext2 and its descendants ext3/ext4 are popular and well-known: there're good articles, sample implementations, and tools. |
The Block I/O subsystem is a bit off-topic so the first goal would be writing ext2 reader/writer library. |
Can I suggest starting from simpler filesystem, potentially some FAT derivative might be easier for start. |
Of course! Other file system implementations are also welcome. That said, I think FAT is a good for us because:
Perhaps minixfs could be interesting. |
That might be interesting, maybe we should have a VFS? |
Kerla already has a sort of file system abstraction 😃 You can mount an arbitrary file system here: Line 42 in 00f9c96
|
cool,It seems that I did not understand kerla carefully,That's not great |
You don't need to say that! Please feel free to ask me anything even if the question is trivial. It also helps me to write docs 👍 |
While it's not designed for UNIX, it's very simple to implement - and I suggest that as starting point and test thing. Keep in mind to use SD Cards you pretty often need FAT and/or exFAT support as this filesystem in part of the SD Card specification. Moreover, (FAT is already implemented in Rust](https://github.com/rafalh/rust-fatfs). Metadata can be mapped via hidden files. Most FAT patents expired already, potentially there are some for exFAT. |
Makes sense. We need to support FAT anyway in the future to support some boards like Raspberry Pi. |
I see https://github.com/pi-pi3/ext2-rs which could be a starting point but not sure how usable it is for this purpose |
There is an updated fork https://github.com/rcore-os/ext2-rs which is in better shape than original |
Currently, Kerla uses initramfs embedded into the kernel as its root file system.
The major disadvantage is that the all file contents will be loaded into the memory. That is, if you want to run a 100MiB Docker image, 100MiB needs to be reserved for initramfs!
This issue is aims to allow running large Docker images by:
The text was updated successfully, but these errors were encountered: