LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-15-2017, 11:02 AM   #16
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,132

Rep: Reputation: 815Reputation: 815Reputation: 815Reputation: 815Reputation: 815Reputation: 815Reputation: 815

If you're sticjking with the sdcard, 'noatime' would be better than 'relatime.' Atime writes every 5 seconds; relatime writes every 15 seconds; noatime is best.
 
Old 08-16-2017, 01:26 AM   #17
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 5,936

Rep: Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409Reputation: 1409
i think you should delete your custom udev rules and stick with the shell script, and the advice given in post #2.

or, you should reformulate your problem from scratch.
here's a simple rule:
you never say "it doesn't work" without providing full disclosure about commands issued, output received (errors or not), general system information etc.
 
Old Today, 03:39 AM   #18
fohnbit
LQ Newbie
 
Registered: Aug 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hello,

ok, I removed all and try this:
Code:
cat /etc/udev/rules.d/69-sdcard.rules
KERNEL=="mmcblk0", SYMLINK+="sdcard"

ACTION=="add", RUN+="/home/domo/sdcard_insertion.sh"
ACTION=="remove", RUN+="/home/domo/sdcard_removed.sh"
Code:
cat sdcard_insertion.sh
#! /bin/sh

/bin/mkdir /home/domo/sdcard_present
/bin/mount /dev/mmcblk0p1 /media/card/
Code:
cat sdcard_removed.sh
#! /bin/sh

/bin/rm -R /home/domo/sdcard_present
When I now put the sd_card in the beaglebone, the folder are created, when I remove the sdcard, it will be delete.

Now I want to mount over with the sh.script the sdcard. When I put the sdcard in the beaglebone, I get in the syslog:
Code:
Aug 20 10:35:23 foxc0a800bd kernel: [320476.390036] mmc0: host does not support reading read-only switch, assuming write-enable
Aug 20 10:35:23 c0a800bd kernel: [320476.395067] mmc0: new high speed SDHC card at address 0007
Aug 20 10:35:23 c0a800bd kernel: [320476.411492] mmcblk0: mmc0:0007 SD16G 14.4 GiB
Aug 20 10:35:23 c0a800bd kernel: [320476.419344]  mmcblk0: p1
but the folder in /media/card is empty

When I run after in den commandline:
/bin/mount /dev/mmcblk0p1 /media/card/

then it works.

But why not in the bash script?
 
Old Today, 03:58 AM   #19
fohnbit
LQ Newbie
 
Registered: Aug 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hello,

I see now in the syslog:
Aug 20 10:53:49 c0a800bd systemd-udevd[20525]: Process '/home/domo/sdcard_insertion.sh' failed with exit code 32.
Aug 20 10:53:53 c0a800bd systemd-udevd[20525]: Process '/home/domo/sdcard_insertion.sh' failed with exit code 32.
Aug 20 10:53:56 c0a800bd systemd-udevd[20525]: Process '/home/domo/sdcard_insertion.sh' failed with exit code 32.

Error 32 means:
mount failure


Same when I remove the sdcard:
Aug 20 10:56:45 c0a800bd kernel: [321758.605831] mmc0: card 0007 removed
Aug 20 10:56:45 c0a800bd kernel: [321758.716607] FAT-fs (mmcblk0p1): FAT read failed (blocknr 802)
Aug 20 10:56:45 c0a800bd kernel: [321758.730084] FAT-fs (mmcblk0p1): unable to read boot sector to mark fs as dirty
Aug 20 10:56:45 c0a800bd systemd-udevd[20666]: Process '/bin/sh /home/domo/sdcard_removed.sh' failed with exit code 32.
Aug 20 10:56:45 c0a800bd systemd-udevd[20671]: Process '/bin/sh /home/domo/sdcard_removed.sh' failed with exit code 32.
Aug 20 10:56:45 c0a800bd systemd-udevd[20666]: Process '/bin/sh /home/domo/sdcard_removed.sh' failed with exit code 32.

But why 3-times?

Here the new scripts:
cat sdcard_insertion.sh
#! /bin/sh

/bin/mkdir /home/domo/sdcard_present
sleep 3s
fsck.vfat -v -a -w /dev/mmcblk0p1
/bin/mount /dev/mmcblk0p1 /media/card/


cat sdcard_removed.sh
#! /bin/sh

/bin/rm -R /home/domo/sdcard_present
/bin/umount /media/card/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] BASH Script - What am I doing wrong in this test? - BASH Script BW-userx Programming 34 04-08-2017 01:36 PM
MLED installation script as a proof-of-concept gegechris99 Microlinux / MLED 139 01-11-2017 08:03 AM
LXer: 4 host-proof or PRISM-proof Cloud storage services LXer Syndicated Linux News 0 08-19-2013 02:30 PM
SSH connection from BASH script stops further BASH script commands tardis1 Linux - Newbie 3 12-06-2010 08:56 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 11:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration