Running low on storage

If none of the more specific forums is the right place to ask

Running low on storage

Postby marco26 » 2017-09-17 13:51

I'm running Debian 9 that I've installed on a single 256gb SSD. It was setup with LVM and encryption - 30gb /root, 157gb /home and 68gb/sawp.
I have a fair amount of ram (64gb) and never seen the swap partition even get used, would it be safe to reduce the swap partition to 2gb?
Normally I just use gparted live if i need to change something on any partition but I never used LVM or encryption before can i still use it or there is a better method?
If I would add another SSD is it possible with LVM extending my /home partition to it?
Thanks
marco26
 
Posts: 6
Joined: 2016-02-29 12:31

Re: Running low on storage

Postby kopper » 2017-09-17 14:18

Your swap is definately too large for any purpose. You'd absolutely do well with less.

There are different opinions on optimal swap size. Here are some considerations to help you determine the best amount for your case. Generally, I've used same amount of space than my RAM, up to 4Gb. I don't have experience of that much RAM in one system so someone else could probably give you better recommendation than me. I still find even 32GB (50-50 rule) way too much, though it would be good to know an example of two about your use case.

EDIT: Misread your RAM amount.
Debian 9.1 Stable with i3
Secure your stuff: Securing Debian Manual
Don't break your stuff: Source List Management DontBreakDebian
kopper
 
Posts: 59
Joined: 2016-09-30 14:30

Re: Running low on storage

Postby marco26 » 2017-09-17 15:11

Thanks, I've successfully managed to add another ssd to my LVM volume with the help of Logical Volume Management gui, unfortunately it doesn't allow me to reduce my swap space and i forgot to encrypt the second ssd before adding it to the volume :( But at least I got a nice "big" /home partition.
marco26
 
Posts: 6
Joined: 2016-02-29 12:31

Re: Running low on storage

Postby p.H » 2017-09-17 15:42

kopper wrote:Your swap is definately too large for any purpose.

Except for hibernation (suspend to disk). It is recommended to have at least as much swap space as RAM.

If you do not use hibernation, you can just remove the swap. Linux works fine without any swap.

marco26 wrote:Normally I just use gparted live if i need to change something on any partition but I never used LVM or encryption before can i still use it or there is a better method?

I do not think that gparted handles LVM nor encryption. You'll have to use the command line. The good news is that LVM allows to do most resizing online, so no need for a live system.

You'll find real logical volume names and UUIDs in /etc/fstab.

Disable all swaps
Code: Select all
swapoff -a


Remove the swap logical volume
Code: Select all
lvremove /dev/mapper/vgname-swaplvname

Comment out the swap line in /etc/fstab.

Or if you prefer to reduce it to 2 GiB and reformat it
Code: Select all
lvresize -L 2G /dev/mapper/vgname-swaplvname
mkswap -U swap_uuid /dev/mapper/vgname-swaplvname

If you do not set the same UUID, the system won't find it and will complain.

Extend the home logical volume by 30 GiB and its filesystem (assuming it is ext4)
Code: Select all
lvextend -L +30G /dev/mapper/vgname-homelvname
resize2fs /dev/mapper/vgname-homelvname


marco26 wrote:If I would add another SSD is it possible with LVM extending my /home partition to it?

Yes. But if one drive fails, you lose all data in /home.

Create a partition using you favourite partition tool.
Then create an encrypted volume on top of it (adapt with the real partition name and add any desired options)
Code: Select all
cryptsetup luksCreate /dev/sdb2 lvm2_crypt

Add a line for the new encrypted volume in /etc/crypttab.
Rebuild the initramfs
Code: Select all
update-initramfs -u

Note that the passphrase of the second encrypted volume will be asked at start-up too.

Format the encrypted volume as a LVM physical volume
Code: Select all
pvcreate /dev/mapper/lvm2_crypt

Extend the volume group with the PV
Code: Select all
vgextend vgname /dev/sdb1

Extend the home LV and its filesystem in the same way as above.

Edit (wrote all the above before seeing your last post)
marco26 wrote:it doesn't allow me to reduce my swap space

You must disable the swap first (see above).
marco26 wrote:i forgot to encrypt the second ssd before adding it to the volume

You realize that some of the data in /home will not be encrypted, so the encryption is useless ?
p.H
 
Posts: 83
Joined: 2017-09-17 07:12

Re: Running low on storage

Postby stevepusser » 2017-09-17 17:06

Swap space for hibernation does not have to be any bigger than the memory being used at the time of hibernation, and in fact can be considerably less if the hiber-file is compressed, which I believe is the default. I've always used a swap partition smaller than RAM. On a couple occasions where it was still too big to fit, the process went through it a second time and must have trimmed off some excess cache or something, because it then succeeded.
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: AzPainter 2.1.0, Pale Moon 27.5.0, Liquorix kernel 4.12-10, mpv 0.27.0, Kodi 17.3, 0ad 0.0.22, Mesa 13.0.6
User avatar
stevepusser
 
Posts: 8802
Joined: 2009-10-06 05:53

Re: Running low on storage

Postby Gaius » 2017-09-19 15:37

stevepusser wrote:..... if the hiber-file is compressed, which I believe is the default.

Hibernation File Compression requires additional functionality ('user space software suspend').
The package uswsusp is available in the Stretch repositories.


@OP: While 64GB of memory surely are entertaining to look at when monitoring system performance, I very much doubt your machine will ever use more than 8GB, if that.
Even heavy-duty video rendering doesn't require more than 32GB of memory.

So you will be perfectly fine with 16GB of swap (probably 8GB would do as well).
The rule of thumb of having swap space equalling your system memory is a remnant of times when personal machines were equipped with memory sizes of 256MB or 512MB.
Modern laptops and PCs don't make use of swap at all, except in very rare circumstances ... and for hibernation, of course.

On another note:
Have you considered using a swap file? You can install that on /home (or any other partition), and it is considerably easier to resize, should you need to extend or wish to shrink your available swap.
Have a look at this contribution in the Debian Wiki.

Cheers,
Gaius
If you can’t explain it simply, you don’t understand it well enough.
Albert Einstein
User avatar
Gaius
 
Posts: 32
Joined: 2012-12-18 10:54
Location: Germany

Re: Running low on storage

Postby marco26 » 2017-09-29 15:20

Sorry man, but you're really far off the mark with those assumptions.
marco26
 
Posts: 6
Joined: 2016-02-29 12:31

Re: Running low on storage

Postby Gaius » 2017-09-30 23:10

marco26 wrote:Sorry man, but you're really far off the mark with those assumptions.

Okay, you've convinced me you really need those 64GB of RAM.

... in addition, four populated memory slots look way cooler in the Window-Kit case, especially in combination with multiple RGB fans and strips, right?
If you can’t explain it simply, you don’t understand it well enough.
Albert Einstein
User avatar
Gaius
 
Posts: 32
Joined: 2012-12-18 10:54
Location: Germany


Return to General Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable