LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to auto fdisk? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-auto-fdisk-451684/)

wucan 06-05-2006 01:46 AM

How to auto fdisk?
 
I know the fdsik not support script process, but I want to apply the same step to other disks, the disks number is large and this is the reason I want auto fdisk. Could someone gave me a hint?

Tinkster 06-05-2006 01:53 AM

If the drives all have the same geometry:

Get partition info:
Code:

dd if=/dev/hda of=mbr_part_table bs=512 count=1

Set partition info:
Code:

dd if=mbr_part_table of=/dev/hda bs=512 count=1

Should be quite scriptable if you put the resulting file from step
one close to the script ;}


Another alternative would be expect.
man expect for details - most distros provide it.


Cheers,
Tink

syg00 06-05-2006 02:07 AM

sfdisk - designed for the job. See the man page.

wucan 06-05-2006 02:15 AM

ok, thanks all, I will try these now.


All times are GMT -5. The time now is 08:04 AM.