Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
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?


  Search this Thread
Old 12-19-2003, 10:15 AM   #1
LQ Newbie
Registered: Jul 2003
Posts: 27

Rep: Reputation: 15
how to automatically partition and format drive if absent at startup

I have the need to check for a partitioned and formatted removable hard drive at boot time and mount it if present OR to automatically partition, format and mount a new drive installed in its place. Does anyone know how to script this? I was thinking about an initrd script but am not sure how to implement it. I am trying to stay away from user intervention. Automatically at boot is best but a script after login is cool too. I'm just trying to keep the user away from the root password. I have a script to do the autmount but it needs root privileges. Is there any way to put the su command into a script with the password? I know it's a bad idea but it's better than letting my users know the root password outright if I cannot script it otherwise.


I am running RH9.
Old 12-19-2003, 10:59 AM   #2
Registered: Aug 2002
Posts: 19,942

Rep: Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311Reputation: 3311
I'm assuming a removable drive of some kind? Why can't they be already partitioned and formated?

You can call a script from rc.d. I'm sure its possible but I do not know if you can run fdisk in a non-interactive mode. Formating shouldn't be a problem.
Old 12-19-2003, 12:36 PM   #3
LQ Newbie
Registered: Jul 2003
Posts: 27

Original Poster
Rep: Reputation: 15
You can definately run fdisk non-interactively, I have done it. You just have to be root to do it. I am trying to find out if there is a way to do it without having root permission explicitly. I need a scripted su or to do it a boot time with a script. I have users that will remove the drive but who I do not wish to have root privileges.


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
format a hard drive (/dev/hda1) in Reiser fs format Linh Linux - General 7 06-17-2009 06:30 AM
How to automatically connect on startup? PerfectReign Linux - Wireless Networking 6 09-16-2005 01:44 AM
How to format a hard drive partition? pujolasdf Linux - Newbie 2 05-06-2005 06:50 AM
Any way to startup daemon automatically? Niceman2005 Linux - Newbie 2 01-12-2005 09:27 PM
startup the service automatically ashley75 Linux - General 4 09-24-2003 02:14 AM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:05 AM.

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