Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

For example:

  sam@sam:~$ sudo fdisk /dev/sdb
  [sudo] password for sam: 
  Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
  Building a new DOS disklabel with disk identifier 0xb063e88f.
  Changes will remain in memory only, until you decide to write them.
  After that, of course, the previous content won't be recoverable.

  Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

  Command (m for help): m
  Command action
     a   toggle a bootable flag
     b   edit bsd disklabel
     c   toggle the dos compatibility flag
     d   delete a partition
     l   list known partition types
     m   print this menu
     n   add a new partition
     o   create a new empty DOS partition table
     p   print the partition table
     q   quit without saving changes
     s   create a new empty Sun disklabel
     t   change a partition's system id
     u   change display/entry units
     v   verify the partition table
     w   write table to disk and exit
     x   extra functionality (experts only)

  Command (m for help): p

  Disk /dev/sdb: 214.7 GB, 214748364800 bytes
  255 heads, 63 sectors/track, 26108 cylinders, total 419430400 sectors
  Units = sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disk identifier: 0xb063e88f

     Device Boot      Start         End      Blocks   Id  System

  Command (m for help): n
  Partition type:
     p   primary (0 primary, 0 extended, 4 free)
     e   extended
  Select (default p): p
  Partition number (1-4, default 1): 1
  First sector (2048-419430399, default 2048): 
  Using default value 2048
  Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): +10G

  Command (m for help): p

  Disk /dev/sdb: 214.7 GB, 214748364800 bytes
  255 heads, 63 sectors/track, 26108 cylinders, total 419430400 sectors
  Units = sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disk identifier: 0xb063e88f

     Device Boot      Start         End      Blocks   Id  System
  /dev/sdb1            2048    20973567    10485760   83  Linux

  Command (m for help): w
  The partition table has been altered!

  Calling ioctl() to re-read partition table.
  Syncing disks.
  sam@sam:~$

How to use one single instructions to do all these things?

Thank you~

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.