WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Free partition space when running in RAM  (Read 7334 times)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Free partition space when running in RAM
« on: June 25, 2009, 10:52:22 AM »
Dear Core Team,

just one thought for TC 2.1 features.

There are applications not available in source as usual but come with their own installer, like Google Earth and few others. These are checking available free free space in certain directoriesl, like /opt, ~, etc. and find 0 available when TC is running in RAM. There are other cases also where frree / available 'partition' size mybe interesting and would be good to have available on a usual LINUX way.

As an example see Conky reporting 0 space:



Regards,
« Last Edit: June 25, 2009, 11:02:34 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Free partition space when running in RAM
« Reply #1 on: June 25, 2009, 12:36:23 PM »
I saw this with the gtm5 extension where the mupip utility would not create a database file in ~tc (in ram) because it detected zero free space.  I thought at the time it was a problem with mupip and worked around it by creating a database file on a physical disk filesystem, moving the file to ~tc and saving it (compressed) as part of the .tce (to be installed by the startup script if not already present).

An empty database compresses really well, but I could still shave a few KB off of the .tce if I could just create the database on the fly when needed.
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Free partition space when running in RAM
« Reply #2 on: June 25, 2009, 01:41:31 PM »
TC is running as an embedded system, i.e., we stay running in initramfs. Typically all 2.6 based systems will have a small initramfs which is used until switch to a mounted root fs. Therefore initramds is ignored by df command. There was much debate if df should display it as it would be confusing to typical non-embedded use. We can monitor busybox, which promotes initramfs use, to see if initramfs df detection will be implemented. Interesting that Rob Landley, a major busybox developer, did make a  change to df in toybox's df command to report on initramfs.
10+ Years Contributing to Linux Open Source Projects.

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: Free partition space when running in RAM
« Reply #3 on: June 25, 2009, 04:45:27 PM »
As a workaround, perhaps creating a wrapper for df could work (specificially targetting /) for those cases for now.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Free partition space when running in RAM
« Reply #4 on: June 26, 2009, 01:16:23 AM »
Yes, this is what I wanted to propose also as a workaround.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Free partition space when running in RAM
« Reply #5 on: June 26, 2009, 04:02:44 AM »
Just as an illustration, this is the output of df on SLAX6 when running in RAM:



Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Free partition space when running in RAM
« Reply #6 on: June 26, 2009, 03:07:05 PM »
That would seem to indicate that a tmpfs was setup with a targeted size.
As a work around, for those that need it,  could you not do the same?
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Free partition space when running in RAM
« Reply #7 on: June 27, 2009, 03:54:31 AM »
Yes, we can. The only question is the missing new dh command  :) Will try to make one for testing next week.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Free partition space when running in RAM
« Reply #8 on: June 28, 2009, 12:24:54 AM »
I have built one and works for me.
I have posted for TC team testing before I make a public RC.
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Free partition space when running in RAM
« Reply #9 on: June 28, 2009, 06:42:32 AM »
Thanks! Waiting to get it.

Béla
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Free partition space when running in RAM
« Reply #10 on: June 28, 2009, 04:48:46 PM »
Robert,

thanks for the change in 2.1 Tested with Google Earth and its installer now sees properly the free space.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Free partition space when running in RAM
« Reply #11 on: June 28, 2009, 04:53:11 PM »
There is a small price to pay, both in boot time and memory usage.
At first I was relucant to do it, but now I think it was worth doing.
10+ Years Contributing to Linux Open Source Projects.

Offline helander

  • Full Member
  • ***
  • Posts: 183
Re: Free partition space when running in RAM
« Reply #12 on: June 30, 2009, 04:53:55 AM »
I am very curious to know how this was solved. What file(s) were modified? Code snippet(s) of the relevant part(s)?


/Lars

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: Free partition space when running in RAM
« Reply #13 on: June 30, 2009, 09:20:58 AM »
initramfs, which has served us well, does not have a specified size, therefore df reports 0 and installation scripts that check space requirements fail.

tmpfs which also is ram based can easily be setup with size specified.

Therefore it is easy to setup tmpfs and copy the contents of initramfs to tmpfs and switch root to tmpfs.

The setup, copy, and switch root, is the price to pay to use tmpfs over initramfs. You can easily see how I solved this by looking at the contents of /init
10+ Years Contributing to Linux Open Source Projects.

Offline helander

  • Full Member
  • ***
  • Posts: 183
Re: Free partition space when running in RAM
« Reply #14 on: June 30, 2009, 10:15:07 AM »
You can easily see how I solved this by looking at the contents of /init

Thanks.

I failed to look at all places, except the obvious  :).

With this solution, I guess the memory used for the initramfs is not reclaimed (guess based on no explicit unmount in the init script and that mount command shows a rootfs mounted at /)?

Could this memory be reclaimed at all? Since init runs from this filesystem I guess it could be hard to dispose of it?

If the memory can not be reclaimed, one could possible improve the memory situation by a scheme like the following:

   
  • build the drivers for filesystems and other elements used short after boot into the kernel
  • load rest of the modules currently in tinycore.gz thru an extension during tc-config

Since the loading of extensions are made fairly "late" in tc-config, some re-ordering of the stuff in tc-config might be needed.

This would make tinycore.gz "free" from kernel modules and make the non-reclaimable memory portion smaller (smaller initramfs).

Another benefit of this solution is for people like myself that uses tinycore with a custom kernel. This way one could use the standard tinycore.gz with "any" kernel, since all things needed before tc-config would be in the kernel and the rest of the stuff will be thru an extension that is built for that particular kernel and loaded by tc-config.


/Lars