From ba810877ca358ef27b50d93994a2ee66a4a8f90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Thu, 25 May 2017 10:28:05 +0200 Subject: [PATCH] Bypassed cluster allocation errors using --ignore-fs-check in ntfsclone When using option --ignore-fs-check in ntfsclone, doubly allocated cluster still lead to aborting the process. Bypassing the error is useful for creating a metadata image intended for debugging, for example when the partition was not closed properly and the logfile has to be applied to restore the integrity of metadata. --- ntfsprogs/ntfsclone.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 60264c9d..e161d1d1 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -3,7 +3,7 @@ * * Copyright (c) 2003-2006 Szabolcs Szakacsits * Copyright (c) 2004-2006 Anton Altaparmakov - * Copyright (c) 2010-2016 Jean-Pierre Andre + * Copyright (c) 2010-2017 Jean-Pierre Andre * Special image format support copyright (c) 2004 Per Olofsson * * Clone NTFS data and/or metadata to a sparse file, image, device or stdout. @@ -1711,10 +1711,17 @@ static void walk_runs(struct ntfs_walk_cluster *walk) for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; - if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) - err_exit("Cluster %llu referenced twice!\n" - "You didn't shutdown your Windows " - "properly?\n", (unsigned long long)k); + if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) { + if (opt.ignore_fs_check) + Printf("Cluster %llu is referenced" + " twice!\n", + (unsigned long long)k); + else + err_exit("Cluster %llu referenced" + " twice!\nYou didn't shutdown" + " your Windows properly?\n", + (unsigned long long)k); + } } if (!opt.metadata_image)