I want to write a script to automatically modify the partition table I am starting with 3 partitions like this # parted /dev/sda print Model: VMware, VMware Virtual S (scsi) Disk /dev/sda: 10.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 107MB 107MB primary ext3 boot 2 107MB 4828MB 4721MB primary ext3 3 4828MB 9023MB 4195MB primary lvm And I want to remove partitions 2 & 3 and recreate 2 from the end of 1 to the end of the disk i.e. all the free space. Removing 2 and 3 is easy. # parted /dev/sda rm 3 # parted /dev/sda rm 2 # parted /dev/sda print Model: VMware, VMware Virtual S (scsi) Disk /dev/sda: 10.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 32.3kB 107MB 107MB primary ext3 boot Is there a way to use a non-interactive command to create the new 2nd partition in the free space? Thanks Dean
Plant, Dean wrote:> Is there a way to use a non-interactive command to create the new 2nd > partition in the free space?parted works well for such situations, and if python is your thing, pyparted is already included in the distro. - KB