Web lists-archives.com

Re: Recommendation on partition sizes




Le 04/11/2018 à 20:56, Stefan Monnier a écrit :
I use LVM volumes for my swap space, which is yet another option, one
that can be grown and shrunk easily, online.
You can resize a logical volume online, but AFAIK you cannot resize a swap
area online (while in use) ;

Indeed, in the general case you'll need to do it like:

     lvcreate --name tmpswap --size NNg <VG>
     mkswap /dev/<VG>/tmpswap
     swapon /dev/<VG>/tmpswap
     swapoff /dev/<VG>/swap
     lvresize --size +2g /dev/<VG>/swap
     mkswap /dev/<VG>/swap
     swapon /dev/<VG>/swap
     swapoff /dev/<VG>/tmpswap
     lvremove /dev/<VG>/tmpswap

Or you can just delete the old swap and rename the new one.

      lvcreate --name newswap --size NNg <VG>
      mkswap /dev/<VG>/newswap
      swapon /dev/<VG>/newswap
      swapoff /dev/<VG>/swap
      lvremove /dev/<VG>/swap
      lvrename <VG> newswap swap

[ Sadly --resizefs doesn't work on a swap partition, AFAICT.  ]

Because there is no swap resizing tool.