On 2020-05-06 08:07, Ed Greshko wrote: > On 2020-05-06 06:12, linux guy wrote: >> I would appreciate them, Ed, just to make sure I'm not missing something. No rush. Don't get up early. > I do normally get up early. But had some other things to take care of first. > > In my case I don't have separate / and /home. So, I am going to decrease / and increase swap. > Decreasing is more dangerous than Increasing. You'll be decreasing /home and increasing /. > > This is the system normally booted before modification. > > [egreshko@f31m ~]$ df -t ext4 > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/mapper/fedora_localhost--live-root 17410832 7037660 9465704 43% / > /dev/vda1 999320 263436 667072 29% /boot > > [egreshko@f31m ~]$ swapon > NAME TYPE SIZE USED PRIO > /dev/dm-1 partition 2G 0B -2 > > [egreshko@f31m ~]$ sudo lvs > LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert > root fedora_localhost-live -wi-ao---- <17.00g > swap fedora_localhost-live -wi-ao---- 2.00g > > My goal is to reduce / by 2 GB and add to swap. So, I then boot from the F31 Mate Spin image and > do the following. > > [root@localhost-live ~]# e2fsck -ff /dev/fedora_localhost-live/root > e2fsck 1.45.3 (14-Jul-2019) > Pass 1: Checking inodes, blocks, and sizes > Pass 2: Checking directory structure > Pass 3: Checking directory connectivity > Pass 4: Checking reference counts > Pass 5: Checking group summary information > /dev/fedora_localhost-live/root: 226041/1114112 files (0.2% non-contiguous), 1855851/4455424 blocks > > I now resize the filesystem to 15GB. Failure to resize the FS will result in disaster. > > [root@localhost-live ~]# resize2fs /dev/fedora_localhost-live/root 15G > resize2fs 1.45.3 (14-Jul-2019) > Resizing the filesystem on /dev/fedora_localhost-live/root to 3932160 (4k) blocks. > The filesystem on /dev/fedora_localhost-live/root is now 3932160 (4k) blocks long. > > Make the LV inactive > > [root@localhost-live ~]# lvchange -a n /dev/fedora_localhost-live/root > > Now, shrink the LV....but not as much as the FS. > I can't recall the reason for this....but that is what I've done in the past. 0.5 difference is probably excessive > but.... > > [root@localhost-live ~]# lvresize /dev/fedora_localhost-live/root -L 15.5GB > Size of logical volume fedora_localhost-live/root changed from <17.00 GiB (4351 extents) to 15.50 GiB (3968 extents). > Logical volume fedora_localhost-live/root successfully resized. > > Activate the LV > > [root@localhost-live ~]# lvchange -a y /dev/fedora_localhost-live/root > > And run a check on the new size > > [root@localhost-live ~]# e2fsck -ff /dev/fedora_localhost-live/root > e2fsck 1.45.3 (14-Jul-2019) > Pass 1: Checking inodes, blocks, and sizes > Pass 2: Checking directory structure > Pass 3: Checking directory connectivity > Pass 4: Checking reference counts > Pass 5: Checking group summary information > /dev/fedora_localhost-live/root: 226041/983040 files (0.3% non-contiguous), 1846611/3932160 blocks > > Then I want to increase swap. But I intentionally make it too big to find out what is really available. > This is where you'd increase /. > > [root@localhost-live ~]# lvresize /dev/fedora_localhost-live/swap -L 4GB > Insufficient free space: 512 extents needed, but only 383 available > > So then I do this. In this case I'm adding extents rather than giving a specific size. > > [root@localhost-live ~]# lvresize /dev/fedora_localhost-live/swap -l +383 > Size of logical volume fedora_localhost-live/swap changed from 2.00 GiB (512 extents) to <3.50 GiB (895 extents). > Logical volume fedora_localhost-live/swap successfully resized. Oh, forgot to add Here you'd also have to resize2fs to give more space to / That's not needed in the case of swap as the mkswap fixes it. -- The key to getting good answers is to ask good questions. _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx