Search This Blog

Friday, December 10, 2010

mount: Invalid Argument

This post regarding a simple problem which took almost 10 hours to realize my mistake.

I am working on PowerPC FreeBSD system where no harddisk is attached instead USB flash drive is used as storage. I needed to edit file system layout and content extensively. So I took the USB flash drive from the that machine and came back to my desk. Time 3PM.

1) Inserted into my Linux desktop and did "dmesg" - the kernel was able to detect the usb drive and print the partitions inside it. But when I tried mount it failed. After some googling I found that UFS file system can be mounted in Linux only in RO mode. So I tried mount -r but still it failed.

2) So I tried Windows next, by googling UFS driver/utility for windows. The free one I could find which has write access it ffsdrv. I avoid posting its link because it is not helpful and I wont recommend that utility to anyone. Since it has file system driver it can easily crash the windows. It showed me BSOD three times to me.

3) Then I decided to try mounting the USB on a FreeBSD machine. I couldnt find one, so I decided to use VirtualBox. Since I already had virtual box installed and FreeBSD vm in it, it was easier to "start". I started the FreeBSD vm but it couldnt detect the host USB device. So searched and found that when I installed I should have omitted the VirtualBox usb driver which is causing the issue, so downloaded the latest version of VirtualBox. After installing VirtualBox also it couldnt detect the USB drive. Few googling revealed there is a bug in VirtualBox implementation of USB EHCI controller 2, so I unselected it and VirtualBox is able to detect my drive. But when I tried to mount the drive, FreeBSD failed with "Invalid Argument".

4) At this time I lost hope with VirtualBox, so I installed Vmware and started FreeBSD on it. There were no glitches, the drive got detected immediately and FreeBSD was able to detect it too. However when it came to mount, again same problem. Ahhh

5) Ok - this is time to blame emulators - I thought both VirtualBox's and VMware's USB simulation is bad :), so I decided to try with real hardware. Since it was late around 8PM, I went to home - I booted my machine with a FreeBSD Live CD and tried to mount - same problem.

6) Now I started suspecting the drive/data. I ran fsck - it complaint it couldnt find super block and alternative super block. newfs -N said the alternative should be at 32. So I tried fsck_ffs -b 32 and no luck.

7) Time 11.xxPM, bulb:> "you are using i386(Little Endian) machine to read file system which was created by powerpc(Big Endian).


Akhil said...

>> 7. ........
how did u finally find out the big-E, little-E issue?

Unknown said...

It just struck my mind.