LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 11-16-2009, 04:35 PM   #1
giyad
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Rep: Reputation: 0
How to auto-mount a NTFS RAID partition?


Ok, I have a maybe unique problem as it took me a really long time to find a solution for mounting my RAID (kudos to mostlyharmless for helping figure this one out)

Now, it seems that every time I restart my computer, the partitions created by kpartx are no longer there. I have to run every time I boot up:

Code:
sudo kpartx -a /dev/mapper/nvidia_facfcied
So, this means also that I am not able to auto-mount the partition.

Here are my questions:

1. How can I have it so that the partitions are either permanent, or create a script that runs every time I login that will run that code (without requesting my password)?

2. How do I auto-mount the drive once I've solved the first question?

3. The thing is I want to use this NTFS RAID as a media share. If I have to create the partition mappings each time I boot up, and then mount, share settings probably won't stick. Will I be able to save my share settings?

Last edited by giyad; 11-16-2009 at 04:50 PM.
 
Old 11-16-2009, 05:23 PM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 85
I've no real experience of NTFS raid, so there may be a more "proper" way of doing this, but the simplest would be to use the normal startup scripts system.

Many Linux distros will have a script called something like boot.local or rc.local in /etc or /etc/init.d, that is executed at the end of the boot process. By default, these scripts usually do nothing, and are just there for users to add anything else that they need to run during boot. Just add the commands needed to initialise and mount the devices, to these scripts.

If there is no such script on your system, you could create one, make it runnable, and then create a start link to it from the directory for your default runlevel. For example:

Code:
sudo bash # get a root shell
cat <<-END > /etc/init.d/ntfs_init.sh # create the script
#!/bin/bash
kpartx -a /dev/mapper/nvidia_facfcied
# add any other commands that are needed here

exit 0
END
chmod 700 /etc/init.d/ntfs_init.sh # make it runnable by root
runlevel # get the current runlevel (the second number)
# the command below will add a startup link for runlevel 2 (Debian default)
# change as appropriate
ln -s /etc/init.d/ntfs_init.sh /etc/rc2.d/S99ntfs_init
# S means start, 99 is the priority (1 is the highest, but this command
# probably wants to come quite late)
 
Old 11-16-2009, 05:41 PM   #3
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,534
Blog Entries: 12

Rep: Reputation: 171Reputation: 171
Quote:
#!/bin/bash
kpartx -a /dev/mapper/nvidia_facfcied
then put right after that
mount -t ntfs-3g /dev/mapper/nvidia_facfcied2 /media/Z
 
Old 11-16-2009, 06:10 PM   #4
giyad
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks so much guys! GOT IT WORKING :-)

Code:
sudo gedit /etc/rc.local
This is what was in the rc.local file:
Quote:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0
This is what I modified it to:

Quote:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
kpartx -a /dev/mapper/nvidia_facfcied
mount -t ntfs-3g /dev/mapper/nvidia_facfcied2 /media/Z

exit 0
Works like a charm!

Last edited by giyad; 11-16-2009 at 07:07 PM.
 
Old 11-17-2009, 12:38 AM   #5
giyad
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
I do have a question for you guys. I was planning on running my current Windows installation virtually in Ubuntu. But, now that I've got the RAID mounted in Ubuntu, would running that drive cause problems? I know that I'm not supposed to mount any drives simultaneously in the VM and the host OS.
 
Old 11-18-2009, 09:19 AM   #6
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,534
Blog Entries: 12

Rep: Reputation: 171Reputation: 171
Correct, you shouldn't mount the drive under Ubuntu and have the Windows installation see the drive at all. You can run your Windows partition and then mount the Ubuntu served RAID partition as a network drive though, or as a "shared drive". Be careful that when you run Windows that the RAID is not touched at all by Windows; not mounted, not recognized, period.

While you can run your physical Windows partition directly under a VM, and go back to dual booting if you need to (for games, eg.), you might have some Windows activation problems (though not insurmountable) and you increase the chances of something bad happening to the Windows installation. You're probably better off running an entirely separate VM with a new virtual drive for Windows if you can avoid dual booting. It's just my opinion, having done it both ways.
 
Old 11-19-2009, 01:31 AM   #7
giyad
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mostlyharmless View Post
Be careful that when you run Windows that the RAID is not touched at all by Windows; not mounted, not recognized, period.
Ummm... how do you go about doing that? I mean won't the RAID automatically mount in Windows, and definitely be recognized (Or does the VM work differently)?

So it sounds like my only option would be to unmount the RAID in Ubuntu whenever I want to run the virtual machine.

Honestly, I think I'm going to end up not using that partition to boot up in the VM, but I want to try it out haha. I'm going to be installing Windows 7 soon anyway, so I don't really care if something happens to my Windows partition (everythings backed up on the RAID, and the RAIDs backed up to an external).
 
Old 11-19-2009, 09:59 AM   #8
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,534
Blog Entries: 12

Rep: Reputation: 171Reputation: 171
Quote:
I mean won't the RAID automatically mount in Windows, and definitely be recognized (Or does the VM work differently)?
When you set up the VM, you'll specify the harddisk to use. You should only specify the installation disk, not the RAID array. Before you do that, you'd have to boot into Windows the regular way and remove that RAID array and driver from your Windows install so that it is seen as a foreigh partition, just like your Linux ones.

Quote:
So it sounds like my only option would be to unmount the RAID in Ubuntu whenever I want to run the virtual machine.
But this would be safer of course.
 
Old 11-19-2009, 10:12 AM   #9
giyad
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mostlyharmless View Post
When you set up the VM, you'll specify the harddisk to use. You should only specify the installation disk, not the RAID array. Before you do that, you'd have to boot into Windows the regular way and remove that RAID array and driver from your Windows install so that it is seen as a foreigh partition, just like your Linux ones.


But this would be safer of course.
Yeah, I definitely want teh RAID to still be accessible from Windows when i choose to boot up from Windows normally, so I'd probably have to unmount whenever I run the VM. You're right this doesn't sound like a safe solution, maybe I will just run a separate installation.

Thanks mostlyharmless you've been great at getting me settled with Linux :-)

Actually, to think of it, I've been loving scripts, maybe there would be a way to have Ubuntu automatically unmount the RAID whenever I boot up the VM... that way I wouldn't have to worry about forgetting!
 
Old 12-17-2009, 04:18 AM   #10
kad_mann
LQ Newbie
 
Registered: Dec 2009
Posts: 5

Rep: Reputation: 0
Quote:
Originally Posted by mostlyharmless View Post
Correct, you shouldn't mount the drive under Ubuntu and have the Windows installation see the drive at all. You can run your Windows partition and then mount the Ubuntu served RAID partition as a network drive though, or as a "shared drive". Be careful that when you run Windows that the RAID is not touched at all by Windows; not mounted, not recognized, period.
Rubbish.
 
0 members found this post helpful.
Old 12-17-2009, 12:03 PM   #11
giyad
LQ Newbie
 
Registered: Nov 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kad_mann View Post
Rubbish.
care to elaborate?
 
Old 12-18-2009, 07:29 PM   #12
kad_mann
LQ Newbie
 
Registered: Dec 2009
Posts: 5

Rep: Reputation: 0
Quote:
Originally Posted by giyad View Post
care to elaborate?
If the suggestion you were given has the even the remotest amount of validity to it then there is absolutely no point whatsoever to having NTFS support in Linux, let alone NTFS read/write support. I share a four disk, NTFS-formatted 3TB SATA RAID5 array, and an NTFS-formatted four disk 1.5TB RAID10 PATA array between my Linux host and Windows and up to two different distros of Linux running simultaneously in VMs.

As for the idea of serving RAID as a network drive, well... *CHOKE* *GAG* COUGH*

All that need be done is mount the drive then share it between the running VM's. The VM, under the hood, in the background, unseen to unknowing eyes, shares the drive as a network drive anyway. The only operating system that ever needs to know what the physical format of the drive actually is is the host itself.

You will note that the person who made the suggestion to you did not query my assertion that you were being told complete and utter rubbish.

Season's greetings and good will.
 
Old 12-21-2009, 09:44 AM   #13
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,534
Blog Entries: 12

Rep: Reputation: 171Reputation: 171
I don't normally feed trolls. Of note, your elaboration shows that you didn't understand the situation. It isn't a matter of mounting the array under the host and making it available. That, indeed, would be safe and reasonable.

Furthermore, your message is rude for a first post.
 
Old 12-22-2009, 12:57 AM   #14
kad_mann
LQ Newbie
 
Registered: Dec 2009
Posts: 5

Rep: Reputation: 0
Quote:
Originally Posted by mostlyharmless View Post
I don't normally feed trolls.
Perhaps you do, perhaps you don't. I tend not to judge.

Quote:
Of note, your elaboration shows that you didn't understand the situation.
Claim fails. Complete lack of argument and hence, a complete lack of proof.

Quote:
Furthermore, your message is rude for a first post.
So, either I am a successful troll who got you to respond, or I am right.

There are two shovels over there -->

Take your pick.

"you shouldn't mount the drive under Ubuntu and have the Windows installation see the drive at all. You can run your Windows partition and then mount the Ubuntu served RAID partition as a network drive though, or as a "shared drive". Be careful that when you run Windows that the RAID is not touched at all by Windows; not mounted, not recognized, period."

What you told the user is complete and utter rubbish. What is worse, those unfortunate people using Google will find your response and probably believe it.

The one and only issue of "mount[ing] the drive under Ubuntu and hav[ing] the Windows installation see the drive at all" is that Windows does not know how to handle Linux symbolic links properly, and is likely to complain during a copy operation. Ceteris paribus, neither Windows nor Linux cares what OS sees the drive.

Now, you have verifiable data about my assertion that you are wrong. Your proof against the argument is...?

Of course, in your counter-argument, please do not forget I also asserted that the VM mounts the drive as a network resource anyway, despite your silly claim that the OP might mount the drive as a network drive; even if it was said only to cover up your in-exhaustive lack of knowledge about what you were talking about.

Attached are two images clearly showing that "you [CAN] mount the drive under Ubuntu and have the Windows installation see the drive at [THE SAME TIME]. You can run your Windows partition and then mount the Ubuntu served RAID partition [WITHOUT RESORTING TO MOUNTING IT] as a network drive though, or as a "shared drive"

Furthermore, the images clearly show that one does not need to "Be careful that when you run Windows that the RAID is not touched at all by Windows; not mounted, not recognized, period."

Now, you were saying?
Attached Images
File Type: png Screenshot-RAID5 - File Browser.png (65.7 KB, 4 views)
File Type: jpg untitled.JPG (40.6 KB, 4 views)
 
Old 12-22-2009, 05:33 PM   #15
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,534
Blog Entries: 12

Rep: Reputation: 171Reputation: 171
giyad: my advice was based on http://www.vmware.com/support/refere...ion_linux.html and personal experience with not following my own present advice in the past. Hope that clears things up, in case you were still wondering.
 
  


Reply

Tags
ntfs, raid


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
mount existing ntfs SATA RAID 0 on RHEL4 VIA fake RAID tmoble Linux - Hardware 10 11-13-2009 07:49 PM
Auto-mounting ntfs partition in fstab Mithrilhall Linux - Newbie 3 09-22-2009 01:03 AM
got my ntfs sata drive to mount but cat get to auto mount Jack Daniels Linux - Hardware 3 04-15-2007 10:42 AM
Multiple Help: Cannot get sound, no scroll wheel, auto mount ntfs partition... ZephyrXero Linux - Newbie 8 05-11-2004 11:45 AM
auto mounting ntfs partition Giallo998 Linux - Newbie 4 10-13-2003 10:59 PM


All times are GMT -5. The time now is 05:29 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration