[Bug 1270203] Re: no way to use resizepart non-interactively on busy partition
Phillip Susi
psusi at ubuntu.com
Fri Jan 17 16:23:56 UTC 2014
echo "Yes" | sudo parted ---pretend-input-tty /dev/vdb resizepart 1 1000
fails because of another bug I had noticed recently but not gotten
around to fixing yet... when looking for an answer to the exception
question, like regular input, parted first looks for the next word given
on the command line before trying to read from stdin. It should skip
the command line and go straight to stdin for exceptions. You can work
around this by not mixing stdin with command line arguments, and just
echo everything. In other words:
cat <<EOF | sudo parted ---pretend-input-tty /dev/vdb
resizepart 1 1000
yes
EOF
You can also use whatever units you like; you just need to either change
the default unit with the unit command, or append the unit suffix to the
numbers, such as 2048s for sector 2048.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to parted in Ubuntu.
https://bugs.launchpad.net/bugs/1270203
Title:
no way to use resizepart non-interactively on busy partition
Status in “parted” package in Ubuntu:
Confirmed
Bug description:
I can't see a way to really use resizepart usefully on a mounted
partition (which is kind of the point of the functionality).
There are a few issues:
a.) it seems that the size provided is in MB when realistically I'd like to provide the number in sectors or blocks, something more fine-grained than that.
b.) no way to say 'grow as big as you can'
c.) no way to use 'force' or use non-interactively outside of undocumented flag.
Example:
$ echo "1,1000,L" | sudo sfdisk /dev/vdb
$ grep "vdb" /proc/partitions
253 16 20971520 vdb
253 17 504000 vdb1
$ sudo mkfs /dev/vdb1
$ sudo mount /dev/vdb1 /mnt
## now /dev/vdb is busy (mounted) try to resizepart on it.
$ sudo parted /dev/vdb resizepart 1 </dev/null
Warning: Partition /dev/vdb1 is being used. Are you sure you want to continue?
$ echo $?
1
# so that didn't resize (reading from /dev/null). Not surprising.
# try with 'Yes' to stdin.
echo "Yes" | sudo parted /dev/vdb resizepart 1; echo $?
Warning: Partition /dev/vdb1 is being used. Are you sure you want to continue?
1
I've also tried the undocumented '---pretend-input-tty' without success.
It seems it can be used for some operations, but not for others.
For example, this worked on an unmounted partition:
echo "Yes" | sudo parted ---pretend-input-tty /dev/vdb resizepart 1 500
But this doesn't seem to work on a mounted partition which is really my goal:
echo "Yes" | sudo parted ---pretend-input-tty /dev/vdb resizepart 1 1000
Warning: Partition /dev/vdb1 is being used. Are you sure you want to continue?
parted: invalid token: 1000
Yes/No? Yes
End? [500MB]?
Related bugs:
* bug 1212492: cloud-init cc_growpart broken if parted resizefs found
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1270203/+subscriptions
More information about the foundations-bugs
mailing list