- recommend chkdsk /f if mapping pairs decoding fails with EIO (Kent B. Larsen)
- use corrupt_volume_msg in all relevant cases - explain "bad sectors" a bit better (Logical change 1.342)edge.strict_endians
parent
f6fa31b6b0
commit
8f77300f3a
|
|
@ -69,8 +69,15 @@ static const char *resize_important_msg =
|
||||||
|
|
||||||
static const char *invalid_ntfs_msg =
|
static const char *invalid_ntfs_msg =
|
||||||
"Apparently device '%s' doesn't have a valid NTFS.\n"
|
"Apparently device '%s' doesn't have a valid NTFS.\n"
|
||||||
"Maybe you selected the wrong partition or the whole disk\n"
|
"Maybe you selected the wrong partition? Or the whole disk instead of a\n"
|
||||||
"instead of a partition (e.g. /dev/hda, not /dev/hda1)?\n";
|
"partition (e.g. /dev/hda, not /dev/hda1)? This error might also occur\n"
|
||||||
|
"if the disk was incorrectly repartitioned (see the ntfsresize FAQ).\n";
|
||||||
|
|
||||||
|
static const char *corrupt_volume_msg =
|
||||||
|
"Apparently you have a corrupted NTFS. Please run the filesystem checker\n"
|
||||||
|
"on Windows by invoking chkdsk /f. Don't forget the /f (force) parameter,\n"
|
||||||
|
"it's important! You probably also need to reboot Windows to take effect.\n"
|
||||||
|
"Then you can try ntfsresize again. No modification was made to your NTFS.\n";
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int verbose;
|
int verbose;
|
||||||
|
|
@ -610,7 +617,8 @@ static void collect_shrink_constraints(ntfs_resize_t *resize, runlist *rl)
|
||||||
if ((ret = has_bad_sectors(resize)) != 0) {
|
if ((ret = has_bad_sectors(resize)) != 0) {
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
perr_exit("Couldn't convert string to Unicode");
|
perr_exit("Couldn't convert string to Unicode");
|
||||||
err_exit("Device has bad sectors, not supported yet.\n");
|
err_exit("Your disk has bad sectors (manufacturing faults or "
|
||||||
|
"dying disk).\nThis situation isn't supported yet.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NInoAttrList(resize->ni)) {
|
if (NInoAttrList(resize->ni)) {
|
||||||
|
|
@ -727,8 +735,14 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize)
|
||||||
if (!a->non_resident)
|
if (!a->non_resident)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL)))
|
if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) {
|
||||||
perr_exit("ntfs_decompress_mapping_pairs");
|
int err = errno;
|
||||||
|
perr_printf("ntfs_decompress_mapping_pairs");
|
||||||
|
if (err == EIO)
|
||||||
|
printf(corrupt_volume_msg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; rl[i].length; i++) {
|
for (i = 0; rl[i].length; i++) {
|
||||||
s64 lcn = rl[i].lcn;
|
s64 lcn = rl[i].lcn;
|
||||||
|
|
@ -855,11 +869,10 @@ static void compare_bitmaps(struct bitmap *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mismatch) {
|
if (mismatch) {
|
||||||
printf("Totally %d cluster accounting mismatches.\n",
|
err_printf("Filesystem check failed! Totally %d cluster "
|
||||||
mismatch);
|
"accounting mismatches.\n", mismatch);
|
||||||
err_exit("Filesystem check failed! Windows wasn't shutdown "
|
printf(corrupt_volume_msg);
|
||||||
"properly or inconsistent\nfilesystem. Please run "
|
exit(1);
|
||||||
"chkdsk /f on Windows.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1886,8 +1899,7 @@ static void mount_volume(void)
|
||||||
if (err == EINVAL)
|
if (err == EINVAL)
|
||||||
printf(invalid_ntfs_msg, opt.volume);
|
printf(invalid_ntfs_msg, opt.volume);
|
||||||
else if (err == EIO)
|
else if (err == EIO)
|
||||||
printf("Apparently you have a corrupted volume. "
|
printf(corrupt_volume_msg);
|
||||||
"Please run chkdsk /f and try again!\n");
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2045,11 +2057,10 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
walk_inodes(&resize);
|
walk_inodes(&resize);
|
||||||
if (resize.multi_ref) {
|
if (resize.multi_ref) {
|
||||||
printf("Totally %d clusters referenced multiply times.\n",
|
err_printf("Filesystem check failed! Totally %d clusters "
|
||||||
resize.multi_ref);
|
"referenced multiply times.\n", resize.multi_ref);
|
||||||
err_exit("Filesystem check failed! Windows wasn't shutdown "
|
printf(corrupt_volume_msg);
|
||||||
"properly or inconsistent\nfilesystem. Please run "
|
exit(1);
|
||||||
"chkdsk /f on Windows.\n");
|
|
||||||
}
|
}
|
||||||
compare_bitmaps(&lcn_bitmap);
|
compare_bitmaps(&lcn_bitmap);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue