Bug#283303: [sparc] partman breaks the partition table when swap partition is first on the disk
Hello,
As previously noted (see bug trail), this failure is due to the
CREATE_FILE_SYSTEM call to the parted server. I've tried to figure out why
it fails. For that I've compared the function for filesystem creation in
parted_server (command_create_file_system() in parted_server.c of partman
package) and in parted (do_mkfs() in parted/parted.c of parted package).
The functions are nearly identical, except for one essential difference:
the do_mkfs() function (which actually works) calls ped_file_system_close()
on the newly created filesystem and ped_disk_commit() on the disk, where
the filesystem was created. The parted_server's function does NOT do that.
So, as experiment, I've modified it, according to the patch below:
--- partman-61/parted_server.c 2004-09-28 20:08:40.000000000 -0400
+++ partman/parted_server.c 2004-12-12 21:22:43.975091672 -0500
@@ -1621,7 +1621,10 @@
critical_error("Bad file system type: %s", s_fstype);
ped_partition_set_system(part, fstype);
deactivate_exception_handler();
- fs = timered_file_system_create(&(part->geom), fstype);
+ if ((fs = timered_file_system_create(&(part->geom), fstype)) != NULL) {
+ ped_file_system_close(fs);
+ ped_disk_commit(disk);
+ }
activate_exception_handler();
oprintf("OK\n");
if (fs != NULL)
This change appeared to be a step in the right direction, but not
sufficient to solve the problem. With this patch applied the partman would
actually hang when committing changes to disk, because all the 50format-*
scripts in /var/lib/partman try to enable swap. Once swap (which is
formatted first) is activated, the ped_disk_commit() operation cannot be
performed, as it requires all the partitions on the disk in question not
to be in use. To work around that I have removed enable_swap command from
the following files:
/lib/partman/commit.d/50format_basicfilesystems
/lib/partman/commit.d/50format_ext3
/lib/partman/commit.d/50format_jfs
/lib/partman/commit.d/50format_reiserfs
/lib/partman/commit.d/50format_xfs
and added a file /lib/partman/commit.d/99enable_swap with contents
#!/bin/sh
. /lib/partman/definitions.sh
enable_swap
With all these changes the partitions were created correctly and swap got
activated. Unfortunately (thanks to Thiemo Seufer for pointing it out),
that's not a very good idea, since on low-memory systems swap is really
required to perform the filesystem formatting.
Best regards,
Jurij Smakov jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC
Reply to: