WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Understanding Mount Mode and Copy Mode  (Read 2302 times)

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Understanding Mount Mode and Copy Mode
« on: May 08, 2020, 07:53:27 PM »
Hi all,

I am trying to get my head around how mount mode and copy mode work.

Through reading the book / online pages I think I may understand both of them. Here is what I currently understand, please let me know if this is right or if I have misinterpreted something:

Mount Mode
- Extensions exist compressed on the disk in a squashfs format
- These files can be mounted to the disk - this is basically an abstraction where files in the compressed archive are overlayed onto the file system as if they are just normal files
- Mounting therefore must be almost instantaneous, but reading these files has the overhead of needed to decompress them
- Because the mount is just an abstraction, the only space taken up on the disk is that of the compressed archive

Copy mode
- Extensions are fully uncompressed into RAM, and then overlayed onto the file system
- This takes time, but once done the extensions can be loaded very quickly
- The extension files then exist in two places, both compressed on disk and uncompressed in RAM
- When the program is launched memory is effectively wasted because the binary will exist both on the ramdisk and in working ram

So therefore it seems:
Mount mode - Faster boot, slower application launches but more optimal use of memory
Copy mode - Slower boot, faster application launches but memory is effectively wasted

Is my understanding correct?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: Understanding Mount Mode and Copy Mode
« Reply #1 on: May 08, 2020, 09:10:30 PM »
Hi jshorthouse
... Mount Mode ...
Hi marcelocripe
Most Linux distros have a persistent file system (/bin, /dev, /etc, /home, /lib, ..... ). When packages get installed, their files get copied
to  /usr (/usr/local/bin, /usr/local/lib, ..... ).

Tinycore is different. The file system gets created from scratch every time you boot. This diagram may help:
http://distro.ibiblio.org/tinycorelinux/architecture.html ....


 ... Installing (also known as loading) Involves loop mounting the  .tcz  which is in your  tce/optional  directory to a mount point in the
/tmp/tcloop  directory. The loop mount consumes a few hundred bytes of RAM. The files in  /tmp/tcloop/ExtensionName  get linked
into  /usr.  Each link consumes between 40 and 60 bytes of RAM.  The programs in the extensions do not consume any RAM until
you run them. When the program exits, the RAM is available for other uses.

Quote
So therefore it seems:
Mount mode - Faster boot, slower application launches but more optimal use of memory
Copy mode - Slower boot, faster application launches but memory is effectively wasted
Close, slower the first time it's launched. After that it's cached in RAM

You may also want to read this:
http://forum.tinycorelinux.net/index.php/topic,23127.msg144742.html#msg144742

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Re: Understanding Mount Mode and Copy Mode
« Reply #2 on: May 09, 2020, 12:49:26 PM »
Quote
... Tinycore is different. The file system gets created from scratch every time you boot. ...

So what I take from this is:
- The main filesystem is coped into RAM on boot
- Extensions when mounted are transparently overlayed onto this fileystem but only actually exist on disk
- However the mounting mechanism uses a small amount of memory

Is this correct?

Quote
Close, slower the first time it's launched. After that it's cached in RAM

Hmm ok, interesting. So does this mean that copy mode is more of a performance guarantee rather than a performance boost? I.e. for launching applications mount mode is sometimes as fast as copy mode, but sometimes not, whereas copy mode will have a consistent performance?
« Last Edit: May 09, 2020, 12:54:39 PM by jshorthouse »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Understanding Mount Mode and Copy Mode
« Reply #3 on: May 09, 2020, 02:31:47 PM »
Yes, that's pretty much it. There are other benefits, like the ability to remove the boot media while the system runs.
The only barriers that can stop you are the ones you create yourself.