Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted partition is broken and recognized as a NTFS partition on linux #32

Open
keuin opened this issue Sep 27, 2021 · 9 comments
Open

Comments

@keuin
Copy link

keuin commented Sep 27, 2021

Hello, thanks for your promising work! I have converted a partition (the one in the previous issue) into Btrfs using this tool. The converted partition was recognized as Btrfs in Windows with the Winbtrfs driver. However, Linux says that it is a NTFS partition and some errors were found by btrfsck:

keuin@keuin-galaxy-ng:~$ sudo btrfsck /dev/sdd1
Opening filesystem to check...
Checking filesystem on /dev/sdd1
UUID: 7b7c8a67-b0d3-a95c-6512-3a7e44f24caf
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
cache and super generation don't match, space cache will be invalidated
[4/7] checking fs roots
root 5 inode 81055 errors 1, no inode item
root 5 inode 81110 errors 1, no inode item
root 5 inode 81158 errors 1, no inode item
root 5 inode 81213 errors 1, no inode item
root 5 inode 81266 errors 1, no inode item
root 5 inode 81321 errors 1, no inode item
root 5 inode 81373 errors 1, no inode item
root 5 inode 81430 errors 1, no inode item
root 5 inode 81482 errors 1, no inode item
root 5 inode 81532 errors 1, no inode item
root 5 inode 81584 errors 1, no inode item
root 5 inode 81639 errors 1, no inode item
root 5 inode 81695 errors 1, no inode item
root 5 inode 81751 errors 1, no inode item
root 5 inode 81804 errors 1, no inode item
root 5 inode 81863 errors 1, no inode item
root 5 inode 81918 errors 1, no inode item
root 5 inode 81973 errors 1, no inode item
root 5 inode 82028 errors 1, no inode item
root 5 inode 82083 errors 1, no inode item
root 5 inode 82139 errors 1, no inode item
root 5 inode 82190 errors 1, no inode item
root 5 inode 82242 errors 1, no inode item
root 5 inode 82293 errors 1, no inode item
root 5 inode 82347 errors 1, no inode item
root 5 inode 82399 errors 1, no inode item
root 5 inode 82451 errors 1, no inode item
root 5 inode 82505 errors 1, no inode item
root 5 inode 82560 errors 1, no inode item
root 5 inode 82617 errors 1, no inode item
root 5 inode 82672 errors 1, no inode item
root 5 inode 82723 errors 1, no inode item
root 5 inode 82778 errors 1, no inode item
root 5 inode 82831 errors 1, no inode item
root 5 inode 82884 errors 1, no inode item
root 5 inode 82937 errors 1, no inode item
ERROR: errors found in fs roots
found 3096923078656 bytes used, error(s) found
total csum bytes: 3020416752
total tree bytes: 4016324608
total fs tree bytes: 388022272
total extent tree bytes: 189415424
btree space waste bytes: 366564742
file data blocks allocated: 6154863652864
 referenced 6154863652864

fdisk -l says:

Disk /dev/sdd: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD40EJRX-89A
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: B59B6CA3-DFC4-4811-ABEF-86C4183103A8

Device     Start        End    Sectors  Size Type
/dev/sdd1   2048 7814035455 7814033408  3.6T Microsoft basic data

Windows reported that this partition was not a NTFS one, but Linux did. This is weird.

Before converting, I have ran CHKDSK /F to ensure the integrity and it reported no errors. Since btrfsck --repair is highly discouraged by many instructions available on the Internet, I did not run that. I have no idea if this is a bug of ntfs2btrfs.

By the way, this partition was previously Bitlocker encrypted and had been decrypted before converting. Is this a potential issue? I can help with further inspection.

@keuin
Copy link
Author

keuin commented Sep 27, 2021

As a complementary, here is what dmesg reported after running mount:

[   64.166890] BTRFS info (device sdd1): has skinny extents
[   65.548597] BTRFS critical (device sdd1): corrupt leaf: root=2 block=1489133600768 slot=176 bg_start=4000763084800 bg_len=23003136, invalid block group used, have 23064576 expect [0, 23003136)
[   65.548602] BTRFS error (device sdd1): block=1489133600768 read time tree block corruption detected
[   65.548613] BTRFS error (device sdd1): failed to read block groups: -5
[   65.564421] BTRFS error (device sdd1): open_ctree failed

@maharmstone
Copy link
Owner

I have no idea if this is a bug of ntfs2btrfs.

Yes, it definitely is.

I suppose the first thing to find out is what's distinctive about those inodes in particular... Can you please rollback, install sleuthkit, and send me the output of the following?

istat /dev/sdd1 80798
istat /dev/sdd1 80853
istat /dev/sdd1 80901
istat /dev/sdd1 80956
istat /dev/sdd1 81009
istat /dev/sdd1 81064
istat /dev/sdd1 81116
istat /dev/sdd1 81173
istat /dev/sdd1 81225
istat /dev/sdd1 81275
istat /dev/sdd1 81327
istat /dev/sdd1 81382
istat /dev/sdd1 81438
istat /dev/sdd1 81494
istat /dev/sdd1 81547
istat /dev/sdd1 81606
istat /dev/sdd1 81661
istat /dev/sdd1 81716
istat /dev/sdd1 81771
istat /dev/sdd1 81826
istat /dev/sdd1 81882
istat /dev/sdd1 81933
istat /dev/sdd1 81985
istat /dev/sdd1 82036
istat /dev/sdd1 82090
istat /dev/sdd1 82142
istat /dev/sdd1 82194
istat /dev/sdd1 82248
istat /dev/sdd1 82303
istat /dev/sdd1 82360
istat /dev/sdd1 82415
istat /dev/sdd1 82466
istat /dev/sdd1 82521
istat /dev/sdd1 82574
istat /dev/sdd1 82627
istat /dev/sdd1 82680

(The NTFS inode numbers are 257 less than the Btrfs ones.)

@keuin
Copy link
Author

keuin commented Sep 28, 2021

I have no idea if this is a bug of ntfs2btrfs.

Yes, it definitely is.

I suppose the first thing to find out is what's distinctive about those inodes in particular... Can you please rollback, install sleuthkit, and send me the output of the following?

istat /dev/sdd1 80798
istat /dev/sdd1 80853
istat /dev/sdd1 80901
istat /dev/sdd1 80956
istat /dev/sdd1 81009
istat /dev/sdd1 81064
istat /dev/sdd1 81116
istat /dev/sdd1 81173
istat /dev/sdd1 81225
istat /dev/sdd1 81275
istat /dev/sdd1 81327
istat /dev/sdd1 81382
istat /dev/sdd1 81438
istat /dev/sdd1 81494
istat /dev/sdd1 81547
istat /dev/sdd1 81606
istat /dev/sdd1 81661
istat /dev/sdd1 81716
istat /dev/sdd1 81771
istat /dev/sdd1 81826
istat /dev/sdd1 81882
istat /dev/sdd1 81933
istat /dev/sdd1 81985
istat /dev/sdd1 82036
istat /dev/sdd1 82090
istat /dev/sdd1 82142
istat /dev/sdd1 82194
istat /dev/sdd1 82248
istat /dev/sdd1 82303
istat /dev/sdd1 82360
istat /dev/sdd1 82415
istat /dev/sdd1 82466
istat /dev/sdd1 82521
istat /dev/sdd1 82574
istat /dev/sdd1 82627
istat /dev/sdd1 82680

(The NTFS inode numbers are 257 less than the Btrfs ones.)

I rollbacked the partition to NTFS under Windows, and boot into Linux, ran these commands you've posted. It finished without any error. I saved the output into the attachment. File names in the output have been redacted for secrecy, and everything else has been kept intact.

istat_output.txt

@maharmstone
Copy link
Owner

Thanks - so they're all subdirectories of inode 80743. What does istat /dev/sdd1 80743 say? Its full path would also greatly help as well, even if you have to censor some parts of it (e.g. your username).

@keuin
Copy link
Author

keuin commented Sep 28, 2021

Thanks - so they're all subdirectories of inode 80743. What does istat /dev/sdd1 80743 say? Its full path would also greatly help as well, even if you have to censor some parts of it (e.g. your username).

Well, the report contains no file names and paths. They are pasted below with nothing changed:

root@keuin-galaxy-ng:~# istat /dev/sdd1 80743
MFT Entry Header Values:
Entry: 80743        Sequence: 1
$LogFile Sequence Number: 30286751200
Allocated Directory
Links: 1

$STANDARD_INFORMATION Attribute Values:
Flags:
Owner ID: 0
Security ID: 336  (S-1-5-21-4112952269-3451346006-675731645-1003)
Last User Journal Update Sequence Number: 151200120
Created:        2019-01-26 23:37:45.716354800 (HKT)
File Modified:  2019-01-26 23:38:00.015099400 (HKT)
MFT Modified:   2019-01-26 23:38:00.015099400 (HKT)
Accessed:       2020-06-01 20:14:58.525917400 (HKT)

$FILE_NAME Attribute Values:
Flags: Directory
Name: person
Parent MFT Entry: 80556         Sequence: 6
Allocated Size: 0       Actual Size: 0
Created:        2019-01-26 23:37:50.508577900 (HKT)
File Modified:  2019-01-26 23:37:50.508577900 (HKT)
MFT Modified:   2019-01-26 23:37:50.508577900 (HKT)
Accessed:       2019-01-26 23:37:50.508577900 (HKT)

Attributes:
Type: $STANDARD_INFORMATION (16-0)   Name: N/A   Resident   size: 72
Type: $FILE_NAME (48-2)   Name: N/A   Resident   size: 78
Type: $INDEX_ROOT (144-6)   Name: $I30   Resident   size: 56
Type: $INDEX_ALLOCATION (160-3)   Name: $I30   Non-Resident   size: 163840  init_size: 163840
362205832 362205833 362205834 362205835 362205836 362205837 362205838 362205839
362205840 362205841 362205842 362205843 362205844 362205845 362205846 362205847
362205848 362205849 362205850 362205851 362205852 362205853 362205854 362205855
362205856 362205857 362205858 362205859 362205860 362205861 362205862 362205863
362205864 362205865 362205866 362205867 362205868 362205869 362205870 362205871
Type: $BITMAP (176-4)   Name: $I30   Resident   size: 8

@maharmstone
Copy link
Owner

Under $FILE_NAME you'll see the inode of the parent directory - this is parent in directory 80556. If you repeat istat with this value, i.e. istat /dev/sdd1 80556, all the way up to the top (which is inode 5), you'll be able to give me the full path.

@keuin
Copy link
Author

keuin commented Sep 29, 2021

80556 gives:

root@keuin-galaxy-ng:~# istat /dev/sdd1 80556
MFT Entry Header Values:
Entry: 80556        Sequence: 6
$LogFile Sequence Number: 306093701
Allocated Directory
Links: 1

$STANDARD_INFORMATION Attribute Values:
Flags:
Owner ID: 0
Security ID: 336  (S-1-5-21-4112952269-3451346006-675731645-1003)
Last User Journal Update Sequence Number: 151126312
Created:        2019-01-26 23:37:45.458001400 (HKT)
File Modified:  2019-01-26 23:37:50.508577900 (HKT)
MFT Modified:   2019-01-26 23:37:50.508577900 (HKT)
Accessed:       2020-06-01 20:14:58.426827500 (HKT)

$FILE_NAME Attribute Values:
Flags: Directory
Name: data
Parent MFT Entry: 18    Sequence: 18
Allocated Size: 0       Actual Size: 0
Created:        2019-01-26 23:37:48.725100100 (HKT)
File Modified:  2019-01-26 23:37:48.725100100 (HKT)
MFT Modified:   2019-01-26 23:37:48.725100100 (HKT)
Accessed:       2019-01-26 23:37:48.725100100 (HKT)

Attributes:
Type: $STANDARD_INFORMATION (16-0)   Name: N/A   Resident   size: 72
Type: $FILE_NAME (48-2)   Name: N/A   Resident   size: 74
Type: $INDEX_ROOT (144-1)   Name: $I30   Resident   size: 440

And its parent, 18, gives:

root@keuin-galaxy-ng:~# istat /dev/sdd1 18
MFT Entry Header Values:
Entry: 18        Sequence: 18
$LogFile Sequence Number: 335889976
Allocated Directory
Links: 1

$STANDARD_INFORMATION Attribute Values:
Flags:
Owner ID: 0
Security ID: 336  (S-1-5-21-4112952269-3451346006-675731645-1003)
Last User Journal Update Sequence Number: 151124344
Created:        2019-01-26 23:37:45.442320800 (HKT)
File Modified:  2019-01-26 23:38:00.032916800 (HKT)
MFT Modified:   2019-01-26 23:38:00.032916800 (HKT)
Accessed:       2020-06-09 13:38:49.602679300 (HKT)

$FILE_NAME Attribute Values:
Flags: Directory
Name: zhao-master
Parent MFT Entry: 5     Sequence: 5
Allocated Size: 0       Actual Size: 0
Created:        2019-01-26 23:37:48.678320000 (HKT)
File Modified:  2019-01-26 23:37:48.678320000 (HKT)
MFT Modified:   2019-01-26 23:37:48.678320000 (HKT)
Accessed:       2019-01-26 23:37:48.678320000 (HKT)

Attributes:
Type: $STANDARD_INFORMATION (16-0)   Name: N/A   Resident   size: 72
Type: $FILE_NAME (48-2)   Name: N/A   Resident   size: 88
Type: $INDEX_ROOT (144-1)   Name: $I30   Resident   size: 536

And its parent, 5, gives:

root@keuin-galaxy-ng:~# istat /dev/sdd1 5
MFT Entry Header Values:
Entry: 5        Sequence: 5
$LogFile Sequence Number: 32615924453
Allocated Directory
Links: 1

$STANDARD_INFORMATION Attribute Values:
Flags: Hidden, System
Owner ID: 0
Security ID: 0  ()
Last User Journal Update Sequence Number: 12660736
Created:        2018-06-27 17:03:34.014478800 (HKT)
File Modified:  2021-09-26 10:54:15.016702000 (HKT)
MFT Modified:   2021-09-26 10:54:15.016702000 (HKT)
Accessed:       2021-09-26 10:54:15.016702000 (HKT)

$FILE_NAME Attribute Values:
Flags: Directory, Hidden, System
Name: .
Parent MFT Entry: 5     Sequence: 5
Allocated Size: 0       Actual Size: 0
Created:        2018-06-27 17:03:34.014478800 (HKT)
File Modified:  2021-09-26 10:54:15.016702000 (HKT)
MFT Modified:   2021-09-26 10:54:15.016702000 (HKT)
Accessed:       2021-09-26 10:54:15.016702000 (HKT)

$OBJECT_ID Attribute Values:
Object Id: e88721bc-79f0-11e8-825c-408d5cf89422

Attributes:
Type: $STANDARD_INFORMATION (16-0)   Name: N/A   Resident   size: 72
Type: $FILE_NAME (48-1)   Name: N/A   Resident   size: 68
Type: $OBJECT_ID (64-10)   Name: N/A   Resident   size: 16
Type: $SECURITY_DESCRIPTOR (80-2)   Name: N/A   Resident   size: 228
Type: $INDEX_ROOT (144-630)   Name: $I30   Resident   size: 56
Type: $INDEX_ALLOCATION (160-632)   Name: $I30   Non-Resident   size: 65536  init_size: 65536
361697722 361697723 361697724 361697725 361697726 361697727 361697728 361697729
361697730 361697731 361697732 361697733 361697734 361697735 361697736 361697737
Type: $BITMAP (176-631)   Name: $I30   Resident   size: 8
Type: $LOGGED_UTILITY_STREAM (256-9)   Name: $TXF_DATA   Resident   size: 56

5 seemed to be the root node, since its parent is itself.

These outputs are not modified.

@AlecMcCutcheon
Copy link

AlecMcCutcheon commented Oct 8, 2021

I was just able to run the NTFS2BTRFS convention on a partition in Windows with no errors and I was happy it completed but Windows is telling me that it is still NTFS. any fixes for this?

@AlecMcCutcheon
Copy link

Again, I'm on Windows, not Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants