<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Have you actually tried copying files in use by the system?  I’ve never had trouble copying FROM an in-use file, and the only time I’ve had problems copying TO an in-use file (that I remember right now, but something in the back of my head is bothering me </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>) – anyway, the thing I remember about copying to an in-use file is that, if the new data is different than the data already in the file, and the file is an executable or a library which is in use,  you will usually core dump the executable(s) which is (are) running using that file.  However, as you can see below, ‘newer’ Linuxes apparently keep you from writing to a file which has a running program associated with it.  IIRC that is ‘new’ since 0.94 ;-)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Now you’ve said it so many times, I had to go test it myself, because I was certain that, in the normal case, you can copy an in-use file somewhere else:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ emacs sleeper.c<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ ./sleeper &<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>[1] 25182<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ ps  # see that sleeper is running<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>  PID TTY          TIME CMD<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25049 pts/20   00:00:00 bash<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25182 pts/20   00:00:00 sleeper<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25183 pts/20   00:00:00 ps<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ cp -p sleeper sleeper2   # copy executable from running sleeper to new sleeper2<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ ./sleeper2  # run it.  Oops, forgot the ampersand<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>^Z<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>[2]+  Stopped                 ./sleeper2<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ bg  # back ground it so we can see the ps list<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>[2]+ ./sleeper2 &<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ ps   # yep, now we’ve got 2 of them running<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>  PID TTY          TIME CMD<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25049 pts/20   00:00:00 bash<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25182 pts/20   00:00:00 sleeper<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25193 pts/20   00:00:00 sleeper2<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>25194 pts/20   00:00:00 ps<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ cp sleeper2 sleeper   # ok, lets try copying sleeper2 on top of sleeper.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>cp: cannot create regular file `sleeper': Text file busy<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>rusty@rc-test1 ~ $ <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So, you can copy the file TO a new place, but not overwrite.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So, I’m still lost as to why it won’t work to copy ‘all of’ /bin to a new directory, say ‘/bin.new’.  That process should happen with no issue (ignoring possible space issues, which could make life a bit harder, but not impossible).  So, now you have a new /bin.new.  ‘mv’ is in /bin, so in order to do the next step, you need to use the full path to mv: mv bin bin.old && /bin.old/mv /bin.new /bin  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>And then your bin is new, as it were </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>.  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>At this point, any programs which are running from /bin are using the /bin.old image.  You COULD actually delete bin.old, and the OS would keep the space for the in-use files as unavailable for use until you restart the program (which would then make it run from the new /bin copy).  Once all references to the file are gone, the space it occupied on disk would then be freed.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Wish I had time to set up a scrap system to try that on…  Which, by the way, is probably a good idea – set up a test system that is as close to your final system as possible (which might simply be ‘runs Linux’, don’t know) and try the various things to see how well they work and if they have any issues.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>(should you have to copy a subset, then softlinks may be the easier way to go.  I’ll have to think about that a bit if your space is that limited.)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>And for different reasons DD is probably not the right choice, unless it works to ‘dd /dev/foo /dev/foo’, which scares me a bit </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> (but actually might work.  Hmm…)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>On the other hand, it sounds like this is not a normal filesystem, so ymmv!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:navy'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> plug-discuss-bounces@lists.phxlinux.org [mailto:plug-discuss-bounces@lists.phxlinux.org] <b>On Behalf Of </b>Mike Bushroe<br><b>Sent:</b> Tuesday, May 13, 2014 11:57 PM<br><b>To:</b> plug-discuss@lists.phxlinux.org<br><b>Subject:</b> <o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><p class=MsoNormal><br clear=all><b><span style='color:#1F497D'>…</span></b>. And some of the files in /bin and /sbin might be open and in use while trying to do the update, which is what has me going around the long way around.<o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'>I would be afraid of using dd because of the bad blocks. Although yaffs puts all the directory and file data for each page in the out of band bytes for each page, so that you could copy each page somewhere else and it would still work, that still seems a bit risky. If we use the file functions through yaffs, it will not only work around any bad blocks, but also increment the 2 bit page counter so that it can tell which page is current if power drops suddenly while the old and new versions are both still resident. And it will also mark the old pages as deleted and erase blocks where it can, so that should cover more ground than using dd directly. However, I have used dd to read the binary image of the flash, including the OOBs. But I have not yet decoded them enough to write a script to duplicate the processes in yaffs.<o:p></o:p></p></div><p class=MsoNormal>Mike<o:p></o:p></p><div><div><div><p class=MsoNormal>-- <o:p></o:p></p><div><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Arial","sans-serif"'>"Creativity is intelligence having fun." — Albert Einstein</span><o:p></o:p></p></div></div></div></div></div></div></body></html>