I have a single ext4 partition in ubuntu. How to compress it for an ntfs partition?
-
1Shrink ext4, create ntfs for the empty space that then is created. Buw ... what is the intention of the NTFS partition? To install Windows? If so: EFI or legacy? Edit it into the question please. – Rinzwind May 05 '17 at 19:48
-
I have already tried shrinking. Its the only partition i have right now. Active partition cant be shrinked i guess. – Alam May 05 '17 at 19:54
1 Answers
Before starting, make sure to have a backup just in case.
1. Boot From Media
You can't have the EXT4 partition mounted while doing what you will need to do. You'll need to boot from a live USB or other Linux media to accomplish the task since it's the root filesystem.
2. Fsck the EXT4 Partition
If there are unhandled errors in the filesystem before resizing it's significantly more likely that the resize will result in corruption and loss of data. Run an e2fsck on the filesystem to make sure everything is ready to go.
3. Shrink EXT4 Filesystem
Since we're booted from the media we can have the partition unmounted. You'll next use the resize2fs command to resize the filesystem to the desired smaller size.
4. Shrink Partition
You can use, from command line, fdisk or parted to adjust the size of the partition. (There are other utilities but these are the most commonly used CLI utilities for partitioning).
5. Create New Partition
Using the same utilities listed before (fdisk
or parted
) you can now use the new disk space to create your new partition.
6. Create NTFS Filesystem on New Partition
(If you don't have the necessary NTFS utility installed yet, make sure to install it. The package name can vary by Linux distribution.)
Use mkfs.ntfs to create the NTFS filesystem on the newly created partition.
Voila, you have your new partition with NTFS. You can now reboot and boot your system normally. I've linked each command specified to their relative man pages so that if you are unfamiliar with them you can learn them. I wouldn't recommend using any of these commands before fully understanding what they do.

- 3,971