| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
- Django
- MyAnimeList
- Classes
- JSON
- Filecoin
- project
- .gitignore
- directories
- MySQL
- API
- DATABASE
- noob
- python
- basics
- pandas
- forks
- commands
- ansible
- Methods
- GIT
- Linux
- Anime
- workbench
- github
- cached
- SCV
- crawler
- strings
- Jupyter Notebook
- Blockchain
- Today
- Total
제니 블로그
Creating a Partition + Using LVM 본문
What is LVM (Logical Volume Management)?
LVM is a form of storage virtualization that offers system admins a more flexible approach to managing disk storage space. In our case, it’s used for NVMe partitioning for workers. It could be described as a smart layer that sits between the physical hard drives and the operating system, giving you much more control and flexibility than rigid partitions.
We'll explore how to use it in this post.

This image shows that there are two disks in this server labeled as nvme0n1, and nvme1n1. The first nvme, nvme0n1 is already bound to the root filesystem, with LVM (Logical Volume Management).
Flow of Setting up LVM looks like this :
Physical Disks/Partitions → Initialize as Physical Volumes (PVs) → Combine into a Volume Group (VG) → Create Logical Volumes (LVs) from the VG → Format & Mount LVs.
Lets first create a partition for nvme1n1. We will be using 100% of the disk to combine it with the nvme0n1 VG, but user can decide the size of the partition.
sudo fdisk -l /dev/nvme1n1
# you will now enter the fdisk prompt press
g (If the disk was not GPT, this would create a new empty GPT partition table)
n (new partition)
Enter - Default partition number
Enter - accept default first sector
Enter- accept default last sector
# if you are absolutely sure that you don't care deleting the old one, proceed
p (print partition)
w (write table to disk and exit)
Check that partition exist
# Check
ls /dev/nvme1n1p1
#Format the disk (using the most common type ext4 - could also do XFS if software supports this format)
sudo mkfs.ext4 /dev/nvme1n1p1
Now we must create a physical volume for the new partition (pv)
sudo pvcreate /dev/nvme1n1p1
Now create a Volume Group (VG) Using the PVs
# Can create a new volume group
sudo vgcreate <VG name> /dev/nvme1n1p1 /dev/nvme0n1p1 ...
# OR extend the Volume group
sudo vgextend vgubuntu /dev/nvme1n1p1
Now that the volume group is made / have been extended, you must create a logical volume (LVs)
# sudo lvcreate -l (size in G or just Full 100%) -n lvdata <volume group name>
# could also be like <sudo lvcreate -L 10G -n lvdata vgubuntu>
# note this is to CREATE a new LV and not extend
sudo lvcreate -l 100%FREE -n lvdata vgubuntu
The LV must be formatted into a proper file system (unless you are just resizing the old existing LVM)
#Format the disk (using the most common type ext4 - could also do XFS if software supports this format)
sudo mkfs.ext4 /dev/vgubuntu/lvdata
# If extending the existing LV, an already existing format does not need formatting again :
# resize2fs exisiting lvm directory
sudo resize2fs /dev/vgubuntu/root
Finally the system can be mounted!
sudo mkdir /mnt/lvdata
sudo mount /dev/vgubuntu/lvdata /mnt/lvdata
You can now check with df -h if it has been successfully mounted.

I've resized it on root. Now it shwos that it has 7.2T worth of Storage, which means the disk has successfully been added to the LV.

'Building Blocks' 카테고리의 다른 글
| Setting up SSH Configurations (0) | 2025.05.26 |
|---|---|
| Using Ansible (0) | 2025.05.12 |
| Installing Ansible (0) | 2025.05.12 |
| Solving Leetcode : Longest common prefix (0) | 2023.03.15 |
| Using .gitignore (0) | 2023.03.09 |