Score:0

Disk space increased after moving Timeshift out

cn flag

Please let me understand one thing. I'm going to start from the fact that basically I was runing Ubuntu on my computer which was equipped in 120 GB SSD drive. Then I've decided to make back up of my system with use of Timeshift (which is my favourite tool for that). Because of that from longer time my disk was suffering and constantly reported out of space. One time even crushed badly , but restoring from snapshot helped.

So it was finally time to buy a new 1TB SSD (Goodram brand). I've created 4 patition as bellow picture shows:

Gparted view

As you can find out /dev/sda2 is my main system (Ubuntu /). /dev/sda4 is a pratition with my snapshots

Output of df-H command:

 tmpfs           823M  2,3M  821M   1% /run
/dev/sda2       275G  171G   92G  66% /
tmpfs           4,2G  189M  4,0G   5% /dev/shm
tmpfs           5,3M  4,1k  5,3M   1% /run/lock
/dev/sda1       536M  5,5M  531M   2% /boot/efi
/dev/sda4       518G   71G  421G  15% /mnt/Timeshift
tmpfs           823M  267k  823M   1% /run/user/1000
/dev/sda3       218G  159M  218G   1% /media/zawier/Dokumenty Ubuntu

On old ssd snapshots size was around ~ 60GB, that's allow us thinking that system +all apps + docs was another 60GB. Moved all backups to a new partition /dev/sda4. Currently I have 5 of them:

sudo timeshift --list

/dev/sda4 is mounted at: /run/timeshift/backup, options: rw,relatime

Device : /dev/sda4
UUID   : 4bf343eb-b0d3-42c6-9a81-db7faa521367
Path   : /run/timeshift/backup
Mode   : RSYNC
Status : OK
5 snapshots, 447.3 GB free

Num     Name                 Tags  Description                  
---------------------------------------------
0    >  2022-06-18_11-00-01  W M   20.04 Focal                  
1    >  2023-02-18_00-00-01  M                                  
2    >  2023-02-20_19-00-01  W     Przed wymianą dysku na 1TB  
3    >  2023-02-25_06-50-51  O     Po wymianie dysku            
4    >  2023-02-25_11-35-53  B     Nowy GRUB   

I'm aware that Timeshift's snapshots includes symbolic and hardlinks. That's why the only way to copy them properly is :

sudo rsync -aHXAS --info=progress2 /timeshift /mnt/Timeshift/

To keep it consistent and avoid copying the same file multiple times (had that issue with Timeshift on Linux Garuda where simples rsync from total 490GB of snapshots tried copy 2,9 TB :) Madness!)

Let's keep going. So my copied Ubuntu back ups on a new partition take around ~60GB:

Timeshit folder properties

Disk utility

Here output of mount |grep timeshift:

/dev/sda4 on /run/timeshift/backup type ext4 (rw,relatime)

Checking ncdu /mnt/Timeshift/ we get:

ncdu Timeshift backup partition

Why /dev/sda4 point on /run/timeshift/bacups while it's mounted on /mnt/Timeshift/? And why it's linked with 2 destinations? Any idea? Why it can't point just only /mnt/Timeshift/?

Next is output on ncdu / : ncdu /

As you see size is around 200GB while it's litteraly almost the same system which was stored on the previous 120GB SSD! Please keep in mind that also I have removed here folder /timeshift. That's why I was expecting decreasing of total size to 60GB as result. Finally system space was rised up! Why? Can anybody explain it to me what happened here, please? From my perspective it's just illogic! :)

How Ubuntu calculate used space? Does mounted folders also included into total space even if they are on separate partition?

PonJar avatar
in flag
TimeShift is one of my favourite apps as well. It’s great for system recovery if you mess something up or an update goes wrong. It is not a good tool for data backup though. That is why the home directory is not included in the snapshot by default. You can easily have the situation where you need the system from one snapshot but your latest data is in another
Score:0
in flag

I think the mount points are confusing you. When you run timeshift it adds the mount point /run/timeshift/backup which contains all the snapshots from the backup location wherever that is. You must have mounted that location at /mnt/Timeshift. Then you have used ncdu to ask the question “How much used space is attached to /?”. Answer is 60GB that you started with for the system etc plus about 60GB from the first TimeShift mount and 60GB from the second TimeShift mount.

You don’t really need the /mnt/Timeshift mount now you have copied your data. Remove it and the ncdu result will drop by 60GB. Reboot and try it again and the result will drop by the other 60GB until you open the TimeShift app.

So yes Ubuntu (or any Linux) will count by default any partition attached to the start point of the ncdu command. However if you use ncdu -x / it shouldn’t cross filesystem boundaries.

Score:0
cn flag

PonJar you are absolutelly right! It confuses me a lot while from my perspective it's illogic :) It's like when you check your bank account ballance and you get total sum of all bank's clients ..

Done additional check according to yours advice. At first unmounted following:

mount | grep -i timeshift
/dev/sda4 on /mnt/Timeshift type ext4 (rw,nosuid,nodev,relatime,x-gvfs-show)
/dev/sda4 on /run/timeshift/backup type ext4 (rw,relatime)

And the size dropped down to somewhere I have expected.

ncdu 1.15.1 ~ Use the arrow keys to navigate, press ? for help                  
--- / ---------------------------------------------
   59,5 GiB [##########] /media                                                 
   26,1 GiB [####      ] /snap
   16,0 GiB [##        ] /var
   12,8 GiB [##        ] /usr
    7,2 GiB [#         ] /home
    2,0 GiB [          ]  swapfile
    1,8 GiB [          ] /opt
  266,4 MiB [          ] /boot
   36,7 MiB [          ] /etc
   29,8 MiB [          ] /root
.   2,3 MiB [          ] /run
  360,0 KiB [          ] /tmp
e  16,0 KiB [          ] /lost+found
    4,0 KiB [          ] /dev
e   4,0 KiB [          ] /srv
e   4,0 KiB [          ] /mytestsite
e   4,0 KiB [          ] /mnt
e   4,0 KiB [          ] /cdrom
.   0,0   B [          ] /proc
    0,0   B [          ] /sys
@   0,0   B [          ]  libx32
 Total disk usage: 125,7 GiB  Apparent size: 128,1 TiB  Items: 3642695    

Another (or more detailed ) explanation is a fact that by default I have set up mounting of /dev/sda4 on system start up and what's really interesting here - type of folder is node/directory, which include just list of files and doesn't include files data! So we could simplify sentence that those are just links ;)

Last question which comes to my mind is: what will heppen when total size sum will be equal or greater than size of main partition? System will report low unused space capacity or it will be runing without an issue? In second case: how do you know when you are close to run out of disk space?

Thank you for your help and explanation!

PonJar avatar
in flag
The system will not be concerned if the sum of all the mounts adds up to more than the size of the device. From its perspective the size available is also summated so it’s not an issue.
PonJar avatar
in flag
The system will tell you if you are running low on space on the root partition. ext4 reserves about 5% of the root partition that only it can use. This guards against an unrecoverable system due to space issues but you can still get in a right mess if space gets too short. Just keep an eye on the space available on your root partition. On other partitions you will get no warning, suddenly there will be no space left and you cannot save data
PonJar avatar
in flag
If you think my answer fully answered your question please accept it. This helps others searching for questions with accepted answers
PonJar avatar
in flag
What happened here is not illogical. You asked the question “How much used space is attached to /?”. You thought you had asked “How much space is used on my root partition?” Linux can be very subtle. It’s worth reading the man page for the command you are using, it will reveal options and defaults that could be relevant.
zawier avatar
cn flag
Timeshift work the best for me. I've tried already: back in time, snapper, clonezilla and also Macronium Reflect which is Windows based app - but really good one and currently is capable to image and recover ext4 and btrfs partitions! In last case it just take really long time, but in the end of the day it works. Marked answer as solved. One more time - thank you!
PonJar avatar
in flag
I’m not saying don’t use TimeShift. It’s brilliant to recover your system. However if you are serious about understanding Linux study rsync. It’s used at the core of TimeShift and is easy to use to maintain backups of your data. I use a systemd timer to run a simple rsync to create a data backup on a daily basis. A great Linux skill to learn
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.