Help us understand the problem. What is going on with this article?

parted

More than 5 years have passed since last update.
create_parted_partitions.py
#!/usr/bin/python

_TARGET_DISK       = '/dev/sdb'
_PARTITION_NUM     = 4

#--- parted _TARGET_DISK -s 'unit s print'

_DISK_SECTOR       = 17511219456
_OFFSET_START      = 2048
_OFFSET_END        = 34
_AVAILABLE_SECTOR  = _DISK_SECTOR - _OFFSET_START - _OFFSET_END
_PARTITION_SECTOR  = _AVAILABLE_SECTOR / _PARTITION_NUM / 2048 * 2048
_PARTED_COMMAND    = "parted %s -s 'unit s mkpart primary ext4 %12ds %12ds'"

for i in xrange(_PARTITION_NUM):
    if i == 0 : sector_start = _OFFSET_START
    else      : sector_start = sector_end + 1
    sector_end = sector_start + _PARTITION_SECTOR - 1
    print _PARTED_COMMAND % (_TARGET_DISK, sector_start, sector_end)
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away