PDA

View Full Version : Newb getting REALLY confused about getting a usb stick on



iam
05-23-2006, 11:20 AM
My friend has a knackered up laptop and i want to use knoppix as a recovery tool to get data off the hard drive.

Knoppix loads up perfectly on it and runs as smooth as anything (v 4.0.2).

I've managed to mount the drive. Don't ask how, i've just been typing random commands in from this:
# modprobe usb-storage

# less /proc/modules

#mkdir /mnt/sda1
#mount -t vfat /dev/sda1 /mnt/sda1
#mount -o uid=knoppix -t vfat /dev/sda1 /mnt/sda1
#ls /mnt/sda1

Now apparantly i'm supposed to have some command in the fstab file, but i can't add to that file.

So now i can actually mount the USB stick, i can see whats in it, but i cannot write to it as it says i do not have permission. I have gone into the properties of the device and changed the permissions to 777 but still i cannot write to it.

Please help, as i am completely stumped as to where to go and what to do from here.

Thank you.

Matt

malaire
05-23-2006, 11:34 AM
Try first if you are able to write with sudo:


sudo touch /mnt/sda1/test


If that creates a file "test", then you can try this: Create a directory and set knoppix as it's owner. Then you can write to that directory normally:


sudo mkdir /mnt/sda1/data
sudo chown knoppix:knoppix /mnt/sda1/data


After that you should be able to write to /mnt/sda1/data normally.
ps. I don't know how to make it so that whole /mnt/sda1 can be written by a normal user, so this is what I normally use.

iam
05-23-2006, 11:41 AM
Thank you for the extremely quick response.

The Knoppix file seems to be working great.

I've put the USB stick back in after getting some files off, and i've got the original problem where

mount: can't find /mnt/sda1 in .etc/fstab or /etc/mtab

Just wish i knew how i did it in the first place to be able to get around this.

EDIT:

Used same commands as i did before, but i'm getting a cannot mount device as already mounted or busy.

Tried un mounting and mounting again, but to no avail.

malaire
05-23-2006, 11:48 AM
mount: can't find /mnt/sda1 in .etc/fstab or /etc/mtab
You can get that if you only give /dev/sda1 OR /mnt/sda1. If you use both, you shouldn't get that error:


sudo mount -t vfat /dev/sda1 /mnt/sda1

iam
05-23-2006, 11:59 AM
Used the command without the 'sudo' as i'm already in root. (i'm presuming thats what sudo means)

Still getting the 'already mounted or busy' error when i try and open the usb drive from the desktop though.

Any ideas?

Thank you again.

Matt

malaire
05-23-2006, 12:13 PM
Used the command without the 'sudo' as i'm already in root. (i'm presuming thats what sudo means)
Yes, I don't usually work as root, so I prefix all commands with "sudo"


Still getting the 'already mounted or busy' error when i try and open the usb drive from the desktop though.
Any ideas?


You should allways unmount it before removing the USB-stick. If you didn't unmount, you might have some problems.
If you are running Knoppix as LiveCD, easiest way might be to just reboot as then configurations will be reset.

You could also try to start Konqueror and go to /mnt/hda1, or where the USB-stick is mounted instead of using the desktop-icon.

iam
05-23-2006, 12:24 PM
Ok, i've nearly got this working :)

Just having a problem with permissions now. Managed to mount the drive and open it, but can't drag and drop files because it says i don't have permission to do so, even though i have gone in and changed all the permissions.

I'm gonna reboot, have another fiddle and see if i've just done it in the wrong order or something.

Thanks for you help, made me understand whats going on a bit better.

EDIT

Lol, nope still can't get it to give me permission.

Gone into properties and given it all read write and execute, and deselected the read only box.

Didn't do any more the first time i got it working, so god only knows what i've done.

malaire
05-23-2006, 12:29 PM
Ok, i've nearly got this working :)

Just having a problem with permissions now. Managed to mount the drive and open it, but can't drag and drop files because it says i don't have permission to do so, even though i have gone in and changed all the permissions.

Did you try my earlier suggestion (use this after you have mounted it at /mnt/sda1)


sudo mkdir /mnt/sda1/data
sudo chown knoppix:knoppix /mnt/sda1/data

And then try to drag and drop to that "data" directory.

iam
05-23-2006, 12:44 PM
No i didn't. Worked great again.

One question though, why are there so many posts of this sequence:
# modprobe usb-storage
#mkdir /mnt/sda1
#mount -t vfat /dev/sda1 /mnt/sda1
#mount -o uid=knoppix -t vfat /dev/sda1 /mnt/sda1

The second mount command doesn't work because it says it's already mounted. So why do you need to do it after the first mount command?

Thank you so much for all your help Malaire. Saved the day.

malaire
05-23-2006, 01:13 PM
No i didn't. Worked great again.

One question though, why are there so many posts of this sequence:
#modprobe usb-storage
#mkdir /mnt/sda1
#mount -t vfat /dev/sda1 /mnt/sda1
#mount -o uid=knoppix -t vfat /dev/sda1 /mnt/sda1

The second mount command doesn't work because it says it's already mounted. So why do you need to do it after the first mount command?


You should only use one of the mount-commands not both. If someone says to use both, that's clearly an error as you can only use one of those.
So if you want to use "uid=knoppix" with mount, only use that mount command, not the first one.

iam
05-23-2006, 01:26 PM
What difference does the -o uip=knoppix make though?

malaire
05-23-2006, 02:09 PM
What difference does the -o uip=knoppix make though?
From mount-manpage:

uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the current process.)

FAT-filesystem don't save owner of each file, so "-o uid=knoppix" can be used to tell who should be shown as the owner of each file.
So it seems that if you use that option, each file would be owned by "knoppix", and maybe you could then use all files normally without permission-problems.
I'm not sure as I havn't used FAT-partitions for a while.

Now that I think of it, my earlier suggestion of

sudo mkdir /mnt/sda1/data
sudo chown knoppix:knoppix /mnt/sda1/data
might not work on FAT-partitions. I didn't remember that FAT-partitions don't save the owner of each file.

iam
05-23-2006, 02:32 PM
Thanks for the explanation. The -o command works straight away. No need to make extra folder.

I can't thank you enough for getting me through that. Much appreciated.

I'm very impressed with linux as well. Was only going to use it for data recovery, but i think i might delve into it a little bit more.