0

I have the following disk setup:

Disk /dev/sda: 53.7GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
14      1049kB  4194kB  3146kB                     bios_grub
15      4194kB  134MB   130MB   fat16              boot, esp
 1      134MB   53.7GB  53.6GB  ext4

I would like to have a swap partition, but there isn't one as you can see here. So, I would like to take "a piece" of sda1 and make that a new partition. The problem is: I have all my files on sda1 and all the ways I could find to do what I need involved manually selecting the sectors which I don't want to deal with because I don't know which ones contain my data. I would love to use gpart, but I don't have a screen :). It is not a problem for me to make a backup, but I am afraid to lose just "some" data and not realize.

Here is how I imagine doing what I want (but this is in no way a solution because it just randomly allocates first sectors of the drive which will overwrite my data):

sudo parted /dev/sda mkpart primary linux-swap 1 33
sudo mkswap /dev/sda3
sudo swapon /dev/sda3
sudo swapon -s

What could I use to automatically avoid overwriting my files?

0 Answers0