fdisk -l:Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytes`parted -l:Model: ATA WDC WD10EZEX-21W (scsi)Disk /dev/sda: 1000GBSector size (logical/physical): 512B/4096BPartition Table: loopDisk Flags: Number  Start  End     Size    File system  Flags 1      0,00B  1000GB  1000GB  ext4goal: that drive should have 1 encrypted partition with all my data, but not operating system, and (not necessarily) 1 unencrypted partitionThis drive has 200 GB of data on it. (only data, no system files - OS is on 250 GB SSD). I don't have any other storage where I can store the files while operating with that drive (my ssd has ~50 gb of free space).I can resize that primary partition, but I can't create new partition in free space: gparted says only 1 primary partition can exist on this drive. help?OS: Ubuntu 16.04
Create encrypted partition on existing drive with one primary partition while keeping data
ubuntu;partition;gparted;disk encryption;partition table
As identified by richard, the filesystem starts on the very first sector of the disk: you have no partitions. To create an encrypted partition, you will need to create a partition table first. And you do need to have two partitions if you want to have an encrypted partition, because you need some non-encrypted space for the bootloader.You can create a partition table without losing your data. It's a delicate task, so double-check that your backups are up-to-date, but it can be done.The ext4 filesystem leaves the first 512 bytes unused, and an MBR partition table fits within the first 512 bytes of the disk, so you have room for an MBR partition table. (Note that it has to be MBR, not GPT.)First, boot some rescue media. Do not attempt to do any of this while the filesystem is mounted. SystemRescueCd is good for this kind of things.If more than half the disk space is free, then you can create a partition in the second half of the disk as follows:Determine the path to the disk device. Note that a rescue system might name the disks differently from your normal system. Here I'll assume that the path is /dev/sda.resize2fs /dev/sda to shrink the filesystem about as much as it'll go. You can see how much space is free with tune2fs -l /dev/sda.Run fdisk /dev/sda. Fdisk will create a dos disklabel, i.e. an MBR partition table, in memory. Enter n and create a new primary partition that starts after the end of the filesystem. Enter w to write the new partition table and exit fdisk.Copy the filesystem to the new partition with head -c SIZE /dev/sda1 where SIZE is the size of the filesystem after shrinking.  Verify that the data new partition is safe.You can now create partitions to span the first half of the disk, where the old copy of the filesystem is located.If more than half the disk is in use then you're in for quite some pain. I think you can do it by first converting the data to an LVM volume with blocks, then shrinking the filesystem, the logical volume and the physical volume, and using gparted to move the start of the physical volume. But I've never done anything like this, so triple-check your backups.