OpenSUSE Linux Tips, tricks, how-tos, opinions, and news
My Resume - My LinkedIn ProfileM$ Jab of the Day
Evidently, M$ is laying off part of its sales force. They claim that it is “in order to be more efficient and responsive to customers.” It’s hard to be efficient and responsive to people who are running away from you at full tilt.
Interesting Tip of the Day:
For a long time, I have hated how I have to mount stuff manually in Linux. For some reason, for quite a long time, I could never quite keep track of how to get USB memory sticks mounted. The other day, I thought of something that has since worked quite well every time. I’d like to share it in hopes that it may help someone else have less of a headache when trying to remember how to mount USB drives (card readers, flash memory, usb sticks, etc.).
In your /proc directory, there is a file called partitions. To see which partitions are available to the system at any given time, you can do cat /proc/partition at a terminal. With no USB sticks plugged in, mine looks like this:
[2001][scott@desk:~]$ cat /proc/partitions major minor #blocks name 3 0 195360984 hda 3 1 40131 hda1 3 2 1959930 hda2 3 3 29302560 hda3 3 4 164055780 hda4 [2001][scott@desk:~]$
Now, when I plug in a USB stick (or card reader with a card inserted), this is what I get:
[2001][scott@desk:~]$ cat /proc/partitions major minor #blocks name 3 0 195360984 hda 3 1 40131 hda1 3 2 1959930 hda2 3 3 29302560 hda3 3 4 164055780 hda4 8 0 124048 sda 8 1 123888 sda1 [2020][scott@desk:~]$
Let’s see…. “One of these things is not like the other one…..” You can see that sda and sda1 were added. sda refers to the drive. It’s the sda1 that we care about. Just add /dev/ to the front of that to get the partition we want to mount. Our partition is /dev/sda1.
Next, we just pick a place to mount it to. As su I just create a directory called /media/usbstick or something similar. Then, you run your mount command as su with this syntax:
mount [usb stick partition] [target mount point]
If I were mounting the USB stick as /dev/sda1 onto the mount point /media/usbstick, this command would look like this:
mount /dev/sda1 /media/usbstick
The problem with doing it this exact way is that when you mount the USB stick partition as root, all of the files on the USB stick and the actual USB stick itself are owned by root, and not changeable by any other user. If you’re doing a read-only operation, it will work if you are doing it as a user other than root. However, as our mothers have properly taught us not to do things as root when not necessary, there should be a way to do fix this slight problem. There is.
As su, open your /etc/fstab file in your favorite text editor. Add a line, with this syntax:
[usb stick partition] [target mount point] auto auto,user
If using /dev/sda1 as my usb stick partition and /media/usbstick as my target mount point, I would put this into my fstab:
/dev/sda1 /media/usbstick auto auto,user
The only thing you really need to know about this is that it makes it so that regular users can mount the USB stick. Of course, the user who mounts it is considered as the owner of the partition and its files (at least in the case of the USB stick).
Save your file and exit. Then, to mount it, just run the following command (as a normal user, even):
mount /media/usbstick
You will then notice that your user has full access to the USB stick.
To Review:
Most of the time, when you plug in a USB stick or card reader (with a card in it), SUSE will just pop open a window asking you if you want to see the contents of the device. However, in cases where that does not happen, or you are using a distribution that doesn’t do that, this trick should work.
If you know of a better way to do this (better = easier or less work), please do tell.
One Other M$ Jab of the Day
Another example of a wolf in sheep’s clothing.
“Fishenden told ZDNet UK that the conference was a good opportunity to address the ‘misconception, as he put it, that Microsoft was anti-open source.”
I really like the usage of the words “as he put it” in this li’l bit. Puts it all in perspective for us.
I’m not even going to get started on this one. Someone has already put out a really nice response. I whole-heartedly agree with them. Whoever wrote that deserves a huge raise.
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
« Feb | ||||||
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
60 queries. 0.219 seconds
June 30th, 2006 at 8:05 am
There’s always automounting, and/or using udev to create a symlink based on which usb device it is (camera, pen drive, whatever) so you can have specific mountpoints in /etc/fstab.
June 30th, 2006 at 10:47 am
That must have been something I forgot on my previous list of awesome things about Ubuntu. In gnome I’ve never had to manually mount anything. USB flash drive, multiple digital cameras, etc.. plug in, auto-mounted & creates a link on the desktop. done. Actually, with the camera, it asks me if I want to import the photos as well.
I still think you should give it a try 😉
July 1st, 2006 at 8:21 am
By default, SUSE does it as well (automounting all the stuff, creating links to desktop, asking whether you want the play the audio-CD you just inserted in amarok etc.).
However, when you create an entry in /etc/fstab, e.g. for a cd-rom drive or an USB-stick, it won’t be automounted any longer. At least that’s what I observed after creating entries in /etc/fstab for my cd-rom drives to get cedega correctly working.
July 7th, 2006 at 2:39 pm
That helped a lot. I am using SUSE SLES 10 servers with just command line option on all over our servers and I was looking for a solution to mount USB drives easly.
Thank you! 🙂
###Sharing Knowledge helps humanity###
January 10th, 2007 at 9:32 am
I`ve just installed SUSE 10.0 but it does not automount and does not create link on the desktop.
January 10th, 2007 at 1:23 pm
Great advice!!!
It worked just like it should, thanks a lot man for saving me from frustration!
January 13th, 2007 at 11:05 am
[…] suse linux rants discusses suse linux, opensuse issues about linux, tips and tricks about suse and SUSE Linux Rants. Tips, tricks, how-tos, opinions, and news regarding SUSE Linux. more […]
April 3rd, 2007 at 7:13 am
I have just been experimenting with this on suse 10.1 on a laptop using a usb memory stick. Whether or not it is automounted depends on your window manager/desktop. With gnome and kde an icon appears on your desktop and a dialogue prompts what operation to do with the new device – even with no entry for it in fstab. However, this is an old laptop and I run icewm due to lack of ram and cpu. Icewm doesn’t automount and certainly has no desktop icons. In that case, I have to manually mount, which is made easier by the right fstab entry.
Gavin
May 26th, 2007 at 6:29 am
Thanks for the advice. I was baffled seeing on suse 10 sles desktop the icon for the usb stick , but not being permitted to open it or to mount it.
October 13th, 2008 at 2:45 pm
[…] to get a nice unpacker and then went on with openssh-server and openjdk-6-jre. On a USB stick I had the new and cute SpringSource dm server but didn’t know how to mount a USB stick. Google comes rescue: […]
February 24th, 2009 at 3:45 am
Thanks Scott. Very Helpful.
March 28th, 2009 at 5:19 pm
I’m still using SuSE 9.1, and I do not see anything in /proc/partitions? Just the harddrive partitions. Is 9.1 too old?