UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor jeff.johnson
Visitor
7,212 Views
Registered: ‎08-05-2015

Is there a way to run fsck at boot time?

Jump to solution

Is there an automatic way to run fsck on the SD Card of a MicroZed at boot time?  I know can always create a script that is referenced in /etc/init.d to do it myself, but I would prefer a built-in way to do it if possible.  Some things that I've tried that don't appear to work are:

  • "touch /mnt/forcefsck" before the next reboot.
  • Put a positive value (2) for the pass number in /etc/fstab

--Jeff

 

0 Kudos
1 Solution

Accepted Solutions
Scholar rfs613
Scholar
13,867 Views
Registered: ‎05-28-2013

Re: Is there a way to run fsck at boot time?

Jump to solution
If you want boot-time only, an /etc/init.d script is certainly the simplest approach. The methods you listed are typical for desktop linux, and rely on code in the init scripts to trigger the actual fsck. On an embedded system the init is usually much simpler, these features are not there by default.

You may also want to have run-time actions whenever the SD card is inserted or removed. This can include doing fsck, and also mounting/unmounting automatically. By adding this, it also takes care of the initial boot up.

There are multiple ways to achieve these goals. On big Linux desktops this is handled through udev typically. On our smaller Zynq systems, we've had good luck with the smaller cousin "mdev" (see http://git.busybox.net/busybox/tree/docs/mdev.txt).

Both methods require your kernel to be configured for appropriate management of the /dev directory. I can provide more details if you wish.
0 Kudos
2 Replies
Scholar rfs613
Scholar
13,868 Views
Registered: ‎05-28-2013

Re: Is there a way to run fsck at boot time?

Jump to solution
If you want boot-time only, an /etc/init.d script is certainly the simplest approach. The methods you listed are typical for desktop linux, and rely on code in the init scripts to trigger the actual fsck. On an embedded system the init is usually much simpler, these features are not there by default.

You may also want to have run-time actions whenever the SD card is inserted or removed. This can include doing fsck, and also mounting/unmounting automatically. By adding this, it also takes care of the initial boot up.

There are multiple ways to achieve these goals. On big Linux desktops this is handled through udev typically. On our smaller Zynq systems, we've had good luck with the smaller cousin "mdev" (see http://git.busybox.net/busybox/tree/docs/mdev.txt).

Both methods require your kernel to be configured for appropriate management of the /dev directory. I can provide more details if you wish.
0 Kudos
Visitor jeff.johnson
Visitor
7,016 Views
Registered: ‎08-05-2015

Re: Is there a way to run fsck at boot time?

Jump to solution

Thanks for your reply.  I ended up with a /etc/init.d script to do the fsck at boot time.

 

FYI, in case anyone wants to do something similar.  I had to name the file alphabetically so it fits between mdev and mount.  In this way, it's run after the device node was made and before it's mounted.  Also, my SD Card is formatted as FAT, so I had to download the DOS FS tools source code (dosfstools-3.0.28.tar.gz), cross compile it and include the 'fsck.fat' binary in my build.

 

--Jeff

 

0 Kudos