Score:3

Why does Clonezilla disable swapfile?

cn flag
TNT
# uname -r
5.13.0-27-generic
# lsb_release -a
LSB Version:    core-11.1.0ubuntu3-noarch:security-11.1.0ubuntu3-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:    21.10
Codename:   impish
# swapon
/swapfile file  12G   0B   -2
# clonezila
(...)
# swapon
(nothing)
# swapon /swapfile
# swapon
/swapfile file  12G   0B   -2

Why does running Clonezilla on my Ubuntu environment disable swapfile? Is there a way to prevent this behavior? I just want to backup/restore some data on some microSD cards while doing something else at the same time.

EDIT: swapfile is disabled when I select restoredisk or savedisk.

Score:2
cn flag

The answer is very simple. It happened to me like you, and I didn't see why at the very first moment.

Your swap is not in a partition, it is in a swapfile in /, named swapfile. As a file, it is part of the filesystem. In order to save or restore, the filesystem has to be unmounted, / not accessed live, as changes to a live filesystem while cloning may result in data being corrupted in the target.

I tested it in a VM. I was assuming that yours was a swap partition (I read your question very quickly and didn't realize it was not a partition) and I downloaded Clonezilla in the VM to try to repeat the behavior. I checked the Clonezilla script and documents to see if that was expected and, when I double checked your output to follow your exact steps, I realized that your swap is based on a file.

It seems that the latest Ubuntu releases are creating swap this way automatically. My VM with Ubuntu 20.04 LTS is also using a file:

swapon
NAME      TYPE SIZE USED PRIO
/swap.img file 2.9G   0B   -2
TNT avatar
cn flag
TNT
And is there a way to disable this behavior? I often use Clonezilla to backup/restore Raspberry Pi cards.
Carles Mateo avatar
cn flag
Yes @TNT the best way is to create a partition dedicated for swap instead of using a swapfile. You can do this when you install the Operating System, or repartition later. But to resize the partitions the filesystem needs to be unmounted. Maybe you still have free space in your SD card, depending on the image you toasted. Or you can clone your SD card to a bigger SD card, and then boot with the new one and make a new partition for swap. You will be able to disable the old swap file removing it from /etc/fstab
TNT avatar
cn flag
TNT
I'm using Ubuntu with a swapfile, not a Clonezilla Live. I'm not cloning my root partition. The SD cards are from Raspberry Pi, without swap file or swap partition.
Carles Mateo avatar
cn flag
My understanding is that you're using ubuntu in a pc, and working with SD that you'll use in Raspberrys, right?. I installed clonezilla 3.35.2-1 in Ubuntu 20.04 LTS and I cannot reproduce the behavior you describe. Can you detail what operations you do inside clonezilla?. ```carles@ansiblemaster:~$ swapon NAME TYPE SIZE USED PRIO /swap.img file 2.9G 0B -2 carles@ansiblemaster:~$ sudo clonezilla Clone mode is not selected!!! Program terminated!! Press Enter to exit... carles@ansiblemaster:~$ swapon NAME TYPE SIZE USED PRIO /swap.img file 2.9G 0B -2```
TNT avatar
cn flag
TNT
Yes. That's no point in creating a swap partition in the SD card I'm cloning.
TNT avatar
cn flag
TNT
swapfile is disabled only after I select restoredisk or savedisk. You could check on another terminal while still running Clonezilla.
Carles Mateo avatar
cn flag
Can you confirm what version of clonezilla are you running?.
TNT avatar
cn flag
TNT
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/134252/discussion-between-tnt-and-carles-mateo).
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.