Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Insert your USB pen drive. Let it get detected and mounted. Open Terminal. Type The Following commands
1. dmesg |tail –> here the ‘|’ key is the pipe, ie, the key before the backspace key(the upper one, so press shift)
You’ll get something like
bripal@puredyne:~$ dmesg |tail
[ 9921.681164] sda: Write Protect is off
[ 9921.681174] sda: Mode Sense: 23 00 00 00
[ 9921.681178] sda: assuming drive cache: write through
[ 9921.709138] SCSI device sda: 4030464 512-byte hdwr sectors (2064 MB)
[ 9921.720951] sda: Write Protect is off
[ 9921.720963] sda: Mode Sense: 23 00 00 00
[ 9921.720967] sda: assuming drive cache: write through
[ 9921.721225] sda:
[ 9921.727896] sd 0:0:0:0: Attached scsi removable disk sda
[ 9921.744187] sd 0:0:0:0: Attached scsi generic sg0 type 0
Note the terms in bold. In your system it will be different, maybe sdb or something. Whatever it may be, make sure to substitute it in the commands below, else your hard disk may get formatted.
2. Unmount your pen drive by using
sudo umount /dev/sda (In your case, please substitute sda with the appropriate device, listed above.
3. use the mkfs.vfat command to format to FAT32 filesystem, or mkfs.ext3 to format to ext3 filesystem
sudo mkfs.vfat -n ‘Label’ -I /dev/sda Replace Label with the name you want the pen drive to have.
4. That’s it! When done formatting, you’ll be returned to the prompt bripal@puredyne:~$ mkfs.vfat -n ‘bripal’ -I /dev/sda
mkfs.vfat 2.11 (12 Mar 2005) bripal@puredyne:~$
Remove and insert the pen drive to have mounted again!
Since you're being coached to use a shell commandline, and since
Quote:
mounting of local partitions is automatic and the standard place for it is in the /media directory
try first:
Code:
ls -las /media
If your files are there, you should be able to see them. Why they don't show up in your desktop tool is a mystery. Are they in the root of the flash drive, or in subdirectories?
Also note that there is a fair chance that your main hard disk is /dev/sda. PROCEED WITH CAUTION! On second thought, /dev/sda is a block device, not a partition, so you probably can't make a filesystem on it. Just make sure you don't format and existing hard disk partition.
Insert your USB pen drive. Let it get detected and mounted. Open Terminal. Type The Following commands
1. dmesg |tail –> here the ‘|’ key is the pipe, ie, the key before the backspace key(the upper one, so press shift)
You’ll get something like
bripal@puredyne:~$ dmesg |tail
Note the terms in bold. In your system it will be different, maybe sdb or something. Whatever it may be, make sure to substitute it in the commands below, else your hard disk may get formatted.
Please read and understand the OP's question before answering. They already said they don't want to lose the data. And that command won't work, since it'll only give you the last few lines of the dmesg file. If the device was present at boot time, it may be far up in the file, and not visible in the last few lines. To see anything it's doing when you introduce a new device, it's easier to clear it with "dmesg -c", then insert the device, and run "dmesg" again. That gives you EVERYTHING related to just that device, and how the system sees it.
Quote:
2. Unmount your pen drive by using
sudo umount /dev/sda (In your case, please substitute sda with the appropriate device, listed above.
The OP isn't using a pen drive, but a memory stick, and they already said they don't know about Linux or how to determine what that device is mounted as.
Quote:
3. use the mkfs.vfat command to format to FAT32 filesystem, or mkfs.ext3 to format to ext3 filesystem
sudo mkfs.vfat -n ‘Label’ -I /dev/sda Replace Label with the name you want the pen drive to have.
..which will probably fail, since going by these instructions, the OP won't have created a partition to format, and will be trying to format a DEVICE, not a filesystem. The correct command would be "mkfs -t <filesystem type> /dev/sdxx".
Quote:
4. That’s it! When done formatting, you’ll be returned to the prompt bripal@puredyne:~$ mkfs.vfat -n ‘bripal’ -I /dev/sda
mkfs.vfat 2.11 (12 Mar 2005) bripal@puredyne:~$
Remove and insert the pen drive to have mounted again!
...only if the OP has automount enabled on that device.
OP if you get an icon somewhere when you plug that device in, the best thing I could suggest is just to copy all the files off, to make sure you've got them saved. Doing so from another computer would be prudent as well, perhaps one you know better. At times, Linux can be daunting when you're getting started, but the important thing is to make sure your data is saved.
Another thing to try would be to put the card into an external card reader, which you could attach to a USB port on any computer. Any 'gotchas' with a memory card slot would be taken out of the picture, and you'd just see it as another USB storage device.
The OP isn't using a pen drive, but a memory stick
Okay, so I must have been living under a rock. What is the difference? I guess the OP could be talking about something like a SD flash card, which I've never heard called a memory 'stick', but even so, it behaves pretty much the same, especially if you read it with an external USB card reader. In any case, the result of the command 'lsusb' might be instructive.
Okay, so I must have been living under a rock. What is the difference? I guess the OP could be talking about something like a SD flash card, which I've never heard called a memory 'stick', but even so, it behaves pretty much the same, especially if you read it with an external USB card reader. In any case, the result of the command 'lsusb' might be instructive.
--- rod.
LarryWebb got it. Sony does make an item called a MemoryStick, which is essentially an SD card in a different wrapper, with 'protection' on it. I've got slots in my laptop which are designed for both. Dmesg output for putting a card in the slot is different than using an external reader. Since the OP didn't mention a card reader, I'm assuming they mean a card slot, until the OP posts differently.
Also, the card in the slot gives me a device of /dev/mmcblk, with filesystems of /dev/mmcblk01, etc. In a card reader, it shows up as /dev/sdb1.
Yes, I'm sure. There is memory used up on the stick, and that only happened when I transferred pictures over to the stick. I can try to put some more on, just to see what happens. I didn't have a problem transferring pics onto the stick through Linux before...it was just this time, for some reason.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.