LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-21-2008, 03:12 AM   #1
Honeysuckle
Member
 
Registered: Dec 2007
Location: Australia
Distribution: Puppy, debian
Posts: 118

Rep: Reputation: 15
Mounting/unmounting in Debian


All of my data are on a separate partition. I have Debian "Etch" installed and have added the data partition to fstab so that it is accessible. I'd prefer to have it like Knoppix does - so that it is unmounted, but able to be mounted by clicking an icon. Can somebody point me in the right direction to find out how to do this? Thanks.
 
Old 06-21-2008, 05:14 AM   #2
jamwaffles
Member
 
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131

Rep: Reputation: 19
i dont really know, but i would say nautilus would detect the disk without an entry in fstab (?????). anyone correct me if im wrong.


james waples, 14
 
Old 06-21-2008, 05:31 AM   #3
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
There are probably complete solutions for this but just make a small script. $DEV is the partition you want to mount such as /dev/sda3, $MNT is the mount point such as /mnt/misc. replace them in this script.
Code:
#!/bin/bash
#
# This small script mounts and unmounts my partition
#

if [ "$(mount | grep -c $DEV)" -eq "0" ];then
        mount $DEV $MNT
else
        umount $MNT
fi
Then make the script executable and put it in a launcher or on desktop and set a nice icon for it. At least that's how I usually do these kinds of things.

Last edited by kummiliim; 06-21-2008 at 05:32 AM.
 
Old 06-21-2008, 05:40 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Put the entry in /etc/fstab, but put in the option "noauto". That means the partition won't be automatically mounted. As for the desktop icon--this depends on what desktop environment you use. Assuming you use the default GNOME interface, then you'll want to put the mountpoint in either /mnt/ or /media/ (I'm not sure which one), and GNOME will automatically put it on the desktop.
 
Old 06-21-2008, 09:52 AM   #5
Honeysuckle
Member
 
Registered: Dec 2007
Location: Australia
Distribution: Puppy, debian
Posts: 118

Original Poster
Rep: Reputation: 15
Thanks for the replies.

Changing the etc/fstab entry to "noauto" stops it automounting.

I've been trying to get the script to work. It will work if I log on as root, but not as user... I changed the ownership of the script file to my user and I've got "user" in the fstab entry. I think it needs to be "told" to make me root so it will "do" the mounting, but I don't know what is required??

I'm using KDE, by the way.
 
Old 06-21-2008, 11:53 AM   #6
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
Quote:
Originally Posted by Honeysuckle View Post
I've been trying to get the script to work. It will work if I log on as root, but not as user... I changed the ownership of the script file to my user and I've got "user" in the fstab entry. I think it needs to be "told" to make me root so it will "do" the mounting, but I don't know what is required??
Sorry, forgot about only root being able to mount new stuff. Use 'mount $MNT' instead of 'mount $DEV $MNT' and it should work. If you have declared the device-mountpoint pair in fstab at least.
 
Old 06-21-2008, 11:56 AM   #7
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
In KDE, right click on the desktop. You want to create a new link to device. I don't remember the exact details of how to make it work, but the "user" option in fstab certainly can't hurt.
 
Old 06-21-2008, 01:19 PM   #8
Honeysuckle
Member
 
Registered: Dec 2007
Location: Australia
Distribution: Puppy, debian
Posts: 118

Original Poster
Rep: Reputation: 15
Thumbs up

Quote:
Originally Posted by IsaacKuo View Post
In KDE, right click on the desktop. You want to create a new link to device. I don't remember the exact details of how to make it work, but the "user" option in fstab certainly can't hurt.
Yay, success! Thanks.

Right click on desktop, select create new -> Link to device -> Hard Disc Device, select the "device" tab and choose a device from the drop-down menu in the "device" box, click ok. It mounts by clicking on the icon, unmounts by choosing from the menu that comes up when you right-click on the icon. (I'm not sure whether the "user" option in fstab is significant in this happening without complaint or whether I gave myself ownership of it before when I was trying to get it to mount using the script.)

Quote:
Use 'mount $MNT' instead of 'mount $DEV $MNT' and it should work. If you have declared the device-mountpoint pair in fstab at least.
I gave that a whirl to see what would happen, but it still didn't work. Thanks for the suggestion, but I don't have to persevere with that avenue now that the other one works.

Thanks again.
 
Old 06-22-2008, 02:35 PM   #9
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
Quote:
Originally Posted by Honeysuckle View Post
I gave that a whirl to see what would happen, but it still didn't work. Thanks for the suggestion, but I don't have to persevere with that avenue now that the other one works.

Thanks again.
Glad that you got it working. It still bugged me a bit why the script didn't work so I tried it all out myself. In my example I try to mount /dev/sda7 to /mnt/misc. If this partition isn't in the fstab then:
Code:
sander@blunt:~$ cat /etc/fstab | grep sda7
sander@blunt:~$ mount /dev/sda7 /mnt/misc/
mount: only root can do that
sander@blunt:~$ mount /mnt/misc/
mount: can't find /mnt/misc/ in /etc/fstab or /etc/mtab
sander@blunt:~$
If I add it in the fstab with default settings:
Code:
sander@blunt:~$ cat /etc/fstab | grep sda7
/dev/sda7       /mnt/misc       ext2    defaults        0       0
sander@blunt:~$ mount /dev/sda7 /mnt/misc/
mount: only root can do that
sander@blunt:~$ mount /mnt/misc/
mount: only root can mount /dev/sda7 on /mnt/misc
sander@blunt:~$
And when I add the 'user' (and your 'noauto') option:
Code:
sander@blunt:~$ cat /etc/fstab | grep sda7
/dev/sda7       /mnt/misc       ext2    noauto,user     0       0
sander@blunt:~$ mount /dev/sda7 /mnt/misc/
mount: only root can do that
sander@blunt:~$ mount /mnt/misc/
sander@blunt:~$ mount | grep sda7
/dev/sda7 on /mnt/misc type ext2 (rw,noexec,nosuid,nodev,user=sander)
sander@blunt:~$
It works. Well, doesn't matter, as long as the KDE solution works for you.
 
Old 06-22-2008, 11:31 PM   #10
Honeysuckle
Member
 
Registered: Dec 2007
Location: Australia
Distribution: Puppy, debian
Posts: 118

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kummiliim View Post
Glad that you got it working. It still bugged me a bit why the script didn't work so I tried it all out myself.
I didn't want you to have to spend any more time on it if you had better things to do, but as you have persevered, I gave it another go, and it DID work - so the answer to the question "why didn't the script work last time?" is probably "clueless newb typed something wrong, or did something wrong"

However, it doesn't seem to unmount it - does that work for you? EDIT: tried it again after a reboot and it worked for both mounting and unmounting, so it does work.

Thanks for sticking with it.

Last edited by Honeysuckle; 06-23-2008 at 12:12 AM. Reason: updated info
 
Old 06-23-2008, 04:17 AM   #11
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
Quote:
Originally Posted by Honeysuckle View Post
I didn't want you to have to spend any more time on it if you had better things to do, but as you have persevered, I gave it another go, and it DID work - so the answer to the question "why didn't the script work last time?" is probably "clueless newb typed something wrong, or did something wrong"

However, it doesn't seem to unmount it - does that work for you? EDIT: tried it again after a reboot and it worked for both mounting and unmounting, so it does work.

Thanks for sticking with it.
No problem. I always try to fix my stuff even when I have other solutions just so I can see how things work.
 
  


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
mounting and unmounting zerocool22 Linux - Server 9 06-04-2008 09:00 PM
mounting, unmounting? not really getting it..how to they work laucian Linux - Newbie 8 03-23-2008 10:48 AM
mounting & unmounting? 777JR Slackware 3 02-08-2004 04:26 AM
Mounting and unmounting in Linux... Tommi Linux - Newbie 3 07-05-2003 09:02 PM
Mounting and unmounting Hidden Dragon Linux - General 20 09-01-2002 08:52 PM


All times are GMT -5. The time now is 09:02 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