LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-25-2016, 04:50 AM   #1
iFunction
Member
 
Registered: Nov 2015
Posts: 224

Rep: Reputation: Disabled
Mount drive


Hi there,

I've been struggling with this now for months, but I can't seem to mount a drive successfully unless it is removed and then re inserted again, doing:
Code:
sudo mount /dev/sda /media/pi/
appears to mount the drive, yet running:
Code:
ls /media/pi/
returns nothing.

I've also tried:
Code:
sudo mount /dev/sda1 /media/pi/
returns
Code:
mount: special device /dev/sda1 does not exist
What's going on, how can I mount this from the command line the same way it is mounted if it is removed and re inserted.

Kind regards
iFunc
 
Old 02-25-2016, 05:38 AM   #2
TxLonghorn
Member
 
Registered: Feb 2004
Location: Austin Texas
Distribution: Mandrake 9.2
Posts: 671

Rep: Reputation: 224Reputation: 224Reputation: 224
You are mounting filesystems (partitions) like "/dev/sda1"
So "mount /dev/sda" is wrong
Next, in order to use your command "sudo mount /dev/sda1 /mount/point" you need an existing mount point.
/ is not an existing mount point. So "sudo mount /devsda1 /media/pi/" is wrong.
If you want to mount sda1, and do not want to create a mount point first, use the command "udisks --mount /dev/sda1"
(Or you can use an existing directory as a mount point - but you will not have any access to any files already in that directory until you unmount - in other words, it is best to use a directory that contains no files - like /mnt or /var/tmp.)
If you want to use the "mount" command, create a mount point like "/media/pi/BackupDrive". Then mount on that mount point > sudo mount /dev/sda1 /media/pi/BackupDrive"

Now, for "mounting the same way it is mounted if it is removed and re inserted." you might share where it is mounted under those circumstances...

I might add that it is unusual to see a USB drive listed as /dev/sda - usually you would expect /dev/sdb or /dev/sdc


Generally, if I remember correctly, you can edit /etc/fstab and enter a line mounting that USB drive. First create a mount point - mine is /media/sdc8gig
My line in fstab:
UUID=e78ef581-0e84-407c-8072-62def0239268 /media/sdc8gig ext3 rw,nosuid,noauto,nodev,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered 0 2

noauto = prevents the partition from being mounted when your system boots (if the USB is not connected). If it's applied to an external usb partition it will automatically mount it's partition when the device is inserted. If you unmount it, and want to mount it again without removing it, (or if it is not a removable drive) use the command "sudo mount -a"
I am not sure that "noauto" or "nofail" work on distros which use systemd - have to verify that...
But then, you didn't mention which distro you are using. ???

Last edited by TxLonghorn; 02-25-2016 at 06:34 AM.
 
Old 02-25-2016, 05:50 AM   #3
iFunction
Member
 
Registered: Nov 2015
Posts: 224

Original Poster
Rep: Reputation: Disabled
On the Raspberry pi, if you insert a usb stick, it automatically comes up in /media/pi/ and it can be unmounted from there fine. What I want to do now is remount it to exactly the same place without having to physically remove the drive and put it back in. It doesn't seem to me too much to ask, but 3 months down the road and I still can't mount it on that point. If I start mounting it elsewhere, that is going to cause massive complications, as the people using this are in no way interested in Linux, command line, computer science whatsoever, so getting them to create a mountpoint etc is just not going to happen.

Logically if a drive is mounted at a certain place, to unmount it and then remount it in the same place should be a possibility. Is this not possible then?
 
Old 02-25-2016, 06:02 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,706

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
Only if YOU are the one mounting it, and not using the udev rules to mount it...

The problem is that the udev rules include removing the mount point when it is unmounted/ejected. The rules don't get invoked UNLESS a controller event occurs - and that controller event only happens when it gets plugged in.

If you want to MANUALLY mount things, then disable the udev rule that mounts and dismounts. Don't remove the rule that creates the device though.

Of course, if you disable the mount part of the udev rule, no OTHER devices will be mounted either.
 
1 members found this post helpful.
Old 02-25-2016, 06:21 AM   #5
iFunction
Member
 
Registered: Nov 2015
Posts: 224

Original Poster
Rep: Reputation: Disabled
Ok, thank you, that's very clear now, I can come up with another option.
 
Old 02-25-2016, 06:52 AM   #6
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,690

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
personally I'd take @TxLonghorn advice in post #2 or a variation thereof to gain FULL control over the situation at hand.

That way you are now in charge of the entire situation. Being so. You can then deal with it how ever you want to.

Now, if that was done, it too, aids you in honing your programming skills starting you down the road to becoming a knowledgeable BASH Scrpit Programmer. With advanced skills that can be carried into another field of Linux Programming.

When using the proper experimental tools (a usb stick that it does not matter if it gets screwed up) show no fear.

Last edited by BW-userx; 02-25-2016 at 07:06 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] mount Iomega external hard drive on debian squeeze, how to use mount command Foxbat1155 Linux - Hardware 15 02-21-2012 04:55 PM
Mount usb drive, umount and mount another drive arubin Linux - Hardware 9 01-17-2007 03:46 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 07:16 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 1 12-24-2005 04:25 AM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 02:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration