Trouble Backing Up Files Because "invalid file name"

Hi. So I need to re-install my OS.
Which means I have to back up my files.
But when I try to copy and paste my files to another hard drive, it says "invalid file name".

I have 200GB to back up.
It's impractical for me to manually have to go through my folders every time this happens and change the file name to a valid one.
I don't even know why one file name is invalid.
I wanna just do something else while all the files copy and paste.

What do I do?

Is the other drive formatted to NTFS?


Edit: it says: exFAT (version 1.0).
The Fat 32-bit was for a small partition on this disk, but most of the disk is exfat.
Edit: can I partition some of it and back up my files there? It has plenty of free space.

That was going to be my guess as well, wrong file formats. You should be able to do what you said: take a partition from the drive, format it as EXT4 and move your files there.

One thing to note: Windows does not read EXT4 file format so if you plug this drive to a Windows machine you won't be able to access your files from there. Not by default, anyway.


Thanks. I'll try that.

It says data can be lost when resizing a partition. Should I worry about losing some data/files being corrupted when partitioning or resizing disks????

Are you referring to the partition or drive that you are performing a fresh install on? If so, then you do not need to worry about that as you are performing a fresh new install.

If you are referring to the drive in which you are backing up your data - I would wonder why you are resizing that partition...

Refers to this, (if you missed it).

I forgot to say. defrag before shrinking the partition to give unallocated space for your ext4 partition.

1 Like

Thanks Zaba, I 100% missed that.

1 Like

Is this necessary? I always thought that the resizing process would handle this. In "Disks" when I try to resize a partition I see a message that warns me about the process may take longer if there's data that needs to be moved.

In any case, @AMixOfGeekStuff you should be fine resizing the main partition as long as the there's enough space left over in one of the partitions to accommodate the already existing data.
If you have another drive or USB stick you can use that first as a test run to make sure you are comfortable with the process.

“invalid file name”

I had this issue a while ago. Turns out that there was a space at the beginning or the end of the file. It's not obvious to the naked eye, but when you go to copy/move file you get this error.

1 Like

The problem here is that a whitespace in Linux filesystems e.g.: EXT4 is "escaped" by prefixing the backslash character \, so that a filename like "2023 holiday pictures" would become "2023\ holiday\ pictures". The backslash character is illegal in Windows filesystem NTFS and, I would presume based on this thread, also in FAT32.

1 Like

Windows sprays files all over the place on HDD, so I would reccommend defrag before resizing. This has been mentioned by others e.g. Installer stuck! – What am I missing? - #20 by Aravisian

1 Like

It is opinion. :wink:

It is not strictly necessary, but there are good reasons to do it:

  • In Windows, Defrag is built for the purpose of safely moving files. It has redundancy.
  • Copying files in a partition move may just respray them in a different space, rather than blocking like-files together.
  • Moving during partition can increase the time partitioning takes. A user may believe that the process has hung up. This can cause them to try to halt the process, adding additional problems or file loss. When they defrag first, their expectations are met, reducing anxiety.
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.