Linux – Decompressing Files on an NTFS Volume from Linux

compressionlinuxntfs

I recently did something stupid on my dual-boot laptop, where I compressed the entire volume to make room for a Linux partition. For some reason, Windows let me compress C:\ntldr. Now I need to get it uncompressed in order for Windows to boot.

Here are some of the operating restrictions I have:

  • I do not have access to the BIOS.
  • I cannot boot from CD/USB/floppy. (I installed Linux through PXE)
  • It does not have network access.

Is there were some way to specify that the ntfs-3g driver shouldn't compress files even if it thinks it should (if the directory is compressed) when mounting the volume?

Or, is there a way to modify the attributes of a directory using ntfsprogs?

Best Answer

Okay, I think I've solved it. The problem lies in the ntfs-3g driver; it tries too hard to predict what the user wants.

I solved the problem by mounting the volume on /mnt/windows using the ntfs-3g driver, then copying the ntldr file out of the volume.

# mount -t ntfs-3g /dev/sda1 /mnt/windows
# cp -p /mnt/windows/ntldr ~/ntldr
# mv /mnt/windows/ntldr{,.bak}
# umount /mnt/windows

Then, using ntfsprogs' ntfscp, I re-copied the file back into the file system:

# ntfscp -f /dev/sda1 ~/ntldr ntldr

Then, when I did an ntfsinfo on it it no longer had the compressed attribute present.

Related Topic