WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to change extensions to "copy2fs" via CLI?  (Read 7679 times)

Offline drtebi

  • Newbie
  • *
  • Posts: 16
How to change extensions to "copy2fs" via CLI?
« on: November 10, 2018, 12:46:15 AM »
Hello,

I have successfully built a raspberry pi based audio streamer with piCore, using cifs (to mount my network share with its music), mpd, alsa, and busybox-httpd (to serve album images).

Everything is working just perfectly, but I realized now that all my extensions are mounted from /mnt/mmcblk0p2/. As far as I understand, this is not good if I now want to do a "hard" shutdown. My device is configured with only a power knob, which turns on and off the power supply inside the case... this was intentional, since the case mimics a vintage Sony line, so a soft-shutdown is no option.

So my question now is, how do I change all the extensions to be loaded into RAM, so that I don't have to worry when doing a hard shutdown?

I read about copy2fs, but all documentation I can find about it relates to the graphical installer. I don't have the GUI installed, and don't really want to, either.

I see there is a bunch of tce-* scripts, but I am a bit lost as to which one to use in order to do what I want...


Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: How to change extensions to "copy2fs" via CLI?
« Reply #1 on: November 10, 2018, 01:02:56 AM »
Code: [Select]
$ touch /mnt/mmcblk0p2/tce/copy2fs.flg

Offline drtebi

  • Newbie
  • *
  • Posts: 16
Re: How to change extensions to "copy2fs" via CLI?
« Reply #2 on: November 10, 2018, 02:10:24 AM »
Thank you!

Damn, it's that simple? To be honest, I was surprised how simple setting up piCore was in general... I waited too long to do this.

One more question: In order to compile mpd, I had to install a few things like gcc etc. I won't need these anymore, so it would be best if I could not have these extensions loaded. How do I get rid of them via CLI? Is there an overview somewhere for all the tce-* commands? That would really help...

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: How to change extensions to "copy2fs" via CLI?
« Reply #3 on: November 10, 2018, 02:30:24 AM »
The cli tool you need is tce-audit - builddb and then delete

Somebody started to explain the tce-* commands in the wiki, but it looks to be a wip.

You could take a look at the book:

http://tinycorelinux.net/book.html

Offline drtebi

  • Newbie
  • *
  • Posts: 16
Re: How to change extensions to "copy2fs" via CLI?
« Reply #4 on: November 10, 2018, 03:00:37 AM »
OK, I will try that.

I looked through the book already, I have only found a chapter on tce-load, everything else seems to refer to the graphical app interface.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: How to change extensions to "copy2fs" via CLI?
« Reply #5 on: November 10, 2018, 04:36:38 AM »
Take a look at
/etc/sysconfig/tcedir/onboot.lst
and remove extensions you think are not needed.

Installing extensions via  tce-load -wi ... automatically creates entries in that file for those extensions to loaded on boot.
Download a copy and keep it handy: Core book ;)

Offline drtebi

  • Newbie
  • *
  • Posts: 16
Re: How to change extensions to "copy2fs" via CLI?
« Reply #6 on: November 10, 2018, 05:00:59 AM »
Take a look at
/etc/sysconfig/tcedir/onboot.lst
and remove extensions you think are not needed.

Installing extensions via  tce-load -wi ... automatically creates entries in that file for those extensions to loaded on boot.
OK, I will check that out, although I think I like using tce-audit for this better... it could be considered a CLI front-end for extensions I suppose.

I can for example use tce-audit notrequired to list extensions that are not strictly required, then pick the ones I think I don't need for my setup and verify this with e.g. tce-audit requiredby boost... and then use tce-audit delete boost for example.

One question I still have is, should the second partition (/dev/mmcblk0p2) be unmounted when using the copy2fs flag? In the book there is an example for a "Web Kiosk", where they mention the copy2fs flag, and then further suggest that one adds something like
Code: [Select]
umount /dev/mmcblk0p2
to /opt/bootlocal.sh

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: How to change extensions to "copy2fs" via CLI?
« Reply #7 on: November 10, 2018, 05:41:49 AM »
Yes, if you've used the copy2fs.flg you can unmount the partition.

Offline drtebi

  • Newbie
  • *
  • Posts: 16
Re: How to change extensions to "copy2fs" via CLI?
« Reply #8 on: November 10, 2018, 06:45:46 AM »
Perfect!

Thanks for all the quick responses.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 402
Re: How to change extensions to "copy2fs" via CLI?
« Reply #9 on: November 10, 2018, 10:47:36 PM »
hi drtebi,

piCorePlayer is a music client for the LMS/Squeezebox environment based on piCore. In the 4 or 5 years of existence, we have hundreds, maybe thousands of pCP's installations and we haven't seen the corruption issue you are trying to avoid. Lots of users just pull the plug.

We implemented a copy2fs option years ago and it never when from "development" to "production" because the need never surfaced.

regards
Greg

Offline drtebi

  • Newbie
  • *
  • Posts: 16
Re: How to change extensions to "copy2fs" via CLI?
« Reply #10 on: November 11, 2018, 04:01:31 AM »
hi drtebi,

piCorePlayer is a music client for the LMS/Squeezebox environment based on piCore. In the 4 or 5 years of existence, we have hundreds, maybe thousands of pCP's installations and we haven't seen the corruption issue you are trying to avoid. Lots of users just pull the plug.

We implemented a copy2fs option years ago and it never when from "development" to "production" because the need never surfaced.

regards
Greg
Hi,

yes I know about piCorePlayer. I was tempted to use it, but I prefer MPD, which I have already installed on a few other computers. I liked the challenge to start from scratch with piCore... it was surprisingly easy, following mostly a great tutorial by a French guy.

It's interesting to hear that piCorePlayer does not use copy2fs. I feel safer using it... although I have noticed quite a longer boot time now (which makes sense... since a bunch of stuff is copied into RAM at boot time now).

Anyway, I am quite happy with the outcome, only my second project where I solder electronics together (linear power supply etc), my first experience milling aluminum, etching etc!  :D

Here a picture, where it is sitting underneath the vintage Sonys, almost done with the case:

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: How to change extensions to "copy2fs" via CLI?
« Reply #11 on: November 11, 2018, 06:13:53 AM »
When data is written there is usually cache involved. In case of power interruption this data might not be completely written, i.e. still in the cache and therefore lost. If the system just reads I can imagine this might be negligible. I wouldn't do this with other OSes where I don't know whats running in the background.
Download a copy and keep it handy: Core book ;)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: How to change extensions to "copy2fs" via CLI?
« Reply #12 on: November 11, 2018, 07:38:34 AM »
Hi drtebi
That's one fine looking enclosure you built. Counter-boring the mounting hole for the power switch was a nice touch. What did
use to relieve the ears for rack mount, a fly cutter with a profiled bit? Did you make the slots by drilling first and then cutting
the slots, or is that just an artifact of the picture? I am also curious about what technique you used to apply the markings and
whether it was done before or after applying the brushed finish. At any rate, it looks very clean and professional.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 402
Re: How to change extensions to "copy2fs" via CLI?
« Reply #13 on: November 11, 2018, 12:22:04 PM »
Good job drtebi,

It's interesting to hear that piCorePlayer does not use copy2fs. I feel safer using it... although I have noticed quite a longer boot time now (which makes sense... since a bunch of stuff is copied into RAM at boot time now).

Personally, I really like the idea of using copy2fs and do from time to time. But working with a team means you have a decision process to follow. We haven't had many people complaining about SD card corruptions but do get a lot of "How do I make pCP boot faster?".

regards
Greg




Offline drtebi

  • Newbie
  • *
  • Posts: 16
Re: How to change extensions to "copy2fs" via CLI?
« Reply #14 on: November 11, 2018, 02:21:15 PM »
Hi drtebi
That's one fine looking enclosure you built. Counter-boring the mounting hole for the power switch was a nice touch. What did
use to relieve the ears for rack mount, a fly cutter with a profiled bit? Did you make the slots by drilling first and then cutting
the slots, or is that just an artifact of the picture? I am also curious about what technique you used to apply the markings and
whether it was done before or after applying the brushed finish. At any rate, it looks very clean and professional.
Thanks  ;)

You pretty much nailed it... however, the big challenge was, that I don't have a mill! I used my old Atlas drill press (50s or so) to mill the "ears", first with an end mill, then with a router bit that had more or less the right profile to create the edge that leads back to the flat plane.

The slots were made just as you said, drilling a hole first, then sawing and filing.

The markings ("Ternowski...") were done with electro etching. It took a few practice pieces to figure out how long to etch, which solution to use etc.. The metal (aluminum in this case) must be very clean for this, so it was sanded and cleaned thoroughly before etching.

The counter-bored hole for the power knob was a challenge. Since I have a woodworking shop, not a machinist shop, I ended up doing it with a router and a small circle jig that I build. It worked so well, if I had to do it all over again, I would use a router to make the "ears" as well.

I will post a couple of pictures later to give you some visuals...