LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 08-08-2008, 05:00 PM   #1
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 872

Rep: Reputation: 124Reputation: 124
How can I easily mount ntfsclone images using a GUI?


Hello.

I'm running Ubuntu 8.04.1 Desktop AMD64.

I'm spearheading a project at the computer shop that I work at that requires me/the other technicians to be able to clone an NTFS partition into an image file (NOT using the -s option), and mount it using a point-and-click interface. The problem is that I haven't been able to figure out how to do this, either with or without some serious config file hacking.

Here's how I want the hard drive mounted (WITHOUT editing /etc/fstab):

Code:
mount -t ntfs-3g /path/to/whatever.img /media/mountpoint -o users,exec,uid=$UID,gid=$GID,allow_others,umask=002
This works in the console, if I substitute $SUDO_UID and $SUDO_GID for $UID and $GID respectively, but for some reason, it ignores the users,umask,uid=,gid= options. (When I look in /etc/mtab or type "mount", it doesn't show them.) Accordingly, the user that I want to be able to umount the file via point-and-click is unable to do so.

So far, I've been using a script I made (with the above mount command in it) to mount the image via point-and-click. This required me to add the following line into /etc/mime.types:

Code:
application/x-ntfs-image     .img
...and add the following into mount-ntfs-img.desktop (put into /usr/share/applications):

Code:
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=mount-ntfs-img.desktop
Comment=A BASH script to mount .img ntfs clone files via fuse-mount.
Exec=gksudo /usr/local/sbin/mountfile.sh %f
Icon=gnome-terminal
Terminal=true
StartupNotify=false
MimeType=application/x-ntfs-image;
Type=Application
Categories=GNOME;Core;
OnlyShowIn=GNOME;
Name[en_US]=mount-ntfs-img.desktop
I put my script, mountfile.sh into /usr/local/sbin:

Code:
#!/bin/bash

partpath=$1
part=`echo $partpath | sed -e 's/^.*\///' -`
mountpoint=$part
counter=""

mountit()
{
mount "$partpath" "/media/$mountpoint" -o exec,umask=002,uid=$SUDO_USER,gid=fuse
}

ifvalid()
{
if [ ! -d "/media/$mountpoint" ]
        then mkdir /media/$mountpoint >/dev/null 2>&1
fi

if [ -f /media/$mountpoint/* ]
        then 
        let counter+=1
        mountpoint=`echo $mountpoint | sed -e 's/-[0-9]*//g' -`-$counter
        ifvalid
        else
        mountit
fi
}

ifvalid

if mount | grep "$partpath on /media/$mountpoint" >/dev/null 2>&1
        then
        echo "Your image file ($partpath) is now mounted on /media/$mountpoint."
        read -n 1 -p "Press any key to finish."
fi
(Legal stuff: Script is my work, as an employee at PCI Computer Services, and cannot be used for commercial purposes without written permission. End of legal stuff.)


I then right-clicked on the .img file I wanted to mount and told it to open with mount-ntfs-img. This mounted it nicely. Unfortunately, when I go to unmount it by right-clicking on the "partition's" image on the Desktop, it tells me that it's not in /etc/fstab, and that I'm not root, and therefore can't umount it.

I tried going into System -> Authorizations (in GNOME) and giving my user explicit permission to unmount all volumes mounted by other users, but to no avail.

I think I'm going about this the wrong way. It seems that the Authorizations I gave my user only apply to stuff mounted by HAL or some such, and I don't know how to make that work for me. Furthermore, I don't know why it's ignoring my various mount options. So, my question (in a nutshell) is this:

How can I mount an ntfsclone image (NOT using the -s option) via right-clicking on the .img file in GNOME, and unmount it the same way, as any user? Even if only the user mounting it can unmount it, that would be fine, so long as I can do so using a point-and-click method.

PLEASE help me out here! :-) I'm really stumped, and my boss is going to start wondering what's taking so long (and I think it would be really cool to know how to do this for my own purposes).

Thanks in advance for any help you are able to render.

--Dane
 
Old 08-08-2008, 06:51 PM   #2
grepmasterd
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
hmm, why don't you want to update /etc/fstab?

and have you tried the 'loop' option (mount -o loop)
 
Old 08-08-2008, 08:24 PM   #3
DaneM
Member
 
Registered: Oct 2003
Location: Chico, CA, USA
Distribution: Linux Mint
Posts: 872

Original Poster
Rep: Reputation: 124Reputation: 124
Thanks for the reply!

We (at the computer shop) intend to do this with lots of different drives/images. We don't want to end up with a cluttered /etc/fstab, or have to do anything from the command prompt. (While I'm reasonably Linux savvy, the other techs at the shop are used to Windows and Mac.)

I suppose it would be possible to include some fstab editing in my script, assuming it wouldn't ignore my mount options as mentioned above. Still, though, I'm hoping to do it in a cleaner way (such as using gnome-mount, hal, or some such), and not have to do any more scripting than absolutely necessary. Also, I suspect that it's possible to do without any command-line intervention, because Ubuntu/Gnome/Linux allows one to mount other ntfs partitions without having to edit the fstab or mess with the command line; I just don't know how it does it.

For some reason, the -o loop option isn't working (even though the ntfsclone man page specifies its use). The .img files I've made DO mount just fine using the commands I posted, but just not from a GUI without me having to hack together a script and a .desktop file. Really, I'd like to do it as close to the "GNOME way" as possible.

Thanks again for your reply; this is really a stumper for me. Please don't take my preconceived notions as a dismissal of your suggestions. :-)

--Dane

Last edited by DaneM; 08-08-2008 at 08:25 PM.
 
  


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
how to easily mount a ntfs drive with the right permissions for users ? frenchn00b Linux - General 1 04-02-2008 06:39 PM
LXer: Mount and Unmount ISO,MDF,NRG Images Using AcetoneISO (GUI Tool) LXer Syndicated Linux News 0 07-26-2007 12:31 PM
Whole GUI Can't View Images laxisusous Linux - General 3 09-20-2006 08:17 AM
Split large ntfsclone images? recce101 Linux - Software 3 09-05-2005 12:53 PM
can't mount some initrd images?! citro Linux - General 3 06-10-2005 03:36 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

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