From ddd32a5cd387bb029553403fe12904a975cf20c5 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 20 Aug 2014 21:16:25 +0200 Subject: [PATCH] installer: Make umounting more reliable --- src/installer/hw.c | 3 +++ src/installer/main.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/installer/hw.c b/src/installer/hw.c index f29db82f1..0e65ae969 100644 --- a/src/installer/hw.c +++ b/src/installer/hw.c @@ -779,6 +779,9 @@ int hw_mount_filesystems(struct hw_destination* dest, const char* prefix) { } int hw_umount_filesystems(struct hw_destination* dest, const char* prefix) { + // Write all buffers to disk before umounting + hw_sync(); + // boot if (*dest->part_boot) { hw_umount(dest->part_boot); diff --git a/src/installer/main.c b/src/installer/main.c index c5adb0adf..313b35180 100644 --- a/src/installer/main.c +++ b/src/installer/main.c @@ -637,6 +637,13 @@ int main(int argc, char *argv[]) { mysystem(logfile, commandstring); } + // Umount the destination drive + hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH); + + // Stop the RAID array if we are using RAID + if (destination->is_raid) + hw_stop_all_raid_arrays(logfile); + // Umount source drive and eject hw_umount(SOURCE_MOUNT_PATH); @@ -671,13 +678,7 @@ EXIT: free(helpline); free(sourcedrive); - - if (destination) { - hw_sync(); - - hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH); - free(destination); - } + free(destination); hw_stop_all_raid_arrays(logfile);