Is there a way RECOVERY nand could auto fix usb drive?
June 16, 2011 09:47AM
In my area , power goes out 3 or 4 times a month for a few seconds and my usb hard drive get's corrupted.

I was interested in just a recovery nand that auto fixes usb drive and auto starts back into usb hard drive. If no usb hard drive is on dockstar than recovery nand starts as normal.

Most of us have power failures from time to time and this auto fix and auto restart could make the dockstar a stable platform for me.



Edited 1 time(s). Last edit at 06/16/2011 09:48AM by rgtaa.
Re: Is there a way RECOVERY nand could auto fix usb drive?
June 16, 2011 10:16AM
Just make the rootfs partition to ext3. I have frequent power cuts as well and my dockstar boots perfectly after a power failure. I haven't done a manual fsck for months.
Re: Is there a way RECOVERY nand could auto fix usb drive?
June 16, 2011 11:58AM
You could always create a small script which you'd place inside the recovery partition and run it automatically by calling it through rc.local. Theoretically (I don't know the details on the recovery system, as I don't use it) this should work.

The script should check for your usb drive first (maybe by uuid if possible, otherwise just look for /dev/sdxx). If the drive was present, it would run a fsck -f /dev/sdxx.
After fsck ran without errors it would issue a reboot. That's an important detail, because otherwise you wouldn't be able to use your rescue system anymore, because it would always automatically reboot. Unplug the drive and you can use the rescue system as always.
Re: Is there a way RECOVERY nand could auto fix usb drive?
June 16, 2011 12:23PM
Good suggestions.

I was ext2 on my boot drive and just updated to ext3.

As to recovery script , could anyone post a script that would work and maybe instructions on how or where to place it on recovery nand. linux is not my first language ( more ms guy) so I would need copy and paste , so I don't screw it up. :)

Thanks



Edited 1 time(s). Last edit at 06/16/2011 12:24PM by rgtaa.
Re: Is there a way RECOVERY nand could auto fix usb drive?
June 16, 2011 06:28PM
I don't think you can use it like that because the rescue system maybe uses another shell or something, but you should get the idea. Assumption is that you know your drive's uuid and that the script only runs at a point where the very drive is not mounted:

#!/bin/bash

#get the line containing the uuid and device name
dev_name_line=`blkid |grep "your_drives_uuid_without_the_quotation_marks"`

#if grep found the uuid
if [ $? == 0 ]
then
	#get the device name
	dev_name=${dev_name_line:0:9} 
else
	echo "UUID not found!"
	exit 1;
fi

#force check the drive
fsck -f $dev_name
reboot;
exit 0;

Have fun. Remember, that this is just a quick and dirty approach that I hastely tested on my normal desktop. You will certainly have to do some adjusting before being able to use it on the rescue system.



Edited 2 time(s). Last edit at 06/16/2011 06:32PM by ingmar_k.
Re: Is there a way RECOVERY nand could auto fix usb drive?
June 28, 2011 04:36AM
Just out of curiosity:

Any progress on the matter?
Re: Is there a way RECOVERY nand could auto fix usb drive?
July 04, 2011 06:09PM
I;m curious about the conversion from ext2 to ext3 of the root file system as I've been considering this...

Was it as simple as running "tune2fs -j /dev/sda1" and updating /etc/fstab ? Or were some other steps ? (Other than remounting the filesystem read-only before creating the journal.)

Some old instructions found online about converting the root file system included a step to re-running mkinitrd, but I would expect that the existing initrd image would be able to handle mounting an ext3 file system already.
Re: Is there a way RECOVERY nand could auto fix usb drive?
July 05, 2011 12:42AM
^ Yes, first run the tune2fs command, then edit the fstab and also change the usb_rootfstype uBoot parameter to ext3.
Re: Is there a way RECOVERY nand could auto fix usb drive?
July 05, 2011 08:54PM
Thanks! I made the change this evening. I definitely would've forgotten to change the usb_rootfstype parameter in uboot. It would've driven me crazy trying to find out why it was still mounting as ext2.

Question... What happens now when the startup check determines there's a problem with the filesystem, or it hits the 180 day forced check, and something is wrong? I suspect I won't be able to ssh in, nor will I see anything on a netconsole, but fsck may be waiting for input to fix any issues.
Re: Is there a way RECOVERY nand could auto fix usb drive?
July 03, 2012 11:38AM
I just tried doing this to change my HD on a GoFlex home to ext3, but mount is still reporting this as ext2.

fstab:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/root      /               ext3    noatime,errors=remount-ro 0 1
/dev/sda2      none            swap    sw                0       0
/dev/sda3      /home           ext3    defaults          1       2
tmpfs          /tmp            tmpfs   defaults          0       0

results of mount:
root@Goflex-80G:~# mount
rootfs on / type rootfs (rw)
none on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
none on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /dev type devtmpfs (rw,relatime,size=59032k,nr_inodes=14758,mode=755)
none on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/sda1 on / type ext2 (rw,noatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,relatime,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
/dev/sda3 on /home type ext3 (rw,relatime,errors=continue,barrier=1,data=ordered)
tmpfs on /tmp type tmpfs (rw,relatime)


I have changed my sata_rootfstype to ext3 in the environment. Any idea why this did not work? Also, should I remove the "errors=remount-ro" from fstab?
Re: Is there a way RECOVERY nand could auto fix usb drive?
July 03, 2012 01:13PM
Never Mind. I had typed the environment variable in wrong. It is now mounting as ext3.

Stiil wondering if I should remove the 'errors=remount-ro" setting though.



Edited 1 time(s). Last edit at 07/03/2012 03:02PM by optim.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: