WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] Mouting Flash Drive Before OnBoot Extensions are Loaded  (Read 2341 times)

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Hi all,

I am trying to move my "optional" directory to a flash drive by using a symlink.

I have currently done the following:
- set the flash drive to mount in bootsync.sh
- move optional to the flash drive and create a symlink to it

This works fine when the system is booted. Extensions can be loaded with tce-load and the ondemand function.

However, when booting all onboot extensions fail to load. From the book I can see the problem, page 89 shows the order of operations and bootsync.sh is run after the loading on onboot extensions.

Is there any way that I can mount the flash drive earlier in the boot process, so that the extension loading code can access it's contents?

Thanks
« Last Edit: May 09, 2020, 11:56:53 AM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #1 on: May 08, 2020, 11:20:33 AM »
Hi jshorthouse
Welcome to the forum.
... I am trying to move my "optional" directory to a flash drive by using a symlink. ...
Find the  UUID  of your flash drive and use the  tce=UUID  boot code. The FAQ has more info:
http://tinycorelinux.net/faq.html#pendrives

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #2 on: May 08, 2020, 11:33:34 AM »
I came across that option when searching, but doesn't the tce directory also contain the files for the kernel and base system?

I would like to have a clean separation if possible, where the flash drive only contains extensions. That way the core system can be loaded from the faster internal disk, and also if the flash drive is removed the system will still be bootable.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #3 on: May 08, 2020, 01:21:04 PM »
Hi jshorthouse
I came across that option when searching, but doesn't the tce directory also contain the files for the kernel and base system? ...
Not necessarily. Here is the layout on one of my machines:

Root directory of the boot drive:
Code: [Select]
tc@E310:~/info$ ls -l /mnt/sda1/
total 44
drwxr-xr-x 3 tc   staff  4096 Jan 31 13:42 boot/
drwxrwxr-x 3 root staff  4096 Apr 22 08:19 home/
drwx------ 2 tc   staff 16384 Jul 12  2019 lost+found/
drwxrwsr-x 3 root staff  4096 Apr  2 22:06 opt/
drwxrwxr-x 5 tc   staff  4096 May  3 20:55 tce/
drwxrwxr-x 4 tc   staff  4096 Mar 31 15:57 tce64/
drwxrwxr-x 4 tc   staff  4096 Mar 21 00:57 tce64TC11b1/
drwxrwxr-x 4 tc   staff  4096 Feb 20 14:28 tce64TC11b1.bak/
tc@E310:~/info$
As you can see, it has multiple TCE directories, both 32 and 64 bit.

boot sub-directory of the boot drive:
Code: [Select]
tc@E310:~/info$ ls -l /mnt/sda1/boot/
total 65980
-rw-r--r-- 1 tc staff  9131528 Jul 12  2019 core.gz
-rw-r--r-- 1 tc staff  9627207 Oct 16  2019 core64.gz
-rw-r--r-- 1 tc staff 10407852 Nov 28 20:01 corepure64.gz
-rw-r--r-- 1 tc staff 11059939 Jan 14 12:05 corepure64TC11beta1.gz
drwxr-xr-x 2 tc staff     4096 Jul 18  2019 grub/
-rw-r--r-- 1 tc staff  6826959 Oct 16  2019 modules64.gz
-rw-r--r-- 1 tc staff  2800248 Oct 16  2019 rootfs.gz
-rw------- 1 tc staff  3587966 Jun 11  2019 rootfs64.gz
-rw-r--r-- 1 tc staff  4295328 Jul 12  2019 vmlinuz
-rw-r--r-- 1 tc staff  4721024 Oct 16  2019 vmlinuz64
-rw-r--r-- 1 tc staff  5084544 Dec 17 19:06 vmlinuz64TC11beta1
tc@E310:~/info$
Here you find multiple kernel (vmlinuz) and initrd (corexxx) files.

Here is the config file for  grub-0.97-splash:
Code: [Select]
tc@E310:~/info$ cat /mnt/sda1/boot/grub/menu.lst
default 0
timeout 10

title TC10.1_32bit
root (hd0,0)
kernel /boot/vmlinuz quiet tce=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" home=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" opt=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" printk.time=1 syslog nodhcp vmalloc=256MB noisapnp nozswap
initrd /boot/core.gz

title TC10.1_32bit_backup
root (hd0,0)
kernel /boot/vmlinuz quiet  tce=UUID="22559ae7-7e12-4a3b-9efa-6f8c8a9a8a6a" home=UUID="22559ae7-7e12-4a3b-9efa-6f8c8a9a8a6a" opt=UUID="22559ae7-7e12-4a3b-9efa-6f8c8a9a8a6a" printk.time=1 syslog nodhcp nozswap vmalloc=256MB noisapnp
initrd /boot/core.gz

title TC10.1_Core64
root (hd0,0)
kernel /boot/vmlinuz64 quiet  tce=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" home=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" opt=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" printk.time=1 syslog nodhcp noisapnp
initrd /boot/core64.gz

title TC10.1_CorePure64
root (hd0,0)
kernel /boot/vmlinuz64 quiet  tce=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8"/tce64 home=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" opt=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" printk.time=1 syslog nodhcp noisapnp norestore
initrd /boot/corepure64.gz

title TC11.0beta1_CorePure64
root (hd0,0)
kernel /boot/vmlinuz64TC11beta1 quiet  tce=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8"/tce64TC11b1 home=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" opt=UUID="543cac60-3224-4cab-b1d5-008407dd9ce8" printk.time=1 syslog nodhcp noisapnp norestore
initrd /boot/corepure64TC11beta1.gz

title TC9_Core64
root (hd0,0)
kernel /tce/boot/vmlinuz64 quiet  waitusb=5:UUID="1ad696eb-3913-4434-bb9e-25dd4b980c09" tce=UUID="1ad696eb-3913-4434-bb9e-25dd4b980c09" home=UUID="1ad696eb-3913-4434-bb9e-25dd4b980c09" opt=UUID="1ad696eb-3913-4434-bb9e-25dd4b980c09" printk.time=1 syslog enable_mtrr_cleanup
initrd /tce/boot/core64.gz
tc@E310:~/info$
If you look at  title TC10.1_32bit_backup  you'll see its  TCE  directory is on a different partition (different UUID) from the other entries.
If you look at  title TC10.1_CorePure64  you can see the  TCE  directory is listed by  UUID/path  because those extensions are 64 bit.

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #4 on: May 08, 2020, 04:06:08 PM »
Hi Rich, thanks for the example, your setup looks good so I will try to do something similar.

I see one problem though, which is that my extlinux directory is inside my tce directory.

Code: [Select]
tc@box:/mnt/sda1/tce/boot$ ls
core.gz   extlinux/ vmlinuz

How can I move this out of the tce directory and put it in a different directory as you have done with your grub config?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #5 on: May 08, 2020, 05:19:40 PM »
Hi jshorthouse
... I see one problem though, which is that my extlinux directory is inside my tce directory. ...
If I understand you correctly, you are referring to the internal drive here. Since the boot loader is installed here, this is where it
will look for the config file.

Unless told otherwise, Tinycore looks for a  tce  directory and uses the first one it finds.

Assuming your internal drive is mounted as  /mnt/sda1  and your flash drive is  /mnt/sdb1:
Code: [Select]
sudo cp -a /mnt/sda1/tce /mnt/sdb1/mytce
sudo rm -rf /mnt/sdb1/mytce/boot

In the config file on your internal drive add:
Code: [Select]
waitusb=5:UUID="FlashPartitionUUID" tce=UUID="FlashPartitionUUID"
You might want to consider adding a menu entry that allows you to select the local tce directory in a pinch.

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #6 on: May 08, 2020, 05:38:43 PM »
Hi Rich

Yes, I am referring to the internal drive.

From what you are saying I believe that is what should be done, is this correct?
- Keep a "dummy" tce directory on the internal drive that just contains the boot directory
- Tiny core will find this directory and read the boot config
- The config will then tell it to use the "real" tce directory on the flash drive

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #7 on: May 08, 2020, 05:50:47 PM »
Hi jshorthouse
... From what you are saying I believe that is what should be done, is this correct? ...
Yes.

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #8 on: May 08, 2020, 05:52:20 PM »
Alright, thanks very much for you help, I will give this a try tomorrow

Offline jshorthouse

  • Newbie
  • *
  • Posts: 13
Re: Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #9 on: May 09, 2020, 11:06:22 AM »
Just had a change to try this out and it works great, you can mark this issue as solved :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: [Solved] Mouting Flash Drive Before OnBoot Extensions are Loaded
« Reply #10 on: May 09, 2020, 11:57:32 AM »
Hi jshorthouse
Done. :)