Page 1 of 1
schedule usb disks check on linux boot

Posted:
Aug 15th, '12, 08:38
by msdobrescu
Hello,
The fixed disks are automatically scheduled to be checked on boot time.
Can I schedule the usb attached disks check on linux boot too?
If so, how?
Thank you.
Re: schedule usb disks check on linux boot

Posted:
Aug 15th, '12, 20:46
by doktor5000
Why do you want to do this during boot process, why not do it afterwards when the system is already usable?
Re: schedule usb disks check on linux boot

Posted:
Aug 15th, '12, 20:54
by msdobrescu
It is already scheduled by the default setup for the fixed disks.
I do not want to forget checking them, especially when I add a new disk. I have some storage attached permanently to the PC, via USB.
After some time, the new disk might fail.
In my experience, if a disk has to fail, it will do it in the first 3-6 months, then it could live for more than 5 years.
So, automatic check is useful to me.
Re: schedule usb disks check on linux boot

Posted:
Aug 15th, '12, 21:17
by doktor5000
Set up a fixed mountpoint and mount them automatically, and set it up the same way you did for your fixed disks, maybe?
I won't go on about the overall usefulness, and i already told my opinion about doing this during boot ...
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 08:02
by msdobrescu
Yeah, you basically are correct. At least, the option when to check (before or after boot) should be implemented.
Let's say you don't have a critical setup, just a home media server as I have, and your system does not depend on the integrity of other disks, except the one with the system of course. Then, the scheduled check should be done after the system boot, and mount the disk later would do no big harm...
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 19:23
by doktor5000
You could implement that yourself, mount them via a script after user logon and run an fsck on them, or whatever you want.
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 20:04
by msdobrescu
To my shame, I have no idea on which basis should I count the reboots on my system, as the bootloader does.
I could use a scheduler, of course.
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 21:28
by doktor5000
Why do you want to count them? You only wanted the disk to be checked during/after boot, so you can just drop a script into one of the autostart folders and let them mount and check the drives you want to be checked. If you really want to count the reboots, compare the output of
- Code: Select all
who -b
. If it did not change, no reboot happened.
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 21:53
by msdobrescu
Because I wouldn't check each time I reboot.
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 22:44
by doktor5000
Then just launch the script when you want to check them manually.
Basically you propose that the software should read your mind when you want to check the disks?
Re: schedule usb disks check on linux boot

Posted:
Aug 16th, '12, 23:53
by alf
doktor5000 wrote:Basically you propose that the software should read your mind when you want to check the disks?
Well, it should be possible to implement a memory in such a script.

Re: schedule usb disks check on linux boot

Posted:
Aug 17th, '12, 06:50
by msdobrescu
I mean, the boot scripts count and check every disk at the 20th reboot at least.
This is not memory reading (not mine, anyway).
It's just a way to avoid checking each time the system reboots.
Re: schedule usb disks check on linux boot

Posted:
Aug 17th, '12, 10:43
by tom_
so you need to save the number of boots done in a file,
and increment it at each boot.
When the value is 20, yuor script can do the check.
It seems simple!
which languages you know?
Re: schedule usb disks check on linux boot

Posted:
Aug 17th, '12, 10:55
by alf
tom_ wrote:so you need to save the number of boots done in a file,
and increment it at each boot.
When the value is 20, yuor script can do the check.
It seems simple!
which languages you know?
Yes, exactly what i meant. If you are familiar with bash-scripting have a look into this simple script
Re: schedule usb disks check on linux boot

Posted:
Aug 17th, '12, 11:05
by msdobrescu
Wow..
Thank you.
I don't know sh or similar.
I'm experienced with C, C++, .net, java (and most of them used on Windows...)