FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Fri May 14, 2021 14:30



Post new topic Reply to topic  [ 3 posts ] 
Mounting errors with large ntfs partition and solution hint 
Author Message

Joined: Mon Feb 20, 2012 16:33
Posts: 2
Post Mounting errors with large ntfs partition and solution hint
I have encountered some problems with using ntfs-based filesystem on large sdhc cards.
A mount command for a single ntfs formatted partition on a 8GB SDHC Card fails with the following output:

Code:
mount -t ntfs-3g /dev/sda1 /media/sd/
Failed to read last sector (15644671): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
   or it was not setup correctly (e.g. by not using mdadm --build ...),
   or a wrong device is tried to be mounted,
   or the partition table is corrupt (partition is smaller than NTFS),
   or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sda1': Invalid argument
The device '/dev/sda1' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
;


mkfs.ntfs also results in an error:

Code:
mkfs.ntfs -f /dev/sda1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
Error writing non-resident attribute value.
add_attr_data_positioned failed: Invalid argument
Couldn't create $MFTMirr: Invalid argument
;


Version of ntfs-3g and the ntfsprogs is 2012-1-15, almost the most recent i think.
The specific in our environment is that the ntfs-3g components are cross-compiled for atom based targets.

Some investigations leads to the preprocessor define of _FILE_OFFSET_BITS. The cross compiler toolchain with its integrated autotools has not set this define into the config.h of the libntfs-3g components.
So the lib binary libntfs-3g.so.83.0.0 uses the lseek, fopen aso. functions and not the lseek64... So most probably partitons <= 4GB can be handled with (for example) signed integer parameters in lseek. Tests with partitions smaller than 4GB can be handled by this lib. But if there are bigger partitions like 8GB or so the errors above happens.

I have no clue why the cross compiler and its autotools has not set the _FILE_OFFSET_BITS define. Could be the AC_SYS_LARGEFILE macro, but i have not investigated any further at this point. Defining it manually in the CFLAGS env var builds a libntfs-3g which uses the lseek64 variant. No more errors has happened with this new lib. Mounting partitions larger than 4GB is OK now.

Maybe this is of interest for someone else who runs into such error messages. Otherwise just ignore this post :)

Regards
Falk


Tue Feb 21, 2012 13:43
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Mounting errors with large ntfs partition and solution hint
Hi,

Quote:
Some investigations leads to the preprocessor define of _FILE_OFFSET_BITS. The cross compiler toolchain with its integrated autotools has not set this define into the config.h of the libntfs-3g components.
So the lib binary libntfs-3g.so.83.0.0 uses the lseek, fopen aso. functions and not the lseek64... So most probably partitons <= 4GB can be handled with (for example) signed integer parameters in lseek. Tests with partitions smaller than 4GB can be handled by this lib. But if there are bigger partitions like 8GB or so the errors above happens.

With the GNU toolchain, _FILE_OFFSET_BITS is defined in config.h if the target CPU is 32-bit, and it is not defined if the target CPU is 64-bit.

Quote:
I have no clue why the cross compiler and its autotools has not set the _FILE_OFFSET_BITS define.

Did you set the options --host= and --target= when running "./configure" ?
"./configure" compiles a short program referencing a big offset to determine whether _FILE_OFFSET_BITS has to be set, but you have to be sure the target compiler is used for this test, not the host one.

Regards

Jean-Pierre


Tue Feb 21, 2012 14:58
Profile

Joined: Mon Feb 20, 2012 16:33
Posts: 2
Post Re: Mounting errors with large ntfs partition and solution hint
Hi Jean-Pierre,
yes, you have give me the right hint with your answer, thank you.
The problem was indeed the configure call. --host and --target were set in the right way. But there was also a parameter --disable-largefile, which certainly means omit support for large files...
I have compiled more than 300 software packages with our cross-compile toolchain. But up to now i really have missed this parameter which was a default setting for our environment :roll:

So thanks again for your help. Great support here.

Regards,
Falk


Wed Feb 22, 2012 17:55
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.