Disk Manage
ข้อควรรู้ !!!
/dev/s[x][x] จะมีตัวอักษรและตัวเลขที่ไม่เหมือนกัน ขึ้นอยู่กับการติดตั้งและกำหนดชื่อ sda1 sdb2 ของแต่ละเซิร์ฟเวอร์
New disk
คำสั่งแสดงรายการ disk
fdisk -lDisk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectorsคำสั่งจัดการ disk
fdisk /dev/sdbCommand (m for help): n
Select (default p): [ENTER]
Partition number (1-4, default 1): [ENTER]
First sector (2048-20971519, default 2048): [ENTER]
Last sector... : [ENTER]
Created a new partition 1 of type 'Linux' and of size 10 GiB.Command (m for help): w
คำสั่งแสดงรายการ disk
fdisk -lDisk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
...
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 20971519 20969472 10G 83 Linuxคำสั่งกำหนด ext4 system type
mkfs.ext4 -F `/dev/sdb1`สร้างแฟ้มที่ต้องการจะ mount
mkdir /opt/databaseคำสั่ง mount disk
mount /dev/sdb1 /opt/databaseเพิ่มคำสั่งที่ไฟล์ /etc/fstab
vi /etc/fstab/dev/sdb1 /opt/database ext4 defaults,nofail,discard 0 0Extend partition
ขั้นตอนการขยาย disk ให้มีพื้นที่มากขึ้นจาก
10GBเป็น20GBจะต้องเพิ่มขนาด disk ใน nutanix ก่อนเป็นลำดับแรกตรวจสอบพื้นที่ disk ด้วยคำสั่ง
bash$ df -hT # Filesystem Type Size Used Avail Use% Mounted on # ... # /dev/sdb1 ext4 9.8G 24K 9.3G 1% /opt/databaseให้ umount /PARTITION|PATH ก่อนการ extend
bashumount /opt/databaseคำสั่งจัดการ disk
bashfdisk /dev/sdbCommand (m for help):
pCommand (m for help): p Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors Disk model: VDISK Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 1048576 bytes Disklabel type: dos Disk identifier:Command (m for help):
dSelected partition 1 Partition 1 has been deletCommand (m for help):
nPartition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions)Select (default p):
[ENTER]Partition number (1-4, default 1):
[ENTER]First sector (2048-94371839, default 2048):
[ENTER]Last sector... :
[ENTER]Do you want to remove the signature? [Y]es/[N]o:
NCommand (m for help):
wReboot
bashrebootResize disk
bashresize2fs /dev/sdb1หลังจากขยายพื้นที่ disk ตรวจสอบ disk ด้วยคำสั่ง
bash$ df -hT # Filesystem Type Size Used Avail Use% Mounted on # ... # /dev/sdb1 ext4 20G 24K 19G 1% /opt/database