Results 1 to 2 of 2
i am trying to write a shell script for making partiton in usb pen drive 1GB capacity using fdisk command
but i am not able to pass the paremeters (like ...
- 01-03-2008 #1Just Joined!
- Join Date
- Nov 2007
- Posts
- 27
how to write shell script for partition usb pen drive using fdisk cmd?
i am trying to write a shell script for making partiton in usb pen drive 1GB capacity using fdisk command
but i am not able to pass the paremeters (like P or size to partition) in script which are required by fdisk command.
so please can any one tell me how to write the shell script in red hat linux 9.2-2.6.20 kernel
please revert
thanks in advance
- 01-03-2008 #2
When I do this at the command line:
I get back the instructions for using fdisk. Those instructions include this:Code:man fdisk
You have several choices here. My two favorites:Code:BUGS There are several *fdisk programs around. Each has its problems and strengths. Try them in the order cfdisk, fdisk, sfdisk. (Indeed, cfdisk is a beautiful program that has strict requirements on the partition tables it accepts, and produces high quality partition tables. Use it if you can. fdisk is a buggy program that does fuzzy things - usually it happens to produce reasonable results. Its single advantage is that it has some support for BSD disk labels and other non-DOS partition tables. Avoid it if you can. sfdisk is for hackers only - the user inter- face is terrible, but it is more correct than fdisk and more powerful than both fdisk and cfdisk. Moreover, it can be used noninteractively.)
- Use sfdisk. Be very careful. This is not for the faint of heart. I've never used sfdisk, but it seems to be suited for use in a script. For more information, do this at the command line:
Code:man sfdisk
- Use cfdisk. I've always liked that one. It doesn't lend itself to a script very well, but you can get around that by performing two steps:
- Use it interactively for a while until you're extremely familiar with what you want to do, and how you would ask cfdisk to do it interactively.
- Learn how to use the program "expect". This program lets you do things in a script with programs which can normally be used only interactively. You say to it, "expect this on the 'screen' and then enter this other stuff on the 'keyboard'" -- all in a script. For more information, do this at the command line:
You can also read the wikipedia article on expect. There are some very useful links at the bottom of that article.Code:man expect
You can also google
if you wish.Code:expect tutorial
Hope this helps.--
Bill
Old age and treachery will overcome youth and skill.
- Use sfdisk. Be very careful. This is not for the faint of heart. I've never used sfdisk, but it seems to be suited for use in a script. For more information, do this at the command line:


Reply With Quote