Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can you create a partition in a usb disk using fdisk command in a single line.

fdisk command is interactive in nature, But I want to automate partition creation in a single line using fdisk command.

share|improve this question

3 Answers 3

You probably need to use the parted command instead of fdisk.

share|improve this answer

sfdisk also has a non-interactive mode that reads in partition information from stdin. parted is more flexible, though.

share|improve this answer

Use sfdisk instead.

The sfdisk man page is a little confusing, here's some specific examples of how to automate partition setup with sfdisk. One example is you can save the partition info from one drive via sfdisk -l and then dump that directly on to a new drive.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.