Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc_growpart broken if parted resizefs found #2387

Closed
ubuntu-server-builder opened this issue May 10, 2023 · 10 comments
Closed

cc_growpart broken if parted resizefs found #2387

ubuntu-server-builder opened this issue May 10, 2023 · 10 comments
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1212492

Launchpad details
affected_projects = ['cloud-init (Ubuntu)']
assignee = None
assignee_name = None
date_closed = 2014-01-17T15:40:55.443752+00:00
date_created = 2013-08-15T01:28:13.928002+00:00
date_fix_committed = None
date_fix_released = None
id = 1212492
importance = medium
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1212492
milestone = None
owner = smoser
owner_name = Scott Moser
private = False
status = wont_fix
submitter = smoser
submitter_name = Scott Moser
tags = ['cloud-images']
duplicates = []

Launchpad user Scott Moser(smoser) wrote on 2013-08-15T01:28:13.928002+00:00

As reported in bug 1212444, the partition growing is broken if growpart is found to be usable.
There are 2 things that are broken,
 a.) we invoke parted wrong (passing device after 'resizepart' rather than before)
 b.) parted seems somewhat broken, and I dont know how to force it to do what we want. See:

$ sudo parted /dev/vda resizepart --script 1 </dev/null; echo $?
Warning: Partition /dev/vda1 is being used. Are you sure you want to continue?
1

Um... yes, parted, i want you to do what I told you to do.

Related bugs:

  • bug 1212444: cc_growpart failed in auto grow mode with "Error: Could not stat device resizepart - No such file or directory." with parted 2.3-14
  • bug 1270203: [parted] no way to use resizepart non-interactively on busy partition
@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 10, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2013-08-15T01:45:50.924935+00:00

So it looks like we need some way to specify '--force' to parted. The use case we have is known to have 'in use' partition that we're trying to grow.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Phillip Susi(psusi) wrote on 2013-08-15T01:58:42.805233+00:00

Currently the only way to have parted resize a busy partition is to use interactive mode rather than script mode and say yes at the prompt.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2013-08-15T13:38:47.370557+00:00

Phillip,
I guess that basically means I can't use this. :-(
It also seems generally broken as the primary reason for 'resizepart' is to allow modifying a busy partition table and telling the kernel about it.

Any ideas on how to proceed? Should I file a bug/feature request upstream by sending mail to bug-parted mailing list ?
It looks like this has been raised before at http://lists.gnu.org/archive/html/bug-parted/2008-02/msg00019.html .

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Phillip Susi(psusi) wrote on 2013-08-16T19:00:03.764443+00:00

You have to not use --script and parse the output for the warning and answer yes. I have been mulling over a --force-things system to allow a script to specify that it expects a specific error and how it should be handled but it isn't easy the way libparted is structured.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2013-08-16T20:41:39.024339+00:00

I dont think i follow what you meant by "parse the output for the warning and answer yes".

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 also failed in an attempt with 'expect', but not sure thats relevant as I dont want to use expect anyway, and I might have done something wrong.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Phillip Susi(psusi) wrote on 2013-08-17T01:33:02.203556+00:00

IIRC, parted assumes --script mode when stdin is not a tty. There was an undocumented switch that the test suite uses to override this, or I thought that expect allocates a pseudo tty (might need a switch) and that should also do the trick.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2013-08-19T14:27:10.988612+00:00

I'm not using '--script' above. It seems to make no difference in my testing.
Thus the test with 'expect' to try to trick it into using a tty and feed it info that way.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2014-01-17T15:33:15.520114+00:00

Ok.
I'm not even sure if resizepart can be made to work, at all.

$ parted --help | grep resizepart
resizepart NUMBER END resize partition NUMBER

the END seems to be in MB, which is insufficient for my needs. I'd like it to grow it to the next partition.
There isn't a way to just say "make it as big as possible".

The undocumented flag for --script is '---pretend-input-tty', but I can't even seem to make that work.

It just seems to ignore things like this:

$ echo "Yes" | sudo parted ---pretend-input-tty /dev/vdb resizepart 1 1000 --machine --script
Warning: Shrinking a partition can cause data loss, are you sure you want to continue?
$ echo $?
0

but it doesn't shrink the partition table

I'm going to remove the support for parted from cloud-init entirely.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Phillip Susi(psusi) wrote on 2014-01-17T16:11:52.767468+00:00

You don't use ---pretend-input-tty in conjunction with --script. The point is to pretend that you are a human, not a script.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Launchpad Janitor(janitor) wrote on 2014-01-25T04:03:54.170498+00:00

This bug was fixed in the package cloud-init - 0.7.5~bzr933-0ubuntu1


cloud-init (0.7.5~bzr933-0ubuntu1) trusty; urgency=medium

  • debian/control: bump Standards-Version to 3.9.5
  • debian/control: drop boto dependency no longer required in trunk.
  • New upstream snapshot.
    • ConfigDrive: consider partitions labelled correctly as possible sources.
    • find root filesystem for resizing in cases where there is no initramfs
    • removal of dependency on python-boto
    • vendor-data support, and usage of that in Joyent datasource.
    • change default output to be logged to /var/log/cloud-init-output.log
    • SeLinuxGuard: Cast file path to string. (LP: #1260072)
    • drop support for resizing via parted (LP: #1212492)
    • SmartOS: changes to address changes in platform (LP: #1272115)
    • FreeBSD support.
      -- Scott Moser smoser@ubuntu.com Fri, 24 Jan 2014 22:41:57 -0500

@ubuntu-server-builder ubuntu-server-builder closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant