PDA

View Full Version : Mass storage mounting scripts


thoughtfix
2006-01-12, 08:06
I bricked my tablet!
Then I fixed it and wrote this post on how to easily mount and unmount mass storage devices. It's not a howto - more of a "how I did it."

http://thoughtfix.blogspot.com/2006/01/automatic-mass-storage-mounting.html

Hey gnuite - Want to round out those last steps?

Simon
2006-01-12, 08:50
Why do you do that stuff in the sudoers file? Is that so you don't need to be root to use them each time? I currently do everything in Xterminal as root (I use the sudo gainroot which I modded with the help of a Linux geek friend). I know it's not good to be root all the time and need to get out of that habit.

thoughtfix
2006-01-12, 09:17
Why do you do that stuff in the sudoers file? Is that so you don't need to be root to use them each time?

The goal is to make icons that run the scripts. I failed in that for now... but only for now!

Wooky
2006-01-12, 10:55
I left some comments in your blog. good work with the usb-powering hack (though I couldn't figure exactly how tou routed the + and - wires from the battery pack into the usb plugs).

I have a question concerning the automount: can you
#cat /etc/fstab
(as root I guess) and post the output here? perhaps that will give us some insight as to how to automount mass-storage devices. A nano running Linux and a N770 make a wonderful pair.

putkowski
2006-01-12, 17:11
I bricked my tablet!
Then I fixed it and wrote this post on how to easily mount and unmount mass storage devices. It's not a howto - more of a "how I did it."

http://thoughtfix.blogspot.com/2006/01/automatic-mass-storage-mounting.html

Hey gnuite - Want to round out those last steps?

thoughfix,

in the blog, your references to the mount point should be

/home/user/MyDocs/nano

not

/home/usr/MyDocs/nano

Great help... thanks.

P

thoughtfix
2006-01-12, 18:05
thoughfix,
/home/user/MyDocs/nano


Thanks putkowski - It was correct in all but two references.

Damn my UNIX fingers for wanting to type /usr/

putkowski
2006-01-12, 19:26
Thanks putkowski - It was correct in all but two references.

Damn my UNIX fingers for wanting to type /usr/

I hate to say it, but I used-to-have the opposite problem. Now my brain seems to check to see if I'm typing in a white box...

Now we need to mount a swap to a wifi mounted linux box (in case you get bored..)

You're the top page at Planet Maemo..

P

While it seems odd to mount a music player to listen to music, my son's first impression (b4 the 770 was available) was that it would be an excellent "carputer." DC power a 160Gig USB drive and you could wifi your stuff to the driveway... then use the 770 to "tramp" around the internet once you get there...

Chainsaw76
2006-01-12, 19:46
...was that it would be an excellent "carputer." DC power a 160Gig USB drive and you could wifi your stuff to the driveway... then use the 770 to "tramp" around the internet once you get there...

Or... A front end to a carputer. Have a MP3 capable computer in the car, wi-fi.. Either no display, or rear LCD for movies. Then use the 770 as the controler to choose songs, etc. I haven't quite figured out how I'm going to do NAV.. But hopefully my Bluetooth GPS will be here soon.

The the Carcomputer can Wifi it's own updates, and shut down.

-Jason

meshsmooth
2006-01-13, 01:53
i edited my sudoers file difrently
user ALL = NOPASSWD: /bin/mount /dev/sda1 /home/user/MyDocs/mnt/a
user ALL = NOPASSWD: /bin/umount /dev/sda1
but if i run the comand
/bin/mount /dev/sda1 /home/user/MyDocs/mnt/a as user
i get
mount: permission denied. (are you root?)
i am at a loss

thoughtfix
2006-01-13, 02:19
The full command is:
sudo /bin/mount /dev/sda1 /home/user/MyDocs/mnt/a

sudo has to grant root privs to the command first :D

Wooky
2006-01-13, 10:34
hey thoughtfix, what about the contents of /etc/fstab ?

I have another question... did you plugged a usb-hub into your usb-injector in order to mount the nano and use the keyboard at the same time? was the battery-pack supplying enough power to both of them at the same time? that looks good...

thoughtfix
2006-01-13, 21:36
/etc/fstab is pretty boring - just a single rootfs and then a memory card which is mounted noexec nosuid. Other than that - I hadn't tested power draw on that device. I'm going to make a new one this weekend out of a 9V battery and see if that works better. It'd certainly be more compact.

Wooky
2006-01-13, 22:55
yep, but is the mmc mounted with an "auto" option? You might test mounting the nano similarly, but as I said in your blog (posted as anonymous) it might be dangerous.

Lui-G
2006-03-03, 09:05
Hi,
I've been watching thoughtfix's blog for a while, and I've ventured deep into the 770.
A couple of months ago I became root, and managed to get the swap file going.

Then I bought a usb adapter that came with a Y cable, which I used to connect my iPod to the 770 with power coming from a gear4 pocket power device.

In the terminal, [sudo gainroot], I switched USB host mode ON with:
echo host > /sys/devices/platform/tahvo-usb/otg_mode
The iPod responded correctly by switching into "do not disconnect" mode.
I then did a 'ls' in the /dev/ directory and found the new 'sda' which wasn't there before.

I created a directory as suggested by thoughtfix:
mkdir /home/user/MyDocs/iPod

Finally, I tried to mount the iPod, after two weeks of research and preparation, with the following command:
mount /dev/sda /home/user/MyDocs/iPod
The reply I get is:
mount: Mounting /dev/sda on /home/user/MyDocs/iPod failed: Invalid Argument

Please Help!?
Many thanks in advance.

Luis.

JMills
2006-03-03, 09:35
Finally, I tried to mount the iPod, after two weeks of research and preparation, with the following command:
mount /dev/sda /home/user/MyDocs/iPod
The reply I get is:
mount: Mounting /dev/sda on /home/user/MyDocs/iPod failed: Invalid Argument

Please Help!?
Many thanks in advance.

Luis.

Does the iPod use the raw device (/dev/sda) or partition 1 on the device (/dev/sda1)? I don't personally recall, and my Shuffle is busy pretending to be a brick at the moment (long story).

The contents of /proc/partitions on the N770 side should tell you whether there is a partition table on the device (iPod connected as a USB Mass-Storage peripheral), or if it's being used raw.

Lui-G
2006-03-03, 14:53
Hi JMills,

cat /proc/partitions shows the following:

major minor #blocks name
31 0 128 mtdblock0
31 1 384 mtdblock1
31 2 2048 mtdblock2
31 3 2048 mtdblock3
31 4 126464 mtdblock4
254 0 1003264 mmcblk0
254 1 1002928 mmcblk0pl
8 0 58605119 sda

Does this mean it's being used raw - and if so, what does this mean, and what can I do to get this to work?

Again, many thanks in advance for any further insight.

Update - I tried this with a 1GB USB key and it worked (it was using sda1). - so my problem looks like it's down to the iPod, and the issue of partitions, which I'm not sure how to resolve.

Luis.

Wooky
2006-03-03, 17:05
Try and mount the iPod using the normal mode (i.e., enabling USB-Host mode using the flasher. Then both type
#mount
and also see the contents of /etc/mtab. Then you will possibly gather info about how the iPod is mounted. I will try this myself, once I build my "5V injector". The eletronic stuff is ready, I just need a suitable case and am I also looking for a 4xAAA holder.

Is it a nano? AFAIK, the music partition is sdx2. There is more info at the ipodlinux site.

thoughtfix
2006-03-03, 17:20
The iPod is partitioned. I got it to mount with sda3 if memory serves correctly.

Also if it's a Mac iPod it probably won't be supported.

Lui-G
2006-03-03, 18:42
Hi,
it's an iPod Photo, 60GB, but Mac formatted...
I have a mac & pc. I believe there is a way to format it for use on a PC. I would then be able to test it. But in the long run, if the Mac format is not supported, it will be a shame, as all my music is managed on my Mac, and I'll have to keep the iPod formated as such...

It would be nice if the iPod used one standard format between the platforms...

Unless there's a way to mount the Mac volume, since Mac OS X is built on Linux and that's what's running on the 770... ...anyone?

Luis.

thoughtfix
2006-03-03, 22:20
I don't think the Nokia 770 has the right filesystem in the kernel for the Mac formatted iPod. The problem I had when I had my music collection on my Mac and wanted to use the iPod with the PC was that I had to wipe and reinstall my iPod every time I did a firmware upgrade.

My suggestion: Use the PC to manage your library ;)

JMills
2006-03-03, 23:05
I don't think the Nokia 770 has the right filesystem in the kernel for the Mac formatted iPod. The problem I had when I had my music collection on my Mac and wanted to use the iPod with the PC was that I had to wipe and reinstall my iPod every time I did a firmware upgrade.

My suggestion: Use the PC to manage your library ;)


Correct, there is no HFS or HFS+ support in the N770's Linux kernel, and it'll have a different partition table type, so the kernel won't recognize it beyond the raw device.

Optimal iPod device formatting would be FAT32, since then you can use it with most recent operating systems. I'm pretty sure that the Mac OS version of iTunes, and the current era (10.x) Mac OS core has FAT32 support... since 4.4BSD already did.

-JMills, ex-Apple DTS from long ago.

Lui-G
2006-03-07, 10:49
Hi,
I plugged my iPod into my PC and got it to be reformatted (FAT32) using the iPod updating software (this was after a few attempts, as the PC updater failed 3 times and forced me to reset the iPod on the Mac. Once it worked, the iPod was FAT32, and as JMills predicted, the Mac as well as iTunes recognized it, and it's working fine on there.

I can now mount the iPod on the 770 and browse its contents.

Thank you all for your help/guidance.
Luis.

Lord Bodak
2006-04-12, 13:32
Since the iPod Shuffle is a powered device, would it work as a flash drive without a 5v injector?

aflegg
2006-04-12, 13:35
No. (Isn't this an FAQ? It should be)

The power is required for two things:


to power the device itself - a self-powered device like an iPod doesn't need it for this.
to power the USB circuitry in the 770, and possibly the device.


To use *any* device in USB host mode with the 770 requires the 770 to be supplied with +5v up its USB socket.

HTH,

Andrew

Lord Bodak
2006-04-12, 14:40
to power the USB circuitry in the 770, and possibly the device.

Different question then. Is it possible to make a connector that lets the shuffle pass power to the 770 instead of the other way around (since the shuffle normally charges while plugged in, but obviously can't without the 770 passing it power), rather than building a gadget with a separate battery?

aflegg
2006-04-12, 16:32
It'd depend on the device; I'd be very surprised to find a USB device which output 5V on its USB plug.