LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   mount Iomega external hard drive on debian squeeze, how to use mount command (http://www.linuxquestions.org/questions/linux-hardware-18/mount-iomega-external-hard-drive-on-debian-squeeze-how-to-use-mount-command-929543/)

Foxbat1155 02-15-2012 03:25 PM

mount Iomega external hard drive on debian squeeze, how to use mount command
 
Hello all.

I was about to start a thread asking how to mount and I have just been able to mount the Iomega external Hard Drive.

However I would like to ask for an explanation of the mount command just so I understand what I should do next time.

And is there a way to make this automatic?

My squeeze instalation is a fresh install and I did not choose the graphic desktop because I installed xorg and fluxbox.

Am I missing any package that would make the mounting of usb's and external hard drives more simple or automatic upon insertion?

This is the line I added to the /etc/fstab:
Code:

/dev/sdb1 /mnt/usb ntfs noauto,user,fmask=133,dmask=022 0 0
I then entered as root:

Code:

mount /mnt/usb
So if I understood I write the adress where the usb is in /dev and then the adress where I want it to be mounted on and then the filesystem and the rest I dont understand.

What can you explain to me about the rest?

Thankyou in advance =)

PenGUiN_6_1 02-15-2012 10:58 PM

Code:

sudo mount -vvvv LABEL=.chip /mnt
[sudo] password for quant:
mount: fstab path: "/etc/fstab"
mount: lock path:  "/etc/mtab~"
mount: temp path:  "/etc/mtab.lock"
mount: going to mount LABEL=.chip by LABEL
mount: spec:  "/dev/sda4"
mount: node:  "/mnt"
mount: types: "(null)"
mount: opts:  "(null)"
mount: you didn't specify a filesystem type for /dev/sda4
      I will try type vfat
mount: mount(2) syscall: source: "/dev/sda4", target: "/mnt", filesystemtype: "vfat", mountflags: -1058209792, data: (null)
/dev/sda4 on /mnt type vfat (rw)

(This is an example)
FIRST...
I had specified to mount mine (a partition, but this also works for external USB drives with file system labels) by LABEL, which means mount looks it up by label

SECOND...
Once it finds the label, it looks for other information by that label, like the node that bears the label

THIRD...
The node having been found, it finds the target which is where you want to mount it

FOURTH...
The target being called the node (yes, the device node is what you are mounting, but that is spec, which means special), it looks for the filesystem type (in this example, I did not say what type, so it tries vfat) as well as anything like 'ro' for read-only or whatever else you say

FIFTH...
That information being known, it issues the mount command

Now, if you are mounting that one all the time and do not have a label, you can try this: use the UUID. mount looks at the UUID and with your options, does all of the stuff said earlier. My system has in its fstab file some of the information like that which you have provided, only it uses UUIDs (those are things or labels that are placed on the disk at format time).

Because the first part of your fstab contains the device, if only UUID or label (specified by UUID= or LABEL=, respectively), then mount, as said above, looks up the device you want (not a bother, just a different way of looking it up). After that, in that file, it looks for where you want it, then what type it is, and any options you have
Using a UUID or label (you want this put at /mnt/usb?), you can just issue
Code:

mount /mnt/usb
because mount will see that you have typed your specific-to-that-device label in fstab, that /mnt/usb is also there, and since that is in fstab, it can just put it where you want

Device names (sda, sdb, etc...) change at times, but the labels or UUIDs I do not think change (to check you have the right info, run 'sudo vol_id /dev/sda1' and make a note of the information; if done right, it should mount with only the location you want)

I do not know if this helps (I hope it does); other than that, I am uncertain if I can help

Foxbat1155 02-16-2012 09:12 AM

=)
 
Hello, thank you for your reply, it is helpful.

I do not have installed vol_id, should I install it? Is volname the same thing?

Thanks.

PenGUiN_6_1 02-16-2012 03:46 PM

volname is not the same thing, it works for CDs or other ISO9660 type stuff (the ISO-9660 is common for things like CDs, DVDs, or CD or DVD image files of that form); udev would handle finding out what you would like. I am guessing your kernel version is at least 2.6.13 or something? You should already have that there (if not, run your system update tool; there is a very good chance you do have it on there, as I believe udev is something that runs in the background...you may not see it, but it is there); if not, use your system package manager or update tool to search for and install udev (there may be other packages required; just install them if it so mentions, and if need be, restart the system)

Foxbat1155 02-17-2012 11:26 AM

kernel version
 
This is my kernel version:

2.6.32-5-686

Foxbat1155 02-17-2012 01:16 PM

udev
 
indeed I do have udev. I do not have vol_id

PenGUiN_6_1 02-18-2012 07:57 PM

Well, I think vol_id is an available command (it should be, as I believe it comes with udev), so if you need to, use
Code:

vol_id --uuid /dev/sdb1
with the device in question that should spit your UUID out on the screen. Using
Code:

vol_id --label /dev/sdb1
should spit your label out. With that information, you go back into your fstab, and where it says /dev/sdb1(?), use
Code:

UUID=BLEEP
or
Code:

LABEL=BLEEP
to enter it (only change the /dev/sdb1 spot, nothing else; either way, the system should use it where you want it)

Foxbat1155 02-19-2012 11:56 AM

not found
 
Bash: command not found (vol_id)

And should I write the label I want where you wrote BLEEP?

Foxbat1155 02-19-2012 12:01 PM

reminder
 
I would like to remind the readers that my installation of squeeze was not the default installation with the Graphical Desktop. I unchecked this option during the installation (tasksel I think).

So perhaps this is why I do not have vol_id.

PenGUiN_6_1 02-20-2012 01:57 PM

You do not have the graphical install or whatever (that may or mat not be a reason); where BLEEP is though you should put your UUID (that is why I used the word BLEEP; it is supposed to be replaced with the thing, in this case, the UUID, you want to use). However, some commands might be on your system and you might be unaware of it. After looking on the Internet for some time, I came across something on blkid, but I was not sure if I had it on my system, so I did (locate and whereis, by the way, can be used on any command or whatever, if you think you got something on the system, but are unsure, or if you want to search):
Code:

quant@quant-laptop:~$ locate blkid
/etc/blkid.tab
/etc/blkid.tab.old
/lib/libblkid.so.1
/lib/libblkid.so.1.0
/sbin/blkid
/usr/share/doc/libblkid1
/usr/share/doc/libblkid1/changelog.Debian.gz
/usr/share/doc/libblkid1/copyright
/usr/share/man/man8/blkid.8.gz
/var/lib/dpkg/info/libblkid1.list
/var/lib/dpkg/info/libblkid1.md5sums
/var/lib/dpkg/info/libblkid1.postinst
/var/lib/dpkg/info/libblkid1.postrm
/var/lib/dpkg/info/libblkid1.shlibs
quant@quant-laptop:~$

The bold and underline indicates that this is the path you have to type if you want to use blkid; the format (as shown from my system; read the manual page for more) is:
Code:

quant@quant-laptop:~$ sudo blkid
/dev/sda1: UUID="efe0d178-50ea-4729-acd0-498c5dadaaed" TYPE="ext3"
/dev/sda2: UUID="64f0efb7-2c90-4ef8-b53d-a5928d6c8b3e" TYPE="ext3"
/dev/sda3: TYPE="swap" UUID="7a779dfd-1962-432e-a3b8-5b088d497687"
/dev/sda4: LABEL=".chip" UUID="4F38-00D9" TYPE="vfat"
quant@quant-laptop:~$

All the important stuff including Label and UUID should be there; just pick out what you need, and edit appropriately. As an extra example, here is if I were asking my computer about my sda4 (pretend it is not mounted, or that it is USB, as device names do change at times):
Code:

quant@quant-laptop:~$ sudo blkid | grep "sda4"
/dev/sda4: LABEL=".chip" UUID="4F38-00D9" TYPE="vfat"
quant@quant-laptop:~$

In this case, I see that /dev/sda4 is the device I want now, but it bears the UUID shown, and since sda4 is only used on some systems, either the Label or the UUID is better to use (you do not need to enter the quote marks when editing the /etc/fstab file, because the system does not use them there...I do not think; type man fstab and man blkid for more help)

I believe a different posting I have read somewhere said that Debian Squeeze was missing vol_id; maybe use blkid instead?

PenGUiN_6_1 02-20-2012 02:01 PM

Oh, yeah, type the precise path (that is, as shown); otherwise, the system might not recognize the command

Foxbat1155 02-21-2012 02:14 PM

Hello again, I would like to thank your answers, they are really helpfull, I found blkid and I can see the labels now, thankyou again =)

Foxbat1155 02-21-2012 02:19 PM

I don't use sudo so I just enter su - and then use blkid directly, it works.

So when I am mounting manually I can define the LABEL and UUID, if I understood correctly? Thanks.

Foxbat1155 02-21-2012 02:20 PM

nevermind.
 
Nevermind the last question.

What I mean is: when I plug in a usb or sd card and it does not automout, I can define its label first using /dev/s** ? And then mount it using the label or UUID?

PenGUiN_6_1 02-21-2012 04:53 PM

When I type
Code:

sudo blkid
, and enter my password, it shows:
Code:

/dev/sda1:...
You have seen that output. So I enter
Code:

sudo ls -al /dev/disk/by-label
or
Code:

sudo ls -al /dev/disk/by-uuid
, and for those drives that have labels, the first command shows them listed as symlinks. All that means is if /dev/disk/by-label/.chip shows up, the listing actually is
Code:

.chip -> ../../sda4
(the .. means that you go back a directory, but all you need to know is the sda4 means /dev/sda4; the same with the
Code:

/dev/disk/by-uuid...the 4F38-00D9 -> ../../sda4
means /dev/sda4). SO, basically, yes, you can find a disk by label or uuid in the /dev/disk area (either by-label or by-uuid), use that to find your device (the labels or uuids point to a specific device), and use that label or uuid to mount it, remembering, as example:
Code:

mount LABEL=.chip /mnt
or, as example:
Code:

mount UUID=4F38-00D9 /mnt


All times are GMT -5. The time now is 08:11 PM.