summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
Commit message (Collapse)AuthorAgeFilesLines
* Ensure kernel is informed when a DOS partition table is cleared.Martin Whitaker2017-03-141-1/+6
| | | | | | | diskdrake allows the user to clear all partitions even when some of those partitions are currently mounted. partition_table::dos::need_to_tell_kernel() must return true in this case, as the automatic reread of the partition table triggered by udevd will fail.
* When writing a GPT partition table, merge all actions into a single commit.Martin Whitaker2017-03-141-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids unnecessary udev events, which in some cases were causing udevd to trigger a kernel partition table reread, causing the kernel to get out of sync with drakx. In order to do so, the libparted bindings are enhanced so that we manipulate a 'ped_disk' object: - disk_open() returns such an object - set_disk_type() is removed - disk_commit() writes back the partition table and tell the kernel about it if we fails to write the partition table, we let partition_table::write() fire an exceptionc if we only have succeed in writing the partition table, we let partition_table::write() try harder (umounting partitions before trying againt to tell the kernel again) - need_to_tell_kernel() is overrided The last change is needed because we now tell the kernel about the new partition layout in partition_table::gpt::write() when calling disk_commit() while previously we were deferring that to partition_table::write() which after having called the gpt's write() calls tell_kernel() -> c::tell_kernel_to_reread_partition_table() So we must tell partition_table::write() that telling the kernel to reread the partition_table is not needed if we already succeeded in that.
* Remove redundant code when initialising a partition table.Martin Whitaker2017-03-141-6/+0
| | | | | | Now we force the kernel to reread the partition table when we initialise it, there's no need to also inform it that we've deleted all the existing partitions.
* Revised fix for clearing GPT partitions during automatic install.Martin Whitaker2017-03-141-5/+2
| | | | | | | | | | | | | | | | This reverts commit 532fd1d60df306e204bae79c5158ca2302739966, which introduced a new bug when clearing GPT partitions in an interactive session (mga#20264), and replaces it with a new solution. When a partition table is initialised, we now add an 'init' action to the $hd->{will_tell_kernel} list. This is used both by gpt::write() (to clear the partition table) and by partition_table::tell_kernel() (to force the kernel to reread the partition table). Previous changes stored in $hd->{will_tell_kernel} are discarded, as they are no longer of interest. This also removes support for the will_tell_kernel 'force_reboot' action, as nothing uses that any more.
* make "(add, " messages end in logsThierry Vignaud2017-03-061-1/+1
| | | | | rather than lost on console printf() was introduced in commit 9e6b327ca2b1f46db62e0811fabf0a6cf0b114a7
* Always tell the kernel about partition table changes when running the ↵Martin Whitaker2017-02-251-4/+8
| | | | | | | | classic installer (mga#20074). The automatic rescan of the partition table is triggered by udevd. The udev rule that causes this is not present on the cut-down system that runs the classic installer.
* Preserve DOS "Empty" partitions instead of treating them as free space ↵Martin Whitaker2017-02-251-0/+1
| | | | | | | | | (mga#20074). To minimise the changes this close to mga6 release (and until we fix the bug in partition auto-allocation that mistakenly creates BIOS boot partitions non-GPT disks), reuse the BIOS_GRUB flag for flagging Empty partitions, as the real partition ID (0x00) is used to flag free space.
* Don't tell the kernel about partition table changes when it rescans them ↵Martin Whitaker2017-02-252-0/+14
| | | | | | | | | | | | | | | automatically (mga#20074). When no partitions on a DOS-partitioned disk are mounted, the kernel automatically rescans the partition table when it is written to disk. We shouldn't then try to update the kernel's view of the partition table, as the list of deltas we have recorded is relative to the previous state of the partition table, not the newly rescanned state. The behaviour for other partition table types is unchanged. v2 (tvignaud): just make base class assume the kernel doesn't reread, only mbr subclass overrides need_to_tell_kernel() in order to be smarter
* Ensure the kernel doesn't rescan a partially written partition table ↵Martin Whitaker2017-02-256-8/+32
| | | | | | | | | | | | | | | | | | | (mga#20074). When no partitions on a DOS-partitioned disk are mounted, the kernel automatically rescans the partition table when the file handle to the raw device is released. Currently the code opens and closes the raw device when writing the primary partition table and when writing each extended partition table segment. As the extended partition table segments form a linked list, this allows the kernel to get in and rescan the table when the list is not in a coherent state. This patch changes the code to open the raw device before writing the primary partition table and to close it only after writing the last extended partition table segment. The behaviour for other partition table types is unchanged. v2 (tvignaud): simplify by moving copies of noop funcs into the base class
* first usable sector is LBA34 for GPTThierry Vignaud2016-07-311-0/+2
| | | | | | | | same rationale as in commit 767048570e8c44061cb0d6faf689698d3313870c for mga#18666 this wasn't an issue as we later round partition on 1MB boundary but it's still cleaner/safer...
* sync libparted view with diskdrake oneThierry Vignaud2016-07-121-0/+5
| | | | | | | | | in order to prevent overlapping errors when adding partitions: (b/c libparted doesn't know that diskdrake already removed the partitions in its memory view) "failed to add partition #1 on /dev/vda" "Error: Can't have overlapping partitions." "add_partition failed"
* (initialize) simplifyThierry Vignaud2016-07-081-5/+2
|
* prevent GPT partition to use the 33 last sectorsThierry Vignaud2016-07-051-0/+6
| | | | Resolves: mga#18666, mga#17796
* kill big unused hash of GUIDsThierry Vignaud2016-07-051-89/+1
| | | | basically reverting: commit 36c2fc004bf445ff784bde423ba7aa27885539f8
* kill a bogus FIXME noteThierry Vignaud2016-06-301-1/+0
|
* add a GRUB_BIOS partitions if needed (mga#18656)Thierry Vignaud2016-06-111-1/+2
|
* detect GRUB_BIOS partitions (mga#18656)Thierry Vignaud2016-06-111-0/+4
| | | | let's abuse ->{pt_type} for tracking such partitions
* fix path in commentThierry Vignaud2015-12-241-1/+1
|
* prevent errors when telling kernel to reread partsThierry Vignaud2015-06-131-0/+3
| | | | | | disk_{add,del}_partition call ped_disk_commit() which result in udev events (and also already tell the kernel to reread the partition table (several times))
* set pt_type according to fs_type before flag cases (mga#16029)Thierry Vignaud2015-05-241-5/+5
|
* display cosmetics when reading back GPTThierry Vignaud2015-05-201-0/+6
| | | | | let's diskdrake show the same types as for MBR partitions. to be cleaned once we switch to libparted for everything...
* prefer 'fat32' over 'fat16'Thierry Vignaud2015-05-201-0/+2
| | | | | not that important as we do the format/..., we only rely on libparted for writing the partition table & setting the GUID, but just in case...
* libparted: map 'fat32' to 'vfat' (mga#15987)Thierry Vignaud2015-05-201-0/+2
| | | | | | | fix fs returned by libparted thus fixing mount point for FAT partitions on GTP (mga#15987) this also fix setting the proper GUID for FAT partitions on GPT
* simplifyThierry Vignaud2015-05-201-4/+8
| | | | needed for next commit
* Speed up reading of flags from GPT partition table.Martin Whitaker2015-04-191-4/+4
| | | | | | | | On some machines, calls to ped_disk_new() in libparted take of the order of seconds, so doing this for each flag and partition in turn makes partition_table::gpt::read_one take an inordinate amount of time (mga#15621). Instead, collect the flags during the call to c::get_disk_partitions.
* really try to detect recovery partitions on GPTThierry Vignaud2015-04-031-1/+1
| | | | fix "set_partition_flag: unknown type: recovery" (mga#15621)
* try to detect recovery partitions on GPTThierry Vignaud2015-03-301-0/+2
|
* better fix for too corrupted partition tableThierry Vignaud2015-03-301-1/+1
|
* fix retrieving ntfs partitions s/ntfs/ntfs-3g/Thierry Vignaud2015-03-271-0/+1
|
* really fix retrieving swap partition typeThierry Vignaud2015-03-271-1/+1
| | | | Thomas rushed to push before I run perl_checker... :-(
* fix failing to read partition table (mga#13592, mga#15272)Thierry Vignaud2015-03-271-1/+2
| | | | | | this is making it more readable regarding: "I cannot read the partition table of device XXX, it is too corrupted" (mga#13592, mga#15272, mga#15472)
* fix fs_type returned by libparted for swapsThierry Vignaud2015-03-271-0/+1
|
* log which type is unknownThierry Vignaud2015-03-271-1/+1
|
* fix tagging LVM/raid as "linux filesystem" with GPTThierry Vignaud2015-03-271-2/+10
|
* fix tagging ntfs-3g as "linux filesystem" with GPTThierry Vignaud2015-03-271-0/+1
| | | | libparted needs it to be named like this in order to put the right
* fix tagging swap as "linux filesystem" with GPTThierry Vignaud2015-03-271-0/+1
| | | | | libparted needs it to be named like this in order to put the right GUID...
* fix retrieving LVM/RAID partition typeThierry Vignaud2015-03-271-0/+4
| | | | simimar to commit ee22664bcb1fdedece15e07d047ba86f3d791ee6
* make it more genericThierry Vignaud2015-03-271-1/+1
| | | | just bind the libparted function (needed for next commit)
* perl_checker cleanupThierry Vignaud2015-03-251-1/+1
|
* log which partition we fail to addThierry Vignaud2015-03-251-2/+2
|
* set proper GUID to ESP partitions with GPT layoutThierry Vignaud2015-03-251-1/+6
|
* fix retrieving ESP partition typeThierry Vignaud2015-03-251-1/+5
| | | | | | | | | ESP are the only partitions we're detecting through their pt_type (modulo 0x12 which was Compaq Diagnostic & unlikely to be found on GPT...) However GPT has no equivalent to pt_type But we can test for ESP flag
* use a proper interface between parted/perl worldsThierry Vignaud2015-03-251-11/+2
| | | | | | | | | | | | | create directly the hash in XS instead of instead of sprintf()ing it into a string which was then parsed in perl in order to actually create the hash this fixes several issues: - due to adding some fields to the string under if (), we could silently have ignored some partitions - this also simplifies adding further fields
* fix retrieving partitionThierry Vignaud2015-03-251-2/+2
| | | | | | | needed for next commit also we were passing '' as fs_type to c::disk_add_partition() $part was undef since commit 9e6b327ca2b1f46db62e0811fabf0a6cf0b114a7
* Do not try to delete partitions if the partition table was overwrittenPascal Terjan2015-02-041-1/+4
|
* perl_checker cleanupThierry Vignaud2015-02-041-1/+1
|
* Fix partition number in GPT for empty disksPascal Terjan2015-02-031-1/+2
|
* Fix GPT initialization on empty diskPascal Terjan2015-02-031-1/+5
|
* add GPT partition GUID tableThomas Backlund2014-12-221-0/+90
|
* kill $Id:$ tagsThierry Vignaud2014-06-0710-10/+10
| | | | they're obsolete since switching from CVS/SVN to git...