How partition can be created in Red Hat 6.0 by shell script?

10 pts.
Tags:
Red Hat
Shell scripts
I want to write a shell script which contains commands of partition creation, in execution of  this shell script user has to enter only partition size and other details in file /etc/fstab/ , i tried but it is not giving me the expected output.

Software/Hardware used:
redhat 6.0

Answer Wiki

Thanks. We'll let you know when a new response is added.

use vi editor and write commands for creation of partition and then run it.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Subhendu Sen
    Fdisk reads from stdin so u just need to feed it by an appropriate command. For an example u can start like that....
    (echo n; echo p; echo 1; echo 1; echo 500; echo w) | fdisk / dev/sdx
    This is just an example which creates 500 mb partitions on HDD. Here x denotes ur hard disk sequence. if it shows sda then u put sda, if it shows sdb then u put sdb and so on if u have more than one HDD(see by issuing this: fdisk -l. U will become so careful to create partitions and have enough knowledge that u know what u will do. 1st take all backups and then try this. Else it will mesh up ur OS. So, be careful and better make this experiment on a tes pc. For more info plz navigate here: http://linuxgazette.net/issue46/nielsen.html#create



    29,780 pointsBadges:
    report
  • NitinIND

    Hi ,

    I  can understand  your interest in Shell Scripting . But Creating a new  Partition is always a critical  task  . It is recommended to do it  manually always as Linux admin .

    But  Still  if u wanna a  make script for time saving purpose or for some Coding .Go with LVM partition it is handle . If u want i can share  script for LVM partition created and Deleted .


    60 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following