Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
guntiss committed Aug 29, 2024
1 parent 61b7d97 commit feea9cc
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
52 changes: 52 additions & 0 deletions _drafts/lvm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: "Do I need LVM?"
date: 2024-08-20
---

If you've ever install Linux OS you'll most likely have gone through disk partitioning.

As a default installer suggests using LVM. I had this question to myself quite often - "Do I need LVM, or not?", usually just keeping the default option.

## What is LVM

As stated on the interwebz:
> The most obvious benefit of LVM is that it provides an easy and flexible way to scale storage capacity. Admins can scale capacity up or down as users' storage needs change by simply adding or removing extents from an LV.
Also good read - https://www.reddit.com/r/linux/comments/6w046b/to_lvm_or_not_to_lvm_that_is_the_question/

## Expanding disk

In case you run out of virtual disk space and resize it, you will need to make some adjustments. For LVM this is slightly:
```sh
lsblk # find disk name
echo 1 > /sys/class/block/sda/device/rescan
lsblk # size should now be expanded
growpart /dev/sda 3 # extetend parittion to use whole disk
pvresize /dev/sda3
lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv # Use name from `df -h /`
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
```

If there was no LVM, you would be done after `growpart` command.

## Performance

My usual case is running Docker or kubernetes.

I'll just copy answer from [stackoverflow post](https://devops.stackexchange.com/a/19625) that summarizes it quite well:
<blockquote>
1. Is this intended/expected?
Yes, it can be expected. The overlay2 storage driver operates at the file level, and when combined with LVM, there can be additional overhead due to the abstraction layer that it introduces. Thus, slower performance compared to using a direct ext4 filesystem.


2. Is a LVM a recommended setup for Docker usage?
LVM is not typically recommended for Docker’s overlay2 storage driver due to the potential performance overhead. Docker’s documentation suggests using overlay2 with a direct filesystem like ext4 or xfs for better performance. LVM can be useful for other purposes, such as managing disk space more flexibly, but it might not be ideal for Docker’s storage needs.
</blockquote>


## Conclusion

If you plan to use single partition, just go without LVM.

But keep in mind:
> You don't need it, until you do.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Linux OS backups and migration using rsync"
title: "Using rsync for backups and OS cloning"
date: 2024-08-21
---

Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions _posts/2024-08-23-vscode-remote.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
title: "VSCode connect to remote host without internet"
title: "Connect to airgapped host using VSCode"
date: 2024-08-24
---

Working in airgapped or firewalled environment can be though, when you don't have access to internet.

If you already have VSCode server installed on your local machine (WSL in my case) and you'll try to connect to remote server for first time - VSCode will still try to download some files from internet to this server. And in case this server does not have access to Internet It will fail and you will not be able to connect.
Hopefully you already have VSCode server installed on your local machine (WSL in my case) which is working fine. But when you try to connect to remote server for first time - VSCode will still try to download some files from internet to this server instead of transferring from your device. And in case this server does not have access to Internet It will fail and you will not be able to connect.

Luckily a found a super simple workaround. All you have to do is copy your local `.vscode-server` directory to remote server:
Luckily I have found a super simple workaround for this problem. All you have to do is copy your local `.vscode-server` directory to remote server:

```sh
scp -r .vscode-server remoteserver:
```

As a bonus, you will also have all extensions pre-installed on remote host. Make sure you have set up `remoteserver` [SSH Alias](./2024-07-22-ssh-cheats.md#ssh-aliases) set up.
As a bonus, you will also have all extensions pre-installed on remote host. Make sure you have set up `remoteserver` [SSH Alias](./2024-07-22-ssh-cheats.
md#ssh-aliases) set up.

Note: `scp` is slow, better alternative would be to use [rsync](./2024-07-21-rsync-backups.md) or create tar/zip archive first, uploading it and extracting at destination host.

0 comments on commit feea9cc

Please sign in to comment.