Score:0

Creating a swap partition from existing one

ba flag

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?

in flag
Why a swap partition? Create a swap file and be done with it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.