Partitioning wildcards
I'm building a p2v script for work, and in order to make it work I need a noninteractive command that will create a partition out of all the remaining space on a disk.
Example, with a drive that ends with 8552: Code:
parted /dev/sda mkpart primary 102 8552 Code:
parted /dev/sda mkpart primary 102 * Code:
parted /dev/sda mkpart primary 102 -1 Am I up the creek here? Has anyone here ever dealt with this? |
Yes...but...
Yes, I've run into this before, the answer was to use fdisk under awk to extract the size, I'll dig thru my archives and post a snippet when I get a moment of time. Alternatively you may want to look int lshw if you know the device name of the storage you can get its total size there, where as cat /proc/parttions does not give you a size.
|
When there is no unit mentioned it defaults to megabyte. But it's possible to specify a different unitn there, i.e. something like 100%
|
I found a solution. It's sloppy but it works.
Code:
END=`parted /dev/sda print | grep ^Disk | awk '{ print $3}' | sed -e 's/MB$//'` |
All times are GMT -5. The time now is 03:57 PM. |