Web lists-archives.com

Re: Recommendation on partition sizes




On 2018-11-04, Pascal Hambourg <pascal@xxxxxxxxxxxxxxx> wrote:
> 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.
>

I was reading about swap recently and fell upon (like a sword) this
remark from 2005 from Andrew Morton:

  Create the swapfile when the filesystem is young and empty,
  it'll be nice and contiguous.  Once created the kernel will never add
  or remove blocks.

Can it be inferred that excessive (LVM) resizing would be detrimental
contiguity-wise, and thus also performance-wise, or is this
insignificant and not a concern?



-- 
“If a person is not talented enough to be a novelist, not smart enough to be a
lawyer, and his hands are too shaky to perform operations, he becomes a
journalist.” --Norman Mailer