Tiny Core Base > Raspberry Pi

OK to pull out memory card once the system boots up?

<< < (4/7) > >>

Rich:
Hi ashfame

--- Quote from: ashfame on July 07, 2020, 01:31:55 PM --- ... Unmount all partitions and they will finish the writes to physical disk and only then return. Brilliant! So one only needs to care about all partitions being unmounted & it can be ejected. Thanks again!
--- End quote ---
I highlighted that in bold because that is only true if that filesystem is not in use. For instance, if you don't have a  copy2fs.flg  file, then
your extensions will be  loop  mounted in  /tmp/tcloop/.  That means the filesystem on  /mnt/mmcblk0p2  is in use because that's where
your  tce/optional  directory is located and the  .tcz  files are mounted in  /tmp/tcloop/. Under those circumstances the  umount
command will return right away with an error message regardless of whether any writes are pending or not.

The point I'm trying to make is be certain that the  umount  command succeeded when it returns prior to pulling the card. Commands
return a status code to indicate whether they succeed or fail. Zero indicates success.

You can test and act on the status like this:

--- Code: ---tc@E310:~$ ls abc && echo passed || echo failed
ls: cannot access 'abc': No such file or directory
failed
tc@E310:~$ ls X && echo passed || echo failed
X
passed
tc@E310:~$
--- End code ---

Replace the  ls  command with your  umount  command and replace the  echo  commands with the action you want to take for each case.

Or you can test the status separately instead of a one liner:

--- Code: ---#!/bin/sh
# Script to unmount a partition.  $1  is the partition name passed to this script.

sudo umount /mnt/$1

# The status of the most recent command is contained in  $?  which automatically gets cleared once read.
case "$?" in
0) echo "umount succeeded."
   echo "Congratulations."
   echo "$1 unmounted." ;;
*) echo "umount failed."
   echo "Better luck next time."
   echo "$1 is still mounted." ;;
--- End code ---
Just replace the echo commands with the actions you want to take. Although this script does not test if you passed it a value, it
will still indicate that  umount  failed.

ashfame:

--- Quote from: Rich on July 07, 2020, 02:34:58 PM ---Hi ashfame
I highlighted that in bold because that is only true if that filesystem is not in use. For instance, if you don't have a  copy2fs.flg  file, then
your extensions will be  loop  mounted in  /tmp/tcloop/.  That means the filesystem on  /mnt/mmcblk0p2  is in use because that's where
your  tce/optional  directory is located and the  .tcz  files are mounted in  /tmp/tcloop/. Under those circumstances the  umount
command will return right away with an error message regardless of whether any writes are pending or not.

The point I'm trying to make is be certain that the  umount  command succeeded when it returns prior to pulling the card. Commands
return a status code to indicate whether they succeed or fail. Zero indicates success.

--- End quote ---

Oh understood, rely on the exit code of the command, gotcha, Thanks again for clearing my misunderstanding! :)

ashfame:

--- Quote from: Rich on July 06, 2020, 08:50:49 PM ---Hi ashfame

--- Quote from: ashfame on July 06, 2020, 08:12:39 PM --- ... As I understand the bootable media is essentially unmounted after boot up. ...
--- End quote ---
Partition #1 which contains the boot files gets unmounted. Partition #2 contains your  tce  directory which contains your extensions. It
does not get unmounted. For that, you need to:

1. You need to have a  copy2fs.flg  file in your tce directory.
2. You need to unmount it yourself.

--- End quote ---

Hi Rich, wanted to confirm the exact location of copy2fs.flg Is it right under tce directory or tce/optional directory? And is there a way to verify the flag file is indeed forcing the copy to memory behaviour as intended?

Rich:
Hi ashfame
The  copy2fs.flg  file goes right under the  tce  directory.
I don't recall off the top of my head how to verify it. Files under  /usr  probably won't be links back to  /tmp/tcloop.

ashfame:

--- Quote from: Rich on July 08, 2020, 04:20:23 PM ---Hi ashfame
The  copy2fs.flg  file goes right under the  tce  directory.
I don't recall off the top of my head how to verify it. Files under  /usr  probably won't be links back to  /tmp/tcloop.

--- End quote ---

I tried copy2fs.flg under both directories - directly under tce and tce/optional, but in both cases, if I unmount the partition2 after booting up before trying to load Xorg by (tce-load -i Xorg), it doesn't work. So, its clearly not copying over the extensions to file system in memory.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version