Web lists-archives.com

Re: Recommendation on partition sizes




>> 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

but in my case, the need to resize was typically when hibernate failed
because the swap was not sized accordingly, so I could just do:

    swapoff /dev/<VG>/swap
    lvresize --size +2g /dev/<VG>/swap
    mkswap /dev/<VG>/swap
    swapon /dev/<VG>/swap

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


        Stefan