Recently I am developing a feature where I need to protect a file from all users including the root. Most of the kernels do this by restricting the permissions stuff and/or attaching some special flags with the files notifying that this file should not be touched. While shaving this morning, I had a weird idea.
I want to protect a file, so restricting the permissions to root is an obvious thing to do here. But still root can modify this file. If I want to block root user as well, what if I had an another internal root like user? This would also be a root user, say a root cousin which is invisible to outside world. So in this case, root can read the file but can not modify it. I know this breaks the standard UNIX legacy we have that there is only one powerful god and that is root. What if we shatter this? There would be more than one god, so would there be a clash of titans? No, the rule is one god does not interfere with other god. The gods are read-only while interfering with another god. In this case, it gives an impression that root user is not able to modify certain file. Since internally this file is owned by root cousin, root is not able to change/modify it. So the change of behavior is quite noticeable. I don't know if this would be acceptable.
Since this root cousin is invisible to end user, he/she can not inherit root cousin privileges. And a root user can not change/modify the files that need to be protected.
This is a very simple idea and might have occurred to a lot of people. The moment I struck it, I felt like noting it down somewhere and thats why I am posting it here. I still need to figure out how to implement this. Will update about it soon.
Few basics on how to implement this. This root cousin needs a dedicated uid and gid at least for UNIX. This uid and gid can not be used by end user. Kernel uses this identifiers for its own protection. So there is no way an end user can make a file owned by root cousin. Only the kernel is able to use these dedicated uid and gid in order to protect some files even from root. So it is quite obvious that we should not use these root cousin privileges everywhere. Rather, its use should be kept to minimal. For files, we don't want even root to change/modify, we should make them own by root cousin. While displaying the file properties (ls command), should we display the dedicated uid and gid for root cousin or should we show root uid and gid instead? If we show root uid and gid, the end user will still have the illusion that these files are owned by root but they can not be changed/modified. Great!! This goes well with the UNIX methodology. Lots of questions are popping in my head. Will update again as I have more answers.
Showing posts with label File Systems. Show all posts
Showing posts with label File Systems. Show all posts
Thursday, July 17, 2008
Saturday, December 22, 2007
How about a cluster File System???
Was just speculating about what exactly would I need, if i have to write a cluster file system? First, let us throw some light on the requirements. The file system needs to provide reliable storage, should support multiple read writes simultaneously, good performance and one of the most important fault tolerant.
A cluster friendly file system basically needs a fine grained and efficient Distributed Lock Manager, transport level protocols that support range locking, namely NFSv4 and CIFS and moreover it needs a cluster protocol to manage operations across nodes. Usually this cluster protocol runs over high speed networks like Infiniband, Gigabit ethernet (still slower), fiber channel so as to enhance the throughput.
A cluster is built for the purpose of high performance computing. So if the IO throughput is not good, it serves no purpose to build a cluster. How I see a cluster is a collection of bunch of machines working together under certain code to gain higher throughputs and thus reflecting one entity as a whole. So this would fit perfectly to a collection of commodity computers. I am not talking about custom build rack mounted clusters.
Basically IO throughput is enhanced using striping the data across all nodes in the cluster. This way we can do a parallel read/writes and read aheads. Even if this increases the amount of meta data that needs to be maintained for a file, it increases the throughput on a larger scale. Most of the existing clusters including the google file system, luster implement same techniques.
A good light weight Distributed Lock Manager would help in minimizing the locking periods across files. Major files operations lock the parent directory. So fine grained locking would help to keep contention at the lowest possible level.
But making the cluster fault tolerant is one heck of a task. Say, while watching a movie over the cluster, if the next frame is unavailable, the movie player will halt waiting for the frame. The catch is to get the data within limits of application time out. If the backend is built with RAID, the application has to wait until RAID rebuild is complete. And this time is too big and the application will time out for sure. So how to solve this problem? There is no definite answer here. Only thing we can possibly do is to take a top down approach and build a framework to support data losses. These strategies include RAID (for data regeneration in case of losses), CRCs to detect corruptions etc. Still not fool proof :(
Managing data losses/outages is a tricky question and not completely answered. If the cluster is serving a data intensive application with utter need of uptime, probably keeping a copy of data would serve the purpose. This is a hell lot space inefficient but would save you time for sure. The other option is going the RAID way. RAID is built to be space efficient but the RAID rebuilds are really inefficient in practical life.
A cluster friendly file system basically needs a fine grained and efficient Distributed Lock Manager, transport level protocols that support range locking, namely NFSv4 and CIFS and moreover it needs a cluster protocol to manage operations across nodes. Usually this cluster protocol runs over high speed networks like Infiniband, Gigabit ethernet (still slower), fiber channel so as to enhance the throughput.
A cluster is built for the purpose of high performance computing. So if the IO throughput is not good, it serves no purpose to build a cluster. How I see a cluster is a collection of bunch of machines working together under certain code to gain higher throughputs and thus reflecting one entity as a whole. So this would fit perfectly to a collection of commodity computers. I am not talking about custom build rack mounted clusters.
Basically IO throughput is enhanced using striping the data across all nodes in the cluster. This way we can do a parallel read/writes and read aheads. Even if this increases the amount of meta data that needs to be maintained for a file, it increases the throughput on a larger scale. Most of the existing clusters including the google file system, luster implement same techniques.
A good light weight Distributed Lock Manager would help in minimizing the locking periods across files. Major files operations lock the parent directory. So fine grained locking would help to keep contention at the lowest possible level.
But making the cluster fault tolerant is one heck of a task. Say, while watching a movie over the cluster, if the next frame is unavailable, the movie player will halt waiting for the frame. The catch is to get the data within limits of application time out. If the backend is built with RAID, the application has to wait until RAID rebuild is complete. And this time is too big and the application will time out for sure. So how to solve this problem? There is no definite answer here. Only thing we can possibly do is to take a top down approach and build a framework to support data losses. These strategies include RAID (for data regeneration in case of losses), CRCs to detect corruptions etc. Still not fool proof :(
Managing data losses/outages is a tricky question and not completely answered. If the cluster is serving a data intensive application with utter need of uptime, probably keeping a copy of data would serve the purpose. This is a hell lot space inefficient but would save you time for sure. The other option is going the RAID way. RAID is built to be space efficient but the RAID rebuilds are really inefficient in practical life.
Saturday, May 26, 2007
Storage Upcoming!!!
With ideas like thin provisioning taking shape, storage market is bumping with new ideas. And now comes pNFS - parallel NFS which enables multiple NFS servers to contribute to become a single server and share a clustered file system.
NAS though cheap has a fundamental limit in scaling and performance. Here the pNFS chips in. It can reuse your commodity servers to form a cluster out of them and can really scale linearly. It almost works like a multi path file system where a regular NFS server is replaced by a NFS4.1 Meta Data server(MDS). The MDS is moved out of band and now clients can directly talk to the array behind.
The best part is - this effort has been standardized through IETF and on its way to become a part of NFS4.1 draft. So storage vendors know which direction to drive their efforts to. As of now only Panasas provides a pNFS solution and chances are others will follow. It would be really interesting to see next few months on the market :)
Sun is likely to come up with the next implementation. For some good tutorials about pNFS, watch this space .... http://opensolaris.org/os/project/nfsv41/pnfsdemos/basics
An html version of the NFS 4.1 draft is available here
http://www.nfsv4-editor.org/draft-10/draft-ietf-nfsv4-minorversion1-10.html
NAS though cheap has a fundamental limit in scaling and performance. Here the pNFS chips in. It can reuse your commodity servers to form a cluster out of them and can really scale linearly. It almost works like a multi path file system where a regular NFS server is replaced by a NFS4.1 Meta Data server(MDS). The MDS is moved out of band and now clients can directly talk to the array behind.
The best part is - this effort has been standardized through IETF and on its way to become a part of NFS4.1 draft. So storage vendors know which direction to drive their efforts to. As of now only Panasas provides a pNFS solution and chances are others will follow. It would be really interesting to see next few months on the market :)
Sun is likely to come up with the next implementation. For some good tutorials about pNFS, watch this space .... http://opensolaris.org/os/project/nfsv41/pnfsdemos/basics
An html version of the NFS 4.1 draft is available here
http://www.nfsv4-editor.org/draft-10/draft-ietf-nfsv4-minorversion1-10.html
Tuesday, May 8, 2007
System layering
Recently Andrew Morton, a lead Linux kernel developer called ZFS as layering violation. And you can see a fantastic reply from Jeff Bonwick, the lead of ZFS project here -
http://blogs.sun.com/bonwick/entry/rampant_layering_violation
IMHO, even if ZFS violates the conventional layering stack, it will thrive as long as it is performing better than other file systems. ZFS is the future of file systems and has introduced many path breaking features which no other file systems can claim as of now. Few mentions would be detecting silent data corruption, numerous snapshots, scalable infrastructure, in short end to end data integrity which is what matters at the end of the day.
I might sound like anoother ZFS fan but the truth is out there. ext2/ext3 apart from doing what they are supposed to do are prone to silent corruptions and are doing basically what FFS was doing few years ago. Since ZFS guys were brave enough to throw away years old conventions, they have been able to aggregate the control to only one entity, the file system which can manage from raid groups to backup to clones.
I personally believe Linux is the best thing happened with the computers in last few years. But ZFS took over almost everyone in File Systems development. I think both OpenSolaris and Linux would thrive and Linux might adapt the new features offered by ZFS.
http://blogs.sun.com/bonwick/entry/rampant_layering_violation
IMHO, even if ZFS violates the conventional layering stack, it will thrive as long as it is performing better than other file systems. ZFS is the future of file systems and has introduced many path breaking features which no other file systems can claim as of now. Few mentions would be detecting silent data corruption, numerous snapshots, scalable infrastructure, in short end to end data integrity which is what matters at the end of the day.
I might sound like anoother ZFS fan but the truth is out there. ext2/ext3 apart from doing what they are supposed to do are prone to silent corruptions and are doing basically what FFS was doing few years ago. Since ZFS guys were brave enough to throw away years old conventions, they have been able to aggregate the control to only one entity, the file system which can manage from raid groups to backup to clones.
I personally believe Linux is the best thing happened with the computers in last few years. But ZFS took over almost everyone in File Systems development. I think both OpenSolaris and Linux would thrive and Linux might adapt the new features offered by ZFS.
Subscribe to:
Posts (Atom)