You are not logged in.
I have unallocated (but partitioned into root ext4fs partition) space for swap. How to shrink a partition and take out the unallocated space to turn it into swap? I assume it's possible to do it without data loss.
https://i.imgur.com/CeOxhvP.png
➜ ~ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238,5G 0 disk
├─sda1 8:1 0 200M 0 part
├─sda2 8:2 0 500M 0 part
├─sda3 8:3 0 76G 0 part /
└─sda5 8:5 0 161,8G 0 part
➜ ~ df -h
Filesystem Size Used Avail Use% Mounted on
dev 7,8G 0 7,8G 0% /dev
run 7,8G 1,7M 7,8G 1% /run
/dev/sda3 59G 46G 11G 81% /
tmpfs 7,8G 147M 7,7G 2% /dev/shm
tmpfs 7,8G 0 7,8G 0% /sys/fs/cgroup
tmpfs 7,8G 720K 7,8G 1% /tmp
tmpfs 1,6G 12K 1,6G 1% /run/user/1000moderator edit -- replaced oversized image with link.
Pasting pictures and code
Last edited by 2ManyDogs (2020-02-02 14:17:58)
Offline
Your partition should be unmounted, do it from a live disk, it's trivial to do with gparted, otherwise https://wiki.archlinux.org/index.php/Pa … ning_tools
Last edited by V1del (2020-02-02 10:40:34)
Offline
Offline
I followed your instruction and did it with gparted. I didn't expect that this way is "safe" as gparted does not visually distinguish free space on partition from unallocated space on file system. So now I assume even if I would like to take more from /dev/sda3 - it would be still safe (by saying "more" I mean taking not only unallocated space in file system = 16GB, but let's say 2GB of free space on that partition).
Thank you for quick reaction. Marking as solved.
➜ ~ swapon --show
NAME TYPE SIZE USED PRIO
/dev/sda4 partition 16G 0B -2Offline
Literally on the screenshot you posted, gray is unallocated, white is used by filesystem but free, yellow is used. Yes it would technically still be safe to take more.
Offline