Whole-System Snapshot on Operating System

what does it mean to have just the snapshot of the distribution filesystem when creating containers in docker?

Note that filesystem is a method of storing data. I assume that in your question by "filesystem" you mean collectively dorectires, directories structure, files, files attributes, files and directories permissions and all other data (modification times, last access times) exposed by the filesystem that the data are stored on. An operating system (for example a linux distribution) can be run on different filesystems. I run my linux on ZFS, and my servers uses ext4.

why do we need the snapshot of just the filesystem

To copy all the information that compose the data.

what is its importance, is the filesystem is what separates distributions from each other ?

Well, I would say that basically distributions primarily differ in people that take care of that distribution. Ubuntu is owned by Canonical Ltd. and Ubuntu Foundation, archlinux is produced by Aaron Griffin. Because different group of people manage the product, you get different products with different visions. It's like cars - Audi has it's own cars, Mercedes has it's own.

distros differ in window managers and desktop environment

No, they do not. Window manager and desktop environments are (in most cases) managed by different and separate people that manage linux distributions. You can buy Michelin tires to an Audi and to a Mercedes, the same way you can install xfce4 on archlinux and on ubuntu.

so is the filesystem is what essentially is different in all the distributions ?

I would say my subjective point of view would be: "management" of an linux distribution, as an overall process, as an overall community longterm vision of an operating systems goals and behaviors, but also as a process of doing daily management tasks like installing packages and bug handling would be for me what is essentially different between distributions. Archlinux wants to be simplistic, minimal, modern, user centric. Ubuntu wants to bring free software to wider audience and accelerate innovation. Different visions leads to a different product. Ferrari wants to be fast, Audi wants to be comfortable, etc.

why do distributions have different filesystems

Linux distributions do not have filesystems. An operating system can be installed on many filesystems: you can install ubuntu on btrfs, install ubuntu on ext4, etc.

If by filesystem you mean all the data that is stored on a filesystem: because different distribution make different design choices when creating their operating systems, there are many differences between the data packaging process and how the data is distributed by different distributions. So the resulting data stored on a filesystem differ.

what are the diffrences between these filesystems?

The most visible difference to users is of course the package manager - the tool that manages and automates installing, upgrading and configuring data on your operating system. Ie. ubuntu uses apt-get, archlinux uses pacman. There are differences in distributions installations process and scripts.

In linux, how do I create/restore an image snapshot of my entire drive?

The tool you want (which most closely resembles Time Machine) is called rsnapshot. Unlike normal backup tools it copies only things that have changed, and it allows you easily to travel to many points in time. You can tell it how much disk space it is allowed to have, and it adjusts the number of snapshots kept to stay within that limit. A very nice tool.

How to screenshot a specific application using dart?

Using this code I could get a screenshot of a whole screen

That is not really what the code you've shown does. That code is instructing a Flutter renderer in your application to render something to an image. Having your own application draw some or all of its UI to an image instead of the screen is completely different from getting a screenshot; the latter involves asking the OS for the output of everything that is rendering to the screen, post OS-level composition. On mobile, where applications are generally full screen, those things might have similar output, but they are not at all the same thing.

There is no Dart API that will take an actual screenshot. You would have to write native code that uses native OS APIs to take screenshots on each desktop OS you want to support, and call that code via FFI (or, if you are using Flutter as in your example code, you could use platform channels).

What happens when write request occurs in snapshot copy on write?

This very much depends on what kind of snapshots you are talking about.

If you are talking about the kind of snapshots built in to a copy-on-write filesystem like Btrfs or ZFS, then write requests on snapshots "just work" as a side effect of how the file system works: when new data are written, they are written to a new location, and new metadata are written to reflect this. But both the new data and metadata are written in one snapshot only, not in the other. Once the new data and new metadata are written, the snapshot that was written releases the old copies – but the other snapshot is still using that copy so they aren't actually released. The end result is that these data are no longer shared between the two snapshots. I use the terms "snapshot" and "other snapshot" because in this kind of system, once a snapshot is taken, both the snapshot and the original are on equal footing.

If you are talking about something like LVM snapshots, then the file system is actually completely unaware of what's going on. As far as it's concerned, it's writing to a regular block device. In this case LVM has to manage which underlying blocks are still shared between the snapshot and the snapshot's origin and which ones have diverged. The snapshots stores copies of the blocks that have diverged (either because they were written in the snapshot or in the origin device).

Can I assume an executable file as a snapshot image of an execution state?

Usually the executable file does not contain only instructions but also global data, readonly data and many more. I suggest you briefly look e.g. on the ELF format widely used in UNIX-like operating systems or PE format used in Windows.

The OS may also need for example to replace some addresses of functions (jump targets) with the real addresses of these functions in the memory, although this technique is probably not used anymore in common OSes. Anyway, there can be more work to do than just copy the file into memory and start executing from the first byte.



Related Topics



Leave a reply



Submit