Live data from Hacker News

How to write a filesystem in 50 lines of code

blog.ksplice.com

1–10 of 31 posts

Re: How to write a filesystem in 50 lines of code

#2
While this is a very interesting article, I think it would be great if people stopped using "How to do x in y lines of code" titles - it's just as bad as "x things about y" titles. It's a lot better when title actually describes what the article is really about.

It would be awesome if this was added to the FAQ or something.

Re: How to write a filesystem in 50 lines of code

#3
Disclosure: author of Dropfuse fs http://github.com/arekzb/dropfuse . I wrote it to solve a personal need for fetching shared files by command line.

Yes, FUSE is indeed fun and poses an easy entry barrier to writing a user-space filesystem. Many projects that are based on it are listed on their wiki page as well and a lot of them have source code available.

Re: How to write a filesystem in 50 lines of code

#4
Youch! Beware, there are hidden pitfalls here.

I tried the fuse-python xmp example and accidentally mounted the filesystem on top of an existing folder with the result being that the folder vanished. Now if I try to cd into that folder I get an input/output error. It doesn't show up on directory listings. And umount says it's not mounted. I have a backup so this is not an unmitigated disaster, but the folder is huge (it's my development folder) so I'd much prefer not to have to do a restore. This is MacFuse 2.0.3 running on Snow Leopard. Any suggestions on how to proceed would be greatly appreciated.

Re: How to write a filesystem in 50 lines of code

#5
post #4

Youch! Beware, there are hidden pitfalls here. I tried the fuse-python xmp example and accidentally mounted the filesystem on top of an existing folder with the result being that the folder vanished. Now if I try to cd into that folder I get an input/output error. It doesn't show up on directory listings. And umount says it's not mounted. I have a backup so this is not an unmitigated disaster, but the folder is huge…

have you tried rebooting?

Re: How to write a filesystem in 50 lines of code

#7
post #2

While this is a very interesting article, I think it would be great if people stopped using "How to do x in y lines of code" titles - it's just as bad as "x things about y" titles. It's a lot better when title actually describes what the article is really about. It would be awesome if this was added to the FAQ or something.

"How to do x in y lines of code", where x is a perceived to be something very difficult and y is a small number, encourages people to try things that they would be otherwise be too intimidated to try.

Re: How to write a filesystem in 50 lines of code

#8
post #4

Youch! Beware, there are hidden pitfalls here. I tried the fuse-python xmp example and accidentally mounted the filesystem on top of an existing folder with the result being that the folder vanished. Now if I try to cd into that folder I get an input/output error. It doesn't show up on directory listings. And umount says it's not mounted. I have a backup so this is not an unmitigated disaster, but the folder is huge…

have you tried rebooting?

[deleted]

Re: How to write a filesystem in 50 lines of code

#9
post #4

Youch! Beware, there are hidden pitfalls here. I tried the fuse-python xmp example and accidentally mounted the filesystem on top of an existing folder with the result being that the folder vanished. Now if I try to cd into that folder I get an input/output error. It doesn't show up on directory listings. And umount says it's not mounted. I have a backup so this is not an unmitigated disaster, but the folder is huge…

have you tried rebooting?

Not yet. I was hoping to find a less drastic (and more educational) fix. I'm also a little worried that rebooting might make the situation worse since I don't really understand how FUSE works under the the hood.

Re: How to write a filesystem in 50 lines of code

#10
post #4

Youch! Beware, there are hidden pitfalls here. I tried the fuse-python xmp example and accidentally mounted the filesystem on top of an existing folder with the result being that the folder vanished. Now if I try to cd into that folder I get an input/output error. It doesn't show up on directory listings. And umount says it's not mounted. I have a backup so this is not an unmitigated disaster, but the folder is huge…

Your data is fine -- it's hidden while something else is mounted on top of the folder.

Rebooting will fix it. But you should be able to just unmount the filesystem, which will also fix it. Does 'mount' list something mounted there? Does 'df /path/to/folder/' reflect the FUSE filesystem rather than the underlying filesystem? The input/output error sounds like the FUSE filesystem being mounted indeed, and just being broken.

Post reply on HN