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
Enable creation of non consecutive partitions #2081
Conversation
@rmetrich |
usr/share/rear/layout/save/default/950_verify_disklayout_file.sh
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not against using associative arrays for newer functionality in ReaR
but then there must be a test if associative arrays are supported
like on my SLES11 system
# declare -A arr=() && echo OK || echo FAIL with exit code $?
-bash: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
FAIL with exit code 2
I think for this pull request the parted version does not really matter
but what matters is whether or not associative arrays work so that
a test for this should be used to distinguish if ReaR can work with
non-consecutive partitions or if "rear mkrescue" should error out
in case of non-consecutive partitions.
@rmetrich I assume the mimimum size of a partition is 4096 bytes = 4 * 512 bytes This way we could create all "real" partitions normally After all "real" partitions were created normally we can remove I think we could even leave the last "real" partition as is Or could that somehow mess up things when LVM or things like that I think things will mess up when the last "real" partition |
@jsmeix I did some testing and it messed up LVM indeed. I believe resizing the partition is safer. Also it's hard to tell which is the last partition to resize because partitions must be in right order but allocated blocks are not (partition 1 can point to end of disk for example). |
@rmetrich FYI:
|
with 'set -eu' and - by the way - adapted the coding style according to https://github.com/rear/rear/wiki/Coding-Style
1d8a11b
to
5e668a5
Compare
@rmetrich I think changes in the layout code that recreates partitions |
Better postpone it to later ... even if it seems to work. |
usr/share/rear/layout/save/default/950_verify_disklayout_file.sh
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parted ... resizepart ...
does not work on older systems, see
https://github.com/rear/rear/pull/2081/files#r270031759
A side note FYI: When you need "associative" arrays that are indexed by a number
Alternatively when you need pairs of numbers in an array
and split them later with something like
which results this output
Alternatively when you need tuples of words in an array
which results this output
|
@rmetrich |
Sorry it's still WiP, testing ... |
Code is now stable, I hope :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the latest changes it looks o.k. to me
from plain looking at the code
so I approve it.
@jsmeix Could you test on a SLES12-SP4, which has "parted resize" but not "parted resizepart", but still "parted resize" with only NUM and END arguments. You just need to add some disk, partition it with msdos or GPT with gaps in partitions, and try restoring :-) |
I will test it on SLES and provide feedback @rmetrich |
I did my first test: |
I did my second test: |
Thanks @jsmeix for testing on SUSE. |
@gdha @schabrolles @gozora |
@rmetrich |
@rmetrich I will not find time to also test SLES11 to see how things behave Personally I would appreciate it if you merge it sooner than later |
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
- no associative arrays - no stderr redirection Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
…ecause it tries to resize the underlying file system also, and this is usually not implemented into parted Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
@jsmeix Done :-) |
@rmetrich |
Odd, I clicked! |
Never mind! I guess the 'click' event handler callback function manager got a |
There is a possibly severe issue/regression since this is merged: Before there have been the explicit
cf. #2142 (comment) Since this is merged the explicit
which could no longer be "just edited" by an admin I think it is the main purpose of the generated diskrestore.sh script
is now no longer true, it is no longer See also in
|
The old |
@rmetrich |
Relax-and-Recover (ReaR) Pull Request Template
Please fill in the following items before submitting a new pull request:
Pull Request Details:
Type: Enhancement
Impact: Normal
Reference to related issue (URL):
Make ReaR more fail-safe in case of sparse partition schemes #1681
Try to implement to exclude partitions between other partitions on a disk #1771
diskrestore.sh fails with not consecutively numbered partitions #1793
How was this pull request tested?
Tested with 4 disks:
parted
is not capable of creating non-consecutive partitions. To still be able to do so, the trick consists in creating dummy partitions to fill the gaps between partition numbers.Allocation of these dummy partitions is done from the end of the target partition, because
parted
is not capable of resizing a partition from the beginning.Example (see also in
/usr/share/rear/lib/layout-functions.sh
,create_disk_partition()
function):