LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] HOWTO recover a borked 3ware RAID-1 array (long)

[ILUG] HOWTO recover a borked 3ware RAID-1 array (long)

Ronan Cunniffe ronan at iaa.es
Thu Nov 2 18:14:55 GMT 2006


Pádraig Brady wrote:
> minor optimisation to not have temp files and break out early:
>
> for i in `seq 0 2048`; do
>     sudo dd if=/dev/sda bs=512 skip=$i count=1 2>/dev/null |
>     file - |
>     grep -q boot &&
>     echo sector $i &&
>     break
> done
>   
Yep, better.  Of course the 2048 was just me throwing a big net -  it 
happened to be big enough.
> Would my lomount.sh script help?
> http://www.pixelbeat.org/scripts/lomount.sh
>
> ./lomount.sh /dev/loop0 2 /mnt/data
>   
Yes it would.  A lot.  Now, why isn't this in my distribution?

I split the losetup and mount because it's 'losetup -o <offset>', and I 
was thinking ''mount -o o <offset>'?  naaaah...'

(For those who didn't read Pádraig's script, you can use 'mount -o 
offset=<offset>'.  Now go and read Pádraig's script.)

Anyway, on the subject of loopback, and seeing as it's still near enough 
Halloween, how about the following little code snippet:

    #define SIZE(a) (sizeof(a)/sizeof(a[0]))

    char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" };

    for (j = 0; j < SIZE(loop_formats); j++) {

    }

What kind of nutter..... ?  Yes! Yes! We Must Compute Everything At 
Compile Time! No! *Before* Compile Time!

For anybody who wants a real fright, download the util-linux source, and 
have a look at mount/lomount.c (from which the above comes).  The 64bit 
vs 32bit goodness.  The gotos.  The stupefying option handling that 
provably shouldn't even compile.  The #ifdefs depending on why you're in 
the file.  This crap is in your /bin/mount, people....

Actually, if you want real horror, have a look at one of the old 2.11 
versions.

:-)

Ronan



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell