Im trying to upgrade my 3ds sd card but some files like .tmd s are interrupting. I'm pretty sure that they are homebrew files. My sd card may also be a problem because i got a crappy Chinese knockoff one
Cheap doesn't always equal fake, but fake cards generally show a higher capacity than they really have. They just start overwriting data past a certain point.
Assuming the card isn't fake or faulty, you can type this at the Command Prompt to check and fix filesystem errors: chkdsk x: /f
Replace "x" with the drive letter.
And you can test the card with a program called h2testw, but you'll need to format the card first, so only do this after running the chkdsk command and backing up what you can. If the h2testw fails, throw the card away and don't bother using the data you saved with a new card, because it's probably corrupted.
If you don't care about the contents of the sd card, check the new one with h2testw so you don't fall back into the same scenario again, and just put the the Luma files & other 3dsx/cia files that you were told to put them on the sdcard when you first installed CFW, and install the HBC/FBI etc when you plug it in. Restoring saves is relatively easy if you've backed them up with Checkpoint.
For games/DLCs/Emulators/roms etc. I recommend just re-downloading them or re-dump your carts (if you didn't save the cia files on your pc).