WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Keep TC from loading to RAM?  (Read 7950 times)

Offline cortman

  • Newbie
  • *
  • Posts: 36
Keep TC from loading to RAM?
« on: April 01, 2013, 11:39:04 AM »
I realize this is kind of a fundamental aspect of TinyCore, but I am curious.
I have a very old laptop that runs TC fairly well, and as it has no real networking capabilities I am really thankful for TC's SCM repository.
However this machine only has 64 MB of RAM. The base TC system alone uses up almost 50 MB when it is loaded at startup. Extra packages to load would max the machine out very fast.
Therefore I was wondering if there was any way I could run TC without having it load to RAM, so I would be able to run more applications and use my 64 MB a little better. I'd like to run TC straight from the HDD.
Or is it possible (if I can't run it from the HDD) to have it load to a swap partition and run from there?

Thanks.
Copy.com offers 15 GB free cloud storage plus 5 GB extra for both of us when you use my referral link: https://copy.com?r=IlpMD4 :)

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Keep TC from loading to RAM?
« Reply #1 on: April 01, 2013, 12:08:01 PM »
You can reduce the memory footprint with the opt= and home= boot options.
Don't forget to remove opt and home from /opt/.filetool.lst.
With all the extensions loop mounted, that will leave very little in RAM.

Running root from hard disk is NOT supported.  You will have to find a different distribution if that is a requirement.

Offline cortman

  • Newbie
  • *
  • Posts: 36
Re: Keep TC from loading to RAM?
« Reply #2 on: April 01, 2013, 12:18:56 PM »
OK, thanks for clearing that up.
My other question was whether or not I could have TC load to a swap partition instead of RAM?
Thanks.
Copy.com offers 15 GB free cloud storage plus 5 GB extra for both of us when you use my referral link: https://copy.com?r=IlpMD4 :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11702
Re: Keep TC from loading to RAM?
« Reply #3 on: April 01, 2013, 12:43:20 PM »
Hi cortman
Quote
My other question was whether or not I could have TC load to a swap partition instead of RAM?
I don't think so. Try adding the boot code  nozswap  to reduce Ram usage, see:
http://forum.tinycorelinux.net/index.php/topic,15096.msg86542.html#msg86542

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Keep TC from loading to RAM?
« Reply #4 on: April 01, 2013, 01:00:26 PM »
If you have a formatted swap partition, Core will find it and use it automatically.
You need to add a nozswap boot option to disable the RAM zswap.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Keep TC from loading to RAM?
« Reply #5 on: April 01, 2013, 04:09:15 PM »
My other question was whether or not I could have TC load to a swap partition instead of RAM?

The question starts from a wrong base, "instead" does not apply; it's in the kernels competence to decide which data of tmpfs swapped to disk and when.

However, you can tune the kernels tendencies as follows:
As root (not sudo) do

Code: [Select]
echo 100 >/proc/sys/vm/swappiness
echo 100000 >/proc/sys/vm/vfs_cache_pressure

could optimize usage of RAM in favor of needs of programs.

As an alternative to a swap partition you could use a swapfile named "tc.swp" and use boot code "swapfile=".
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline cortman

  • Newbie
  • *
  • Posts: 36
Re: Keep TC from loading to RAM?
« Reply #6 on: April 03, 2013, 03:56:04 PM »
Perhaps I'll try what you detail there. Thanks for the info. I'll post back if I run into anything more.
Copy.com offers 15 GB free cloud storage plus 5 GB extra for both of us when you use my referral link: https://copy.com?r=IlpMD4 :)

Offline cortman

  • Newbie
  • *
  • Posts: 36
Re: Keep TC from loading to RAM?
« Reply #7 on: April 04, 2013, 11:30:11 AM »
OK. I have a base system, no extensions added, and I have removed wbar from the onboot list. I'm still using about 54 MB of RAM.
I ran the codes given by tinypoodle and i am using about 52 MB.
I really need to get this down around 20 MB or less.
What else can I do to lower RAM usage?
Is there any way to run the kernel from the HDD instead of loading it to RAM?

My boot codes are as follows:

Code: [Select]
tce=sda1
home=sda1
opt=sda1
multivt
host=shagrat
vga=788
nozswap
Copy.com offers 15 GB free cloud storage plus 5 GB extra for both of us when you use my referral link: https://copy.com?r=IlpMD4 :)

Offline cortman

  • Newbie
  • *
  • Posts: 36
Re: Keep TC from loading to RAM?
« Reply #8 on: April 04, 2013, 11:40:24 AM »
Further. I cp'd onboot.lst to onboot.lst.bak and removed everything from onboot.lst except

Xvesa.tcz
Xlibs.tcz
Xprogs.tcz
flwm_topside.tcz

which involved removing some wireless firmware stuff (although I will probably want at least some of that at some point) and that got the RAM usage down to about 33 MB, which is much better, but still needs to be lower.
Copy.com offers 15 GB free cloud storage plus 5 GB extra for both of us when you use my referral link: https://copy.com?r=IlpMD4 :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11702
Re: Keep TC from loading to RAM?
« Reply #9 on: April 04, 2013, 11:51:13 AM »
Hi cortman
How are you measuring RAM usage? Using the  free  command? If so, did you also remember to clear the cache first?
Code: [Select]
sudo cache-clear
free
Code: [Select]
tc@box:~/tcprovides$ free
             total         used         free       shared      buffers
Mem:        512184       455304        56880            0        18368
-/+ buffers:             436936        75248
Swap:      1047548       116628       930920
tc@box:~/tcprovides$ sudo cache-clear
tc@box:~/tcprovides$ free
             total         used         free       shared      buffers
Mem:        512184       328972       183212            0          308
-/+ buffers:             328664       183520
Swap:      1047548       116492       931056

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Keep TC from loading to RAM?
« Reply #10 on: April 04, 2013, 11:52:21 AM »
OK. I have a base system, no extensions added, and I have removed wbar from the onboot list. I'm still using about 54 MB of RAM.
I ran the codes given by tinypoodle and i am using about 52 MB.
I really need to get this down around 20 MB or less.

Install htop, it will show you memory usage in detail, distinguishing buffers and cache.

Run 'sudo cache-clear' each time before measuring memory.

Quote
Is there any way to run the kernel from the HDD instead of loading it to RAM?

The Linux kernel is always fully loaded in RAM, totally regardless of any circumstances.

Quote
My boot codes are as follows:

Code: [Select]
multivt

You can certainly save memory of getty or login shell processes running by omitting multivt boot code.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Keep TC from loading to RAM?
« Reply #11 on: April 04, 2013, 12:17:16 PM »
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Keep TC from loading to RAM?
« Reply #12 on: April 04, 2013, 12:28:16 PM »
Oh, and besides from using htop, you could run the 'watcher' extension to monitor 'net' mem usage.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline cortman

  • Newbie
  • *
  • Posts: 36
Re: Keep TC from loading to RAM?
« Reply #13 on: April 04, 2013, 12:30:06 PM »
Thanks for the replies. I removed multivt which saved some. I'm down to about 22 MB now.
Getting close, but I'd still like it to be lighter. Especially as I'm not loading an programs at boot either.
Is there anything more I can do other than start trimming the kernel?
I'm thinking that's probably next.
Copy.com offers 15 GB free cloud storage plus 5 GB extra for both of us when you use my referral link: https://copy.com?r=IlpMD4 :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11702
Re: Keep TC from loading to RAM?
« Reply #14 on: April 04, 2013, 12:36:57 PM »
Hi cortman
What is the output for:
Code: [Select]
lsmod