Tuesday, April 30, 2013

Re: [LINUX_Newbies] Mounting Memory Stick

 

On Tue, Apr 30, 2013 at 6:11 PM, Donald <tambeaud@personainternet.com> wrote:
> I am trying to install a memory stick on my raspberry pi. This memory stick was used with a Window 7 computer and it is fat formatted. I made a directory "storage" in the media directory. I did the following:
> Sudo mount /dev/sda1 /media/storage.

You assume (possibly) incorrectly. To check if it's mounted, try just
using the mount command:

$ mount

That will list all the mounted filesystems.

assuming your mount above (sudo mount /dev/sda1 /media/storage) was
successful, then yes, it is mounted and you should see it listed in
the output when you use "mount" without any options.

> This produce "ssh .odt" in the media/storage. I am assuming that the memory stick is mounted. Now I would like to know if I have to format it for Linux and how do I write to it or copy to it.

I have no idea what you mean here. "This produce "ssh .odt" in the
media/storage" makes no sense... sorry...

If you do this:

$ ls /media/storage

and see something listed, then that MAY be what's on your USB stick.
I say that because, and this is what gets REALLY confusing for
newbies, you can put files in a directory, then mount something to
that directory, and your original files may appear to have
disappeared. BUT, as soon as you unmount the device, you'll see the
old files again.

For example:

bladernr@klaatu:~$ mkdir temp-mount
bladernr@klaatu:~$ cd temp-mount
bladernr@klaatu:~/temp-mount$ touch file1 file2 file3 file4
bladernr@klaatu:~/temp-mount$ ls
file1 file2 file3 file4
bladernr@klaatu:~/temp-mount$ pwd
/home/bladernr/temp-mount

Here I've created a directory, moved into that directory, created some
sample files, and ran 'ls' to show the files. Then I ran 'pwd' to
show the present working directory just to verify where I am.

bladernr@klaatu:~/temp-mount$ cd ../
bladernr@klaatu:~$ sudo mount /dev/sdb1 temp-mount/
[sudo] password for bladernr:
bladernr@klaatu:~$ cd temp-mount/
bladernr@klaatu:~/temp-mount$ ls
boot efi md5sum.txt pool ubnfilel.txt ubuntu
cdromupgrade install menu.c32 preseed ubninit
dists isolinux opt README.diskdefines ubnkern
doc ldlinux.sys pics syslinux.cfg ubnpathl.txt
bladernr@klaatu:~/temp-mount$ pwd
/home/bladernr/temp-mount

Now I back out, mount a usb stick to that directory, move back in and
do ls again, but this time, my example files are not there, instead, I
see the contents of my usb stick.
and again, pwd to show that I'm still in that dir.

Here's an abbreviated run of 'mount' as mentioned above showing what's
currently mounted (abbreviated because I cut out a lot of unnecessary
stuff)

bladernr@klaatu:~$ mount
/dev/sda6 on / type ext4 (rw,errors=remount-ro)
<SNIP>
/dev/sda7 on /home type ext4 (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc
(rw,noexec,nosuid,nodev)
gvfsd-fuse on /run/user/bladernr/gvfs type fuse.gvfsd-fuse
(rw,nosuid,nodev,user=bladernr)
/dev/sdb1 on /media/bladernr/A7B2-9A4D type vfat
(rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
/dev/sdb1 on /home/bladernr/temp-mount type vfat (rw)

Now, finally, I'll back out, unmount the usb stick and then look in
the directory temp-mount once more:

bladernr@klaatu:~/temp-mount$ cd ../
bladernr@klaatu:~$ sudo umount temp-mount/
bladernr@klaatu:~$ ls temp-mount/
file1 file2 file3 file4

I bring this up because I found, in teaching, that people will copy
files into /media/something BEFORE there's anything actually mounted
there, then are surprised when their files are not on the usb device
(or floppy, or whatever).

To answer your remaining questions, Linux (any linux) should have
built in support or FAT16, FAT32, vFAT, and anymore, NTFS, so no, you
don't need to format anything.

Just make sure the usb device is mounted ('mount') then copy files in,
then 'umount' then move the stick to wherever you need it to go.
Also, be sure to unmount the device before you pull it from the USB
port. Don't just copy files and yank the stick. It's possible that
your files will just be cached, not actually written to the device,
and just pulling the stick will cause them to never be written.
Unmounting or ejecting the device will cause the kernel to flush any
buffers and write everything out before marking the device as
unmounted.

Cheers
Jeff

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.
MARKETPLACE


.

__,_._,___

No comments:

Post a Comment