របៀបបង្កើន (ធ្វើឱ្យប្រសើរឡើង) ការផ្ទុកនៅលើ Debian


សេចក្តីផ្តើម
+ You have probably experienced the confusing situation when you:
1) Upgrade Cloud Server’ storage (purchase extra storage).
2) Change to another package with higher storage capacity than the original package
+ But you observe that your server’s storage capacity has not increased
→ ហេតុផលគឺអ្នកមិនបានភ្ជាប់កន្លែងផ្ទុកបន្ថែមដែល 1Byte ផ្តល់ឱ្យ។
+ ការបង្រៀនពី 1Byte will instruct you on mounting your updated storage into Debian 11
+ In case you’re not using Debian, but rather Centos or Windows, you may read the corresponding posts here
1) Ubuntu
2) CentOS
3) Windows & Windows Server
4) Debian 11 (You are here)
+ If you’re utilizing Cloud Hosting គ្រាន់តែទាក់ទងជាមួយក្រុមជំនួយការរបស់ 1Byte នោះយើងនឹងមើលថែគ្រប់យ៉ាងសម្រាប់អ្នក។
+ If you apply this post to a service provided by a provider other than 1Byte, we will not guarantee that everything works as it should
តម្រូវការជាមុន
+ ការរត់ Debian 11 ត្រូវបានដំឡើងកំណែទំហំផ្ទុក
+ ទិន្នន័យគួរតែត្រូវបានបម្រុងទុកនៅក្រៅម៉ាស៊ីនមេ (ទៅកាន់ម៉ាស៊ីនមេផ្សេងទៀត ឬឧបករណ៍ផ្ទុកអ៊ីនធឺណិតដែលមានមូលដ្ឋានលើ Cloud ឬទៅកុំព្យូទ័រ/កុំព្យូទ័រយួរដៃក្នុងតំបន់របស់អ្នក) មិនត្រឹមតែនៅលើម៉ាស៊ីនមេដែលអ្នកកំពុងប្រើឥឡូវនេះនោះទេ។ ពិចារណាពីរបៀបដែលវាងាយស្រួល ដំណើរការពាក្យបញ្ជាខុស, choose wrong options ដែលនាំឱ្យលុបអ្វីៗទាំងអស់ចេញពីថាសរឹងដោយច្របូកច្របល់ជាមួយវា វាជាការល្អបំផុតដើម្បីចៀសវាងការធ្វើដូច្នេះ។
ចំណេះដឹងបន្ថែម
– `sda` is the device name for the first SCSI (or SATA) disk attached to your system. Device names for hard drives and other storage devices in Linux follow a standard naming convention, and sda is the device name for the first disk, sdb is the device name for the second disk, and so on. You can consider they are a letter drive C, D, E in Windows system
– `debian-vg` គឺជា logical volume (LV) that is used by Debian to store the root filesystem. It is created from the physical storage devices that are available on your system, and it is used to store the root filesystem, which is the top-level directory that contains all the files and directories on your system.
– On Linux, data is typically stored on a `partition` ឬ `logical volume`. ភាគថាសគឺជាផ្នែកមួយនៃឧបករណ៍ផ្ទុករូបវ័ន្ត ដូចជាថាសរឹង ដែលត្រូវបានប្រើដើម្បីរក្សាទុកទិន្នន័យ។ ម្យ៉ាងវិញទៀត បរិមាណឡូជីខល គឺជាឧបករណ៍ផ្ទុកនិម្មិតដែលត្រូវបានបង្កើតចេញពីឧបករណ៍ផ្ទុករូបវន្តមួយ ឬច្រើន។

ធ្វើការ
0) Check storage info of Debian
1) Backup important data (I will skip this step)
2) Create a new Partitions from Physical Hard Drive
3) ពង្រីកPartitionទៅក្រុមបរិមាណដែលអ្នកចង់ឱ្យវាផ្លាស់ប្តូរទំហំ
4) បន្ថែម Volume Group ទៅក្នុង Logical Volume
5) ឥឡូវនេះអ្នកអាចរក្សាទុកឯកសារប្រព័ន្ធលីនុចទៅក្នុងLogical Volume
ម្តងមួយជំហាន
0. ពិនិត្យមើលព័ត៌មានផ្ទុកនៃម៉ាស៊ីនមេរបស់អ្នក។
+ នេះ `lsblk
` ពាក្យបញ្ជាត្រូវបានប្រើដើម្បីរាយព័ត៌មានអំពីឧបករណ៍ទប់ស្កាត់នៅលើប្រព័ន្ធរបស់អ្នក។ នៅពេលអ្នករត់lsblk
`, វានឹងបង្ហាញបញ្ជីឧបករណ៍ទប់ស្កាត់ទាំងអស់ដែលភ្ជាប់ជាមួយប្រព័ន្ធរបស់អ្នក រួមជាមួយនឹងឈ្មោះឧបករណ៍ ទំហំ និងព័ត៌មានផ្សេងទៀតរបស់ពួកគេ
#Displays information about the block devices on your Server
lsblk
+ Let’s check out an example below


+ On the left image side shows an Cloud Server ដើម. If you add the sda1, sda2 & sda5 together, the total storage is 16GB
+ On the left and right image side, after upgrading storage, a 250GB ការកើនឡើងត្រូវបានបន្ថែមទៅ sda (physical hard drive) ។
+ However in the right image, when we attempt a sum of the sdas (sda1, sda2, sda3, and sda5). The part of sda3 is upgraded without asking The total capacity is still only 50GB។ ដូច្នេះ តើ 100GB ដែលនៅសល់ត្រូវបានរក្សាទុកនៅឯណា?
+ វិធីសាស្រ្តមួយផ្សេងទៀតដើម្បីពិនិត្យមើលការផ្ទុកនៅលើលីនុចគឺត្រូវប្រើ `df -Th
command.
`df
` តំណាងឱ្យ "disk free" ហើយវាបង្ហាញព័ត៌មានអំពីប្រព័ន្ធឯកសារនៅលើប្រព័ន្ធរបស់អ្នក រួមទាំងប្រភេទប្រព័ន្ធឯកសារ ទំហំសរុប ទំហំដែលបានប្រើ កន្លែងទំនេរ និងចំណុចម៉ោន។ នេះ។-T
ជម្រើសប្រាប់ `df
` ដើម្បីបង្ហាញប្រភេទប្រព័ន្ធឯកសារ និង `-h
` ជម្រើសប្រាប់វាឱ្យបង្ហាញទំហំក្នុងទម្រង់ "មនុស្សអាចអានបាន" (ឧ. ជា MB ឬ GB ជាជាងគិតជាបៃ)។
#Displays information about the file systems on your Server
df -Th

→ តាមរយៈពាក្យបញ្ជាទាំង 2 ខាងលើ យើងអាចបញ្ជាក់បានថា 1Byte បានផ្តល់ទំហំផ្ទុក 250GB បន្ថែមទៀតសម្រាប់ Server របស់អ្នក ប៉ុន្តែអ្នកនៅតែមិនអាចប្រើប្លុកផ្ទុកនេះបានទេ ព្រោះអ្នកមិនបានកំណត់រចនាសម្ព័ន្ធ Server របស់អ្នកឱ្យប្រើ Storage នេះទេ ហើយអ្នកមិនបានដាក់វាទេ។ កន្លែងផ្ទុកដែលត្រូវប្រើនៅឡើយ
1. បម្រុងទុកទិន្នន័យសំខាន់ៗនៅលើ Server របស់អ្នក
+ As mentioned in the Intro section, this article will not guide backup data because only you know what data is important, where the data is located to backup, …etc
2. បង្កើត Partition ថ្មីពី Disk
+ ការប្រើប្រាស់” fdisk ” ពាក្យបញ្ជាត្រូវបានប្រើដើម្បីបង្កើត និងលុបpartitionនៅលើhard drive
+ ហើយ hard drive ដែលយើងត្រូវធ្វើអន្តរកម្មគឺ sda។បន្ទាប់មកដំណើរការពាក្យបញ្ជាខាងក្រោម
#Proceed to interact with the sda
fdisk /dev/sda
#Press "m" to check the help menu of fdisk command

+ In general, in this step we will do the following 3 sub-steps
- ៨.១៖ បង្កើតpartitionថ្មី ក្នុងករណីរបស់ខ្ញុំ partitionនេះនឹងមានទំហំ 250GB (ទំហំផ្ទុកដែលយើងធ្វើឱ្យប្រសើរឡើង) → ពាក្យបញ្ជា "n" - បន្ថែមប្រភេទpartitionថ្មី។
- ៨.១៖ ប្តូរប្រភេទpartitionទៅជា LVM → ពាក្យបញ្ជា "t "- ផ្លាស់ប្តូរប្រភេទpartiton
- ៨.១៖ រក្សាទុកការផ្លាស់ប្តូរហើយចាកចេញ →ពាក្យបញ្ជា "w" - សរសេរតារាងទៅថាសហើយចេញ
#Step 1:
#1.1: Press " n " to create a new parititon
#1.2: Press " p " to choose primary partition type
#1.3: Press " Enter " to create new partition by default 3. Be careful with the ambiguous partition number
#1.4: Press " Enter " to get the new first sector. This will prevent overlap with existing sectors
#1.5: Press " Enter " to get the new last sector. This will prevent overlap with existing sectors

ចំណាំ:
+ គួរកត់សំគាល់ថា ក្នុងករណីប្រព័ន្ធរបស់ខ្ញុំបានបង្កើត partition លេខ3 → sda3
+ វាអាចទៅរួចសម្រាប់ករណី ប្រព័ន្ធរបស់អ្នកនឹងបង្កើតលេខមួយទៀត (not sda3) វាអាចជា sda4, sda5, sda6,…etc
#Step 2:
#2.1: Press " t " to switch partition type
#2.2: Press "partition number". In my case, partition number is 3 (sda3)
#2.3: Press " L " to list all types of partition
#2.4: Press " 8e " to choose partition type is Linux LVM

#Step 3:
#Type " w " to save all the changes and exit

3. ពង្រីកVolume Groupពីpartitionដែលបានបង្កើតថ្មី។
+ The ” ល។ ” ពាក្យបញ្ជាផ្តល់ព័ត៌មានvolume groupក្នុងទម្រង់ដែលអាចកំណត់រចនាសម្ព័ន្ធបាន ដោយបង្ហាញបន្ទាត់មួយក្នុងមួយvolume group
#Check logical volumne info
vgs

→ យើងត្រូវពង្រីកទំហំនេះបន្ថែមទៀត 250GB
#3.1 Expand volumne group
#3.3 Run `vgs` command again to check the result
vgs
#Remember to change your partition number as well as VG name correctly
vgextend debian-vg /dev/sda3
#3.3 Run `vgs` command again to check the result
vgs

+Volume group debian-vg now is extend up to 250GB
3. ពង្រីកLogical Volume (LM) ដើម្បីឈានដល់ការផ្ទុកអតិបរមានៃVolume Group
#Extend vgubuntu-root to /dev/sda4
lvextend /dev/debian-vg/root /dev/sda3
#and resize it
xfs_growfs /
#Verify Logical Volume again
lvs




+ As you can see, we are successfully extend the volume of debian–vg-root from 14.56GB ទៅ 248.56GB
+ ចុងក្រោយត្រូវរត់” lsblk ” again to check whether the storage of debian–vg-root reach to 248.50GB ឬមិនមែន?

ពាក្យចុងក្រោយ
+ បើអ្នកអានបានដិតដល់ សូមអបអរសាទរ!!!
+ សម្រាប់សំណួរ ឬចម្ងល់ផ្សេងៗក្នុងអំឡុងពេលដំណើរការដំឡើង សូមកុំស្ទាក់ស្ទើរក្នុងការទាក់ទងមកយើងខ្ញុំ
ឯកសារយោងច្រើនទៀត
+ ដើម្បីទទួលបានការផ្សព្វផ្សាយនិងព្រឹត្តិការណ៍ចុងក្រោយបំផុត សូមពិនិត្យមើល Link នេះ
+ ដើម្បីទទួលបានចម្លើយលឿនបំផុត ទំព័រ FAQ គឺជាកន្លែងដ៏ល្អបំផុតដើម្បីស្វែងរក
+ បន្តទស្សនាជាមួយ YouTube របស់ 1Byte ដើម្បីឱ្យវាកាន់តែមានភាពងាយស្រួលយល់
+ ដូចសព្វមួយដង 1Byte នឹងនាំអ្នកមកនូវខ្លឹមសារថ្មីៗ និងការផ្តល់ជូនផ្សេងៗនាពេលអនាគត។ សូមរង់ចាំមើលទាំងអស់គ្នា!!!