FFS Issue with OneDrive File Status

Get help for specific problems
Posts: 9
Joined: 22 Nov 2021

MikeShawn

I use FFS to make a mirror copy of my X: drive into the OneDrive folder on my C: drive. Once all of the new files are synced in the cloud, I want to use the OneDrive "Free Up Space" command to delete the files off of my C: drive. Most of the process works great except that all of the files copied by FFS into the OneDrive folder are flagged as "Always Available." This creates a problem because "Free Up Space" will be grayed out and not work. Neither will SmartSync remove the files. I do not have this problem if i manually copy files into the OneDrive folder.

Microsoft has been totally clueless about this problem. I did find on-line the info below and it appears that FFS is setting FILE_ATTRIBUTE_PINNED to TRUE. They then went into a discussion about writing scripts to use the ATTRIB command to change the file attributes. Before I get into that, which I barely understand, is there a way to change this behavior in FFS? If the attribute was set to FALSE by FFS then OneDrive would work normally.

- online-only
FILE_ATTRIBUTE_PINNED : False
FILE_ATTRIBUTE_UNPINNED : True
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS : True

- locally available
FILE_ATTRIBUTE_PINNED : False
FILE_ATTRIBUTE_UNPINNED : False
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS : False

- always available
FILE_ATTRIBUTE_PINNED : True
FILE_ATTRIBUTE_UNPINNED : False
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS : False
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

CopyFileEx, what FFS is using (interestingly not used by Windows Explorer for some reason, even though this is the Win32 system's file copy routine), copies all file attributes by default.

That said, I'm not able to reproduce the problem you describe:
If the source has FILE_ATTRIBUTE_PINNED, then yes, the target file located in the OneDrive local folder, also gets this attribute. But the "free up space" option doesn't get disabled. When running this command, the file's status is changed to "online only" as expected.
Posts: 9
Joined: 22 Nov 2021

MikeShawn

Zenju, thanks for checking this for me. I don't understand something. If the file is Pinned (True), then it should be "always available" and the "free up space" command will not work at the folder level. You need to highlight the file and change status to "locally available." Then "free up space" will work at the folder level. That is my understanding of what is going on.

But, your info about FFS using the Win32 copy routine makes me look elsewhere for the issue. I did some testing and found the following (I know this is no longer an FFS issue, just want to put this out there for others). I created a test file on my desktop and found the following attribute behavior:

File on Desktop - A
Copy File into OneDrive - AL this can be removed via "free up space" and SmartSync
Copy File to my X: Drive - AP this is the problem; it appears to be an issue with BitLocker
Use FFS to copy from X: to OneDrive - ALP as you said, FFS does the same as copy, adding L to A. The unwanted P is being added elsewhere
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

If the file is Pinned (True), then it should be "always available" and the "free up space" command will not work at the folder level. You need to highlight the file and change status to "locally available." Then "free up space" will work at the folder level. That is my understanding of what is going on. MikeShawn, 02 Dec 2021, 19:46
In my tests it doesn't matter if a file located in a subfolder is tagged as "Pinned" or not. The "free up space" command is always available. And when run, it works as expected, and changes all file tags accordingly to online only.

This was tested using the latest version of the OneDrive client, 21.220.1024.5. Perhaps you're using an older version? If not, there seems to be something else responsible for greying out "free up space".

I created a test file on my desktop and found the following attribute behavior:

File on Desktop - A
Copy File into OneDrive - AL this can be removed via "free up space" and SmartSync
Copy File to my X: Drive - AP this is the problem; it appears to be an issue with BitLocker
Use FFS to copy from X: to OneDrive - ALP as you said, FFS does the same as copy, adding L to A. The unwanted P is being added elsewhere MikeShawn, 02 Dec 2021, 19:46
What are these L and P attributes, and were are you seeing them?
Posts: 9
Joined: 22 Nov 2021

MikeShawn

I appreciate the help. Maybe there is something wrong with my install, but your description of operation has me confused. Are you saying that Free Up Space will always work and delete ALL files from OneDrive? It will remove both the keep on machine (pinned) and local files (unpinned)? If so, what is the point of having the two different files statuses? I thought my "Free Up Space" function might be grayed out because there were no local files to remove.

Okay, yes I am using the same version of OneDrive as you. I am seeing the L and P attributes by right clicking on the file, selecting properties, then details. The P attribute is suppose to mean sparce file and I'm assuming Bitlocker tags the file as such as part of its compression/decompression process. Any data in the sparce space would only be meaningful to Bitlocker. Outside of Bitlocker it would have no use. I'm guessing either Bitlocker or Xcopy is not removing the P attribute when I copy from my X: drive to desktop or OneDrive. OneDrive sees the P and makes the file always on machine. This is my problem. I am not telling my system to make the files always on my machine.

The other possibility is that BitLocker is often used to protect external drives. I'm guessing that my system sees my X: drive as being external. It might be that OneDrive flags files from external sources as always keep on machine.

Sorry to be so vague. I haven't programmed in decades and it really pisses me off that I have to learn the inner workings of Microsoft products to a much deeper level than any of their techs. I received one snide remark from a moderator that if I just done what he said to refresh my system I wouldn't still be working on this problem. Of course he left out that this would uninstall all of my non-Microsoft programs and apps. Or that I already did a repair using sfc followed by DISM restore health and it came back clean.
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

Are you saying that Free Up Space will always work and delete ALL files from OneDrive? It will remove both the keep on machine (pinned) and local files (unpinned)? MikeShawn, 04 Dec 2021, 18:16
It appears so in my tests. "free up space" apparently strips file attributes like P, and even R = FILE_ATTRIBUTE_READONLY. I couldn't reproduce a case where this option would be greyed out.

A = FILE_ATTRIBUTE_ARCHIVE
P = FILE_ATTRIBUTE_PINNED
L = ???
[ ] = sparse: Interestingly, "sparse" is not shown in the Explorer details tab at all!

"L" is really strange. It is not a regular NTFS file attribute like the others, and doesn't even show up in BY_HANDLE_FILE_INFORMATION::dwFileAttributes. Looks like some "virtual" attribute, that is simulated by the OneDrive client app.
Posts: 9
Joined: 22 Nov 2021

MikeShawn

I believe L is resparse point. And your statement that "free up space" strips off P and is still available has me totally confused. I've had Microsoft moderators tell me the same thing but the Microsoft documentation does not say that. The docs state that "free up space" only applies to local files and not files flagged as "keep on machine."
User avatar
Site Admin
Posts: 7211
Joined: 9 Dec 2007

Zenju

I believe L is resparse point. MikeShawn, 07 Dec 2021, 17:32
Reparse point is FILE_ATTRIBUTE_REPARSE_POINT which is a regular NTFS attribute, so it would be observable in the debugger, but it's not. Whatever "L" is, it's not an NTFS attribute.