RetroBSD

2.11BSD operating system for microcontrollers
It is currently Thu Feb 20, 2020 12:15 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: cp issue
PostPosted: Thu Nov 05, 2015 11:08 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
I've tried to copy to my /u (100MB). After a while I got below messages, and /u got corrupt.
Code:
# ls
.profile    etc         lib         root        tmp
bin         games       libexec     sbin        u
dev         include     lost+found  share       var
#
# cp -r * /u

 cp: /u/dev/sd0: No space left on device
cp: dev/sd0a: Device busy
u: file system full

u: write failed, file system full
cp: /u/dev/sd0b: No space left on device
cp: dev/sd0c: Device busy
sd1: no SD/MMC card detected
cp: dev/sd1: Operation not supported by device
sd1: no SD/MMC card detected
cp: dev/sd1a: Operation not supported by device
sd1: no SD/MMC card detected
cp: dev/sd1b: Operation not supported by device
sd1: no SD/MMC card detected
cp: dev/sd1c: Operation not supported by device
sd1: no SD/MMC card detected
cp: dev/sd1d: Operation not supported by device
cp: dev/rc0: Device not configured
cp: dev/rc0a: Device not configured
cp: dev/rc0b: Device not configured
cp: dev/dr0: Device not configured
cp: dev/dr0a: Device not configured
cp: dev/dr0b: Device not configured
cp: dev/mr0: Device not configured
u: file system full

u: write failed, file system full
cp: /u/dev/swap: No space left on device
u: file system full

u: write failed, file system full
^C^C^C^C

# # df -i
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted        on
/dev/sd0a      203999    12982   191017     6%    1514   11286    11%   /
/dev/sd0c      101999   101999        0   100%     189    6211     2%   u
#

When trying to mount /u after the reboot I get
Code:
# mount /dev/sd0c u
/dev/sd0c on u: No such file or directory
#

Because of recursion it will fill the /u full probably, but why such crash?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
 Post subject: Re: cp issue
PostPosted: Thu Nov 05, 2015 11:27 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
My guess is it's beacuse you're mounting on "u" instead of "/u". By mounting on "u" you are mounting on the folder "u" in the current directory, and if you're not in the root directory at the time then "u" won't exist to mount on.

You should always provide a full path to where you want to mount on, not a relative path.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
 Post subject: Re: cp issue
PostPosted: Thu Nov 05, 2015 11:32 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
ok
Code:
2.11 BSD UNIX (pic32) (console)

login: root
Password:
Welcome to RetroBSD!
erase ^?, kill ^U, intr ^C
# ls
.profile
# mount /dev/sd0c /u
# ls
.profile
# df -i
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted on
/dev/sd0a      203999    12984   191015     6%    1514   11286    11%   /
/dev/sd0c      101999   101999        0   100%     189    6211     2%   /u
# cd /u
# ls
README.txt  bin         dev         lost+found
# cd bin
# ls
[             diff          login         rev           tr
adb           diskspeed     lol           rm            true
adc-demo      du            ls            rmail         tsort
ads           echo          mail          rmdir         tty
aout          ed            make          rtc3231rd2os  uname
apropos       egrep         man           rtc3231wr     uncompress
ar            emg           md5           rx            uniq
as            env           med           rz            uucico
awk           expr          mesg          sb            uuclean
basename      false         mkdir         scc           uucp
basic         fgrep         more          scm           uudecode
bc            file          msec          sed           uuencode
bmp           find          mv            setty         uulog
cal           fold          nice          sh            uuname
calendar      forth         nm            size          uupoll
cat           fstat         nohup         sl            uuq
cb            glcdtest      ntpdate       sleep         uusend
cc            globdump      od            smux          uusnap
chat-server   globread      pagesize      sort          uux
chflags       globwrite     passwd        split         uuxqt
chfn          grep          pdc           strip         vi
chgrp         groups        picoc         stty          vmstat
chmod         head          portio        su            w
chpass        hostid        pr            sum           wall
chsh          hostname      printenv      sx            wc
cmp           i2cscan       printf        sync          web-client
col           id            ps            sysctl        web-server
comm          iostat        pwd           sz            whatis
compress      join          pwm           tail          whereis
cp            kill          ranlib        tar           who
cpp           la            rb            tee           whoami
crontab       last          rc4           telnet        write
date          lcc           re            test          xargs
dc            lcpp          renice        time          zcat
dd            ld            renumber      tip
df            ln            retroforth    touch
# cd ..
# cd /dev
# ls
adc0     adc7     dr0b     portf    rc0b     skel3    swap1    tty5
adc1     adc8     glcd0    portg    sd0      skel4    swap2    ttyUSB0
adc10    adc9     klog     ptyp0    sd0a     skel5    temp0    ttyp0
adc11    confa    kmem     ptyp1    sd0b     spi1     temp1    ttyp1
adc12    confb    mem      ptyp2    sd0c     spi2     temp2    ttyp2
adc13    confc    mr0      ptyp3    sd0d     spi3     tft0     ttyp3
adc14    confd    null     pwm1     sd1      spi4     tftin0   zero
adc15    confe    picga0   pwm2     sd1a     sr0      tty
adc2     conff    porta    pwm3     sd1b     stderr   tty0
adc3     confg    portb    pwm4     sd1c     stdin    tty1
adc4     console  portc    pwm5     sd1d     stdout   tty2
adc5     dr0      portd    rc0      skel1    swap     tty3
adc6     dr0a     porte    rc0a     skel2    swap0    tty4
#

But I still do not see 100MB of data :)
Code:
# pwd
/u
# rm *
rm: bin directory
rm: dev directory
rm: lost+found directory
# rm -r *
# ls -l
total 0
# df -i
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted on
/dev/sd0a      203999    12984   191015     6%    1514   11286    11%   /
/dev/sd0c      101999        1   101998     0%       2    6398     0%   /u
#

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
 Post subject: Re: cp issue
PostPosted: Thu Nov 05, 2015 12:01 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
I did with script:

Code:
# emg testcp

cp -r /etc /u
cp -r /bin /u
cp -r /share /u
cp -r /var /u
cp -r /sbin /u
cp -r /lib /u
cp -r /var /u
cp -r /games /u
cp -r /include /u
cp -r /libexec /u
cp -r /dev /u

and after a while (few minutes) (sdcard @16MHz):
Code:
# ls
.profile    etc         lib         root        testcp      var
bin         games       libexec     sbin        tmp
dev         include     lost+found  share       u
# ./testcp
  cp: /dev/sd0a: Device busy
/u: file system full

/u: write failed, file system full
cp: /u/dev/sd0b: No space left on device
cp: /dev/sd0c: Device busy
sd1: no SD/MMC card detected
cp: /dev/sd1: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1a: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1b: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1c: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1d: Operation not supported by device
cp: /dev/rc0: Device not configured
cp: /dev/rc0a: Device not configured
cp: /dev/rc0b: Device not configured
cp: /dev/dr0: Device not configured
cp: /dev/dr0a: Device not configured
cp: /dev/dr0b: Device not configured
cp: /dev/mr0: Device not configured
/u: file system full

/u: write failed, file system full
panic: hard err: swap
syncing disks... 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 done
halted

Code:
login: root
Password:
Welcome to RetroBSD!
erase ^?, kill ^U, intr ^C
# ls
.profile
# mount /dev/sd0c /u
# cd /u
# ls
bin      etc      include  libexec  share
dev      games    lib      sbin     var
# ls -l
total 12
drwxrwxr-x  2 root         3072 Nov  5 12:50 bin
drwxr-x--x  2 root         1024 Nov  5 12:57 dev
drwxrwxr-x  2 root         1024 Nov  5 12:49 etc
drwxrwxr-x  3 root         1024 Nov  5 12:51 games
drwxrwxr-x  7 root         1024 Nov  5 12:51 include
drwxrwxr-x  2 root         1024 Nov  5 12:51 lib
drwxrwxr-x  2 root         1024 Nov  5 12:51 libexec
drwxrwxr-x  2 root         1024 Nov  5 12:51 sbin
drwxrwxr-x  9 root         1024 Nov  5 12:51 share
drwxrwxr-x  6 root         1024 Nov  5 12:51 var
# df -i
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted on
/dev/sd0a      203999    12985   191014     6%    1515   11285    11%   /
/dev/sd0c      101999   101999        0   100%    1762    4638    27%   /u
#

So there must be a bug somewhere..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
 Post subject: Re: cp issue
PostPosted: Thu Nov 05, 2015 12:13 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
I removed cp /dev from the script and it works now:
Code:
# ls
.profile    etc         lib         root        testcp      var
bin         games       libexec     sbin        tmp
dev         include     lost+found  share       u
# ./testcp

# cd /u
# ls
bin      games    lib      sbin     var
etc      include  libexec  share
# ls -l
total 11
drwxrwxr-x  2 root         3072 Nov  5 13:09 bin
drwxrwxr-x  2 root         1024 Nov  5 13:09 etc
drwxrwxr-x  3 root         1024 Nov  5 13:10 games
drwxrwxr-x  7 root         1024 Nov  5 13:11 include
drwxrwxr-x  2 root         1024 Nov  5 13:10 lib
drwxrwxr-x  2 root         1024 Nov  5 13:11 libexec
drwxrwxr-x  2 root         1024 Nov  5 13:10 sbin
drwxrwxr-x  9 root         1024 Nov  5 13:10 share
drwxrwxr-x  6 root         1024 Nov  5 13:10 var
# df -i
Filesystem  1K-blocks     Used    Avail Capacity iused   ifree  %iused  Mounted on
/dev/sd0a      203999    12985   191014     6%    1515   11285    11%   /
/dev/sd0c      101999    14972    87027    14%    1757    4643    27%   /u
#

But still, it should have stopped gracefully when the /u is full..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
 Post subject: Re: cp issue
PostPosted: Thu Nov 05, 2015 1:52 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
The cp commands will have stopped gracefully, but there is nothing in your script to see if cp failed and exit if it did - so when one cp fails it just goes on to the next and runs that.

Code:
cp -r /foo /u || exit 10
... etc ...


Or to make it catch non-zero return values and exit automatically:
Code:
set -e

at the top of your script.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
 Post subject: Re: cp issue
PostPosted: Fri Nov 06, 2015 11:19 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Both above hints end with (while copy /dev )
Code:
    cp: /u/dev/sd0: No space left on device
cp: /dev/sd0a: Device busy
/u: file system full

/u: write failed, file system full
cp: /u/dev/sd0b: No space left on device
cp: /dev/sd0c: Device busy
sd1: no SD/MMC card detected
cp: /dev/sd1: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1a: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1b: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1c: Operation not supported by device
sd1: no SD/MMC card detected
cp: /dev/sd1d: Operation not supported by device
cp: /dev/rc0: Device not configured
cp: /dev/rc0a: Device not configured
cp: /dev/rc0b: Device not configured
cp: /dev/dr0: Device not configured
cp: /dev/dr0a: Device not configured
cp: /dev/dr0b: Device not configured
cp: /dev/mr0: Device not configured
/u: file system full

/u: write failed, file system full
cp: /u/dev/swap: No space left on device
/u: file system full

/u: write failed, file system full
cp: /u/dev/swap0: No space left on device
swap1: attempt to access unallocated device
^C

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission