Linux / UNIX Tech Support Forum
This is a discussion on How to initialize HDD using Shell script? within the Shell scripting forums, part of the Development/Scripting category; Hi I'm new to Linux. I'm wondering how to write a shell script to clear off all the partitions on ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi I'm new to Linux.
I'm wondering how to write a shell script to clear off all the partitions on a IDE HDD? Any help will be much appreciated. Thank you gail |
| Sponsored Links | ||
|
|
|
||||
|
You need to use GNU parted utility - a partition manipulation program. It is perfect tool and works from a shell script. Here is a sample shell script. Make changes as per your setup and test script in a dummy environment.
Code:
#!/bin/sh PART=$1 if [ $# -eq 0 ] then echo "$0 partition-name echo "$0 /dev/sda1" exit 1 fi echo "* Creating partition." parted -s -- $PART mkpart primary ext3 0 -1 echo "* Formatting the partition." mke2fs -j -m 0 -O dir_index $PART HTH
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| linux , parted , shell script |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] Shell script for ftp the file | vishal_titre | Shell scripting | 4 | 21-08-2009 03:50 PM |
| Run mv command from ftp shell script | subin | Shell scripting | 6 | 02-05-2008 09:44 AM |
| writing a shell script to find out my shell name | jaymob123 | Shell scripting | 1 | 08-10-2007 12:36 AM |
| require shell script | puppen | Shell scripting | 4 | 12-04-2006 09:42 PM |
| Shell Script dought | Mahesh | Shell scripting | 3 | 16-02-2005 12:13 PM |