| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
There was a 1-off error in _partition_get_overlap_constraint that
prevented partitions from being created in 1s free space. You could
create 1s partitions as long they were done in order, but not after
leaving 'holes'.
This fixes this and adds tests for it on msdos and gpt disklabels.
|
| |
|
|
|
|
|
|
|
|
|
| |
Include the partition type-id and type-uuid in the JSON
output. Also add the the command 'type' to set them. Remove
redundant flags from DosPartitionData and use only the system
variable.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
|
|
|
| |
When no flag is set on a GPT partition the GUID should fall back to the
filesystem type for fat32, swap, and hfs+ and if no filesystem is found
it should default to linux filesystem data type, showing no filesystem
and no flags.
|
|
|
|
|
|
| |
Keep GUID specific attributes when writing GPT.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This outputs the disk's details as a JSON object. eg. a disk image with
a single partition from 1M to 100M:
{
"disk": {
"path": "/root/disk1.img",
"size": "2097152s",
"model": "",
"transport": "file",
"logical-sector-size": 512,
"physical-sector-size": 512,
"label": "gpt",
"max-partitions": 128,
"partitions": [
{
"number": 0,
"start": "34s",
"end": "2047s",
"size": "2014s",
"type": "free"
},{
"number": 1,
"start": "2048s",
"end": "200703s",
"size": "198656s",
"type": "primary",
"name": "root"
},{
"number": 0,
"start": "200704s",
"end": "2097118s",
"size": "1896415s",
"type": "free"
}
]
}
}
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This makes it possible to pass an empty string in script mode e.g. to
set no partition name (on GPT):
parted -s ./disk.img mklabel gpt mkpart '""' ext2 1 100M
Includes a new test for this feature.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
| |
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
| |
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed for libparted based applications (like Gparted) to correctly
choose MBR id and GPT GUID for UDF filesystem. MBR id for UDF is 0x07 and
GPT GUID is Microsoft Basic Data, see why: https://serverfault.com/a/829172
Without registering a new libparted fs code it is not possible to assign
MBR id or GPT GUID.
Detection of UDF filesystem is done by checking presence of UDF VSD (NSR02
or NSR03 identifier) and UDF AVDP at expected locations (blocks 256, -257,
-1, 512).
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The manual had long documented that negative values are
allowed for both start and end values, but until now negative
start values were rejected if FS-TYPE was not given.
Example:
# parted --script -a optimal /dev/loop0 -- mklabel gpt mkpart primary ext4 -5MiB 100%
(succeeds)
# parted --script -a optimal /dev/loop0 -- mklabel gpt mkpart primary -5MiB 100%
parted: invalid token: -5MiB
Error: Expecting a file system type.
This commit fixes the latter error.
The issue was an insufficient lookahead in command line parsing,
looking only for digits when skipping over FS-TYPE.
The fix is including the minus '-' in the lookahead.
Originally reported as Debian bug #880035:
"parted: fails to use negative start value for 'mkpart' command without specyfying FS-TYPE"
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880035
Signed-off-by: Niklas Hambüchen <mail@nh2.me>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace scanning the documentation for an incomplete list of flags with
querying libparted for the complete list of supported flags via the
added helper print-flags.
Correct $ME -> $ME_ in the warning messages. Improve the warning
messages by including the table type and flag name not correctly set or
cleared.
Plus minor changes:
(1) use slightly longer variable name primary_or_name;
(2) use longer test partition name PTNNAME; and
(3) stop shortening parted unit command to u.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
|
|
|
| |
The rescue command often failed to locate a filesystem due to it
leaving cylinder alignment on, which snapped the allowed bounds
of the filesystem down to the next lower cylinder boundary,
causing the detected filesystem to be rejected due to not fitting.
|
|
|
|
|
|
| |
parted tells the kernel the wrong length when reporting a resize of an
extended partition. Make sure the length is 2 for 512b sectors and 1
sector for larger.
|
|
|
|
|
|
| |
device-mapper uses 512b sector units, not device specific sector sizes.
This test ensures that the correct partition size is created, no matter
what the device's sector size is.
|
|
|
|
| |
a lot of TODOs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
make distcheck was failing because these scripts were not being
included.
Make them both executable and and add the path to the tests that use
them. They also need to be included in the distribution so update
Makefile.am
* tests/Makefile.am: Add python test scripts
* tests/gpt-header-move.py: rename to gpt-header-move and make it
executable
* tests/msdos-overlap.py: rename to overlap.py
* tests/t0282-gpt-move-backup.sh: add path to scripts and use new name
* tests/t0283-overlap-partitions.sh: same
|
|
|
|
| |
Verify previous fixes to loop labels.
|
|
|
|
|
|
|
|
| |
"libparted: avoid disturbing partitions" put the remove of the old
partition in second pass. If you simultaneously removed partitions 1
and 2, and created a new partition #1 that overlapped the previous second
partition, the sync would fail because it would try to create the new,
larger partition #1 before removing the old partition #2.
|
|
|
|
| |
* tests/t6005-dm-uuid.sh: Make sure dm UUIDs are not erased
|
|
|
|
|
| |
* tests/t6004-dm-many-partitions.sh: Make sure > 17 partitions appear in
device mapper.
|
|
|
|
|
|
|
|
|
|
|
| |
gpt.c was simply truncating the UTF-16 characters stored
in the partition name field to 8 bits. This corrupted non
ascii characters which later resulted in parted crashing in
strlist.c trying to convert the now invalid multi byte
characters to wchar.
gpt.c will now properly convert the UTF-16 to the current
locale encoding.
|
|
|
|
|
|
|
| |
Partitions that overlap or extend beyond the end of the disk are common
errors that usually result in people having to use other tools to correct
because parted refuses to operate when it sees them. Change these errors
to allow you to ignore them and use parted to correct the problem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are two checks for problems with the end of disk. The first checks
to make sure that the backup gpt is actually at the end of the disk as it
should be. The second checks to see that the gpt's idea of where the disk
ends is correct. The handling of the backup gpt location was wrong because
if you chose not to fix the error, then as soon as you made any changes the
backup would be written to the end of the disk anyhow, only the previous
backup would not be zeroed.
This patch fixes the write path to put the backup gpt where the gpt says
it goes, not where we think the disk ends. This allows you to choose
not to fix the problems, and the backup gpt will be written to the same
place it was before, not the new end of disk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were probing every dm device. Only probe dmraid whole disk
(non-partition) devices instead. This removes the clutter of
LVM logical volumes, and dmraid partitions from the list, which
usually do not make sense to partition.
* NEWS (Changes in behavior): Mention it.
* libparted/arch/linux.c (_is_dmraid_device): New function.
(_dm_is_part): Likewise.
(_probe_dm_devices): Use the latter.
* tests/t6003-dm-hide.sh: New test.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
|
|
| |
The device-mapper partition sync code was still using the remove all
partitions, then add new partitions method. Refactor to use the same
algorithm as regular disks: try to remove all, and ignore any that could
not be removed but have not changed.
|
|
|
|
|
|
|
|
| |
* tests/Makefile.am (TESTS_ENVIRONMENT): Rename from
AM_TESTS_ENVIRONMENT, since it is not honored in automake-1.11.3
after all. This reverts commit v3.1-14-g2bd66d7. For now, I'll
leave the following commit that made bootstrap.conf require 1.11.2.
Prompted by a report of test failure from Phillip Susi.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use warn_ and $ME_ in place of warn and $ME; remove definitions of
the latter two. Remove unused code.
* tests/lvm-utils.sh: Remove file. All functions were either unused
or duplicated/better in t-lvm.sh.
* tests/Makefile.am (EXTRA_DIST): Remove it.
* tests/t-local.sh (scsi_debug_setup_): Use echo 1>&2, not warn_, to
emit to log file only, not console. The diagnostic it emitted (in
verbose mode) was more "informational" than a warning.
* tests/t9030-align-check.sh: Use warn_, not warn.
* tests/t-lvm.sh: Likewise, and use fail_, not error (undefined!).
* tests/t-lib-helpers.sh (device_mapper_required_): Use t-lvm.sh
and an explicit lvm_init_root_dir_ in place of lvm-utils.sh.
|
|
|
|
|
| |
* tests/t0350-mac-PT-increases-sector-size.sh: New test.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
| |
* tests/t0203-gpt-create-on-min-sized-device.sh: New test.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
|
|
|
|
|
|
| |
Probably a copy&paste errors, likely from the TESTS_ENVIRONMENT
definition in the 'tests/Makefile.am' in GNU coreutils.
* tests/Makefile.am (AM_TESTS_ENVIRONMENT): Don't define nor export
any of the variables PREFERABLY_POSIX_SHELL, REPLACE_GETCWD, CC,
MAKE, PERL.
Copyright-paperwork-exempt: yes
|
|
|
|
|
|
|
|
|
| |
The latter should be reserved for user overrides.
* tests/Makefile.am (TESTS_ENVIRONMENT): Rename ...
(AM_TESTS_ENVIRONMENT): ... like this.
Copyright-paperwork-exempt: yes
|
|
|
|
|
|
|
|
| |
Make sure parted checks the PMBR before the GPT partition table.
* NEWS: Update with new GPT behavior.
* tests/overwrite-gpt-pmbr.sh: New test.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
|
|
| |
* tests/t3000-resize-fs.sh: New test.
* tests/Makefile.am (TESTS): Add it.
(check_PROGRAMS): Add fs-resize.
(fs_resize_LDADD): Define, so it links with both libraries.
|
|
|
|
|
| |
* tests/Makefile.am (PARTED_TEST_NAME): Define.
* tests/t0211-gpt-rewrite-header.sh: Clarify a comment.
|
|
|
|
|
|
| |
* tests/t0209-gpt-pmbr_boot.sh: New test
* tests/Makefile.am: Add new test
* NEWS: Add information about the GPT PMBR pmbr_boot flag
|
|
|
|
|
| |
* tests/t0212-gpt-many-partitions.sh: New test.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
| |
* tests/Makefile.am (TESTS): Add it.
* tests/t0211-gpt-rewrite-header.sh: New test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The msdos partition table claimed a maximum partition count of 16
but would allow you to go beyond that. This resulted in the kernel
not being informed of those partitions. Corrected to enforce the
limit.
* NEWS (Bug fixes): Mention it.
* libparted/labels/dos.c (next_primary): Return -1 upon failure.
(next_logical): Stop no later than MAX_TOTAL_PART.
Throw exception and return -1 upon failure.
(msdos_partition_enumerate): Convert a negative partition number
return value from either of the above two to failure (return 0).
* tests/t9042-dos-partition-limit.sh: New file.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
everywhere, for those who perform non-srcdir builds from a pristine
cloned directory. There is no problem when building from a tarball,
since that includes include/parted/*.h files under $(top_srcdir).
* libparted/Makefile.am: Insert it.
* libparted/fs/Makefile.am: Likewise.
* libparted/labels/Makefile.am: Likewise.
* libparted/tests/Makefile.am: Likewise.
* parted/Makefile.am: Likewise.
* partprobe/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Putting a valid GPT-labeled image on a smaller device, (i.e., one that
truncates the backup GPT header, but that does not impact the primary
one) should not render the primary header invalid.
* libparted/labels/gpt.c (_header_is_valid): Do *not* reject a header
when its last_usable value is larger than the device length.
This reverts part of commit v3.0-10-g99f9c6a, "gpt: don't abort for a
truncated GPT-formatted device". With this change, running parted in
interactive mode with such an image/device combination will recognize
that only the backup header is corrupt, and will offer to correct it.
Before, it would report that both headers were corrupt.
* tests/t0203-gpt-shortened-device-primary-valid.sh: New file.
* tests/Makefile.am (TESTS): Add it.
|
|
|
|
|
|
|
|
| |
Device mapper type should not automatically
mean add 'p' before the partition number. Fall back to
adding it only if the previous character is a digit.
This complies with kpartx behavior and linux behavior
"since the dawn of time".
|
|
|
|
|
| |
* tests/t6100-mdraid-partitions.sh: New file.
* tests/Makefile.am: Run this test.
|
|
|
|
|
|
|
|
|
| |
Simply zeroing out the total_blocks and block_size members of the
on-disk _HfsMasterDirectoryBlock would provoke a failed assertion
any time parted tried to probe that partition.
* tests/t2500-probe-corrupt-hfs.sh: New script.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention this.
|
|
|
|
|
|
| |
* tests/t0210-gpt-resized-partition-entry-array.sh: New file.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add gpt-header-munge.
|
|
|
|
|
|
|
| |
* tests/duplicate.c: New test.
* tests/t0501-duplicate.sh: New test program.
* tests/Makefile.am (TEST): Add new test.
(check_PROGRAMS): Add new test program.
|
|
|
|
|
| |
* tests/t0208-mkpart-end-in-IEC.sh: New file.
* tests/Makefile.am: Add it.
|
|
|
|
|
| |
* tests/t2201-pc98-label-recog.sh: New file
* tests/Makefile.am: Add test
|
|
|
|
|
|
|
|
| |
* tests/Makefile.am (TESTS_ENVIRONMENT): Redirection with `exec 9>&2'
is not portable to various Korn shells, and to (at least) HP-UX 11
/bin/sh. Use a more portable idiom.
See <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488> for
lots of discussion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test scripts in tests/ are shell scripts, so the current
definition of TESTS_ENVIRONMENT, which adaptively run tests using
either perl or the shell depending on their kind, is overkill.
Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in late alpha state).
See also related discussion on bug-coreutils:
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8887>
* tests/help-version: Moved ...
* tests/help-version.sh: ... to this.
* tests/Makefile.am (TESTS): Update.
(TESTS_ENVIRONMENT): Remove definition of the `shell_or_perl_' shell
function, which is not required anymore.
(SH_LOG_COMPILER): New, define to `$(SHELL)'.
|