Most Recent

Seo Services

How to resize a non-LVM ext3 partition with "parted" command when found "Error: File system has an incompatible feature enabled"

How to resize a non-LVM ext3 partition with "parted" command when found "Error: File system has an incompatible feature enabled"

 Customer run Oracle Linux 5 as Guest OS On VMware ESXi host and need to increase the disk size on the existing /dev/sda device.

the target partition is /dev/sda3 which mounted in /oracle directory with ext3 filesystem type.

First, try to use "parted" with following format:

(parted) resize NUMBER START END

(replace NUMBER START END with values that shown from "print free".

For this case, 

(parted) resize 3 298GB 1268GB

The actual results, shown the error as below:

Error: File system has an incompatible feature enabled.


Solution:

The following below are steps to increase size on the target partition in Linux.

1. Reboot the Guest OS or run the following command to detect new disk space

# echo “- - -” > /sys/class/scsi_host/host*/scan

(Note: This step has done and customer got the error when using above command to increase disk size.)

2. Check the partition table

# fdisk -l 

3. unmount the partition

# umount /oracle

3. using parted to manage disk

# parted  /dev/sda

(parted)

- print the current partition table

(parted) print

- print the current partition table with free space available and record the number in End column in "Free Space" line

(parted) print  free

- Remove the partition the need to increase size

(parted) rm 3

- Make this partition again with new size

(parted) mkpart

Partition type? Primary/Extended? Primary

Filesystem type ? [ext2]? ext3

Start? 298GB                             (Start number in the previous sda3)

End? 1268GB                            (the number of End that shown in "Free Space" line)

- Recheck partition size for /dev/sda3

(parted) print

(parted) quit

4. Verify /dev/sda3 filesystem

# e2fsck  /dev/sda3

5. Resize the filesystem 

# resize2fs  /dev/sda3

6. Remount filesystem

# mount  /oracle

7. Check the size after resize completed

# df -h


Everything work fine.


Wisoot Amatariyakul


How to resize a non-LVM ext3 partition with "parted" command when found "Error: File system has an incompatible feature enabled" How to resize a non-LVM ext3 partition with "parted" command when found "Error: File system has an incompatible feature enabled" Reviewed by Wisoot Amatariyakul on 12:47 AM Rating: 5

Boot Problem on CentOS(and other Linux) After migrate Server, it shown error about UUID does not exist

Boot Problem on CentOS(and other Linux) After migrate Server, it shown error about UUID does not exist


การแก้ไขในกรณีที่ทำการ migrate server ไม่ว่าจาก Physical Server มาขึ้นเป็น VM บน Cloud หรือ ข้าม Technology แล้วไม่สามารถ Boot ใช้งานได้และแสดง error 

Warning: /dev/disk/by-id/md-uuid-[long string of numbers and letters] does not exist

หรือ error อื่นๆที่เกี่ยวข้องกับ UUID



ขั้นตอนการแก้ไขมีดังนี้:

1. Boot จากไฟล์ ISO และเข้า Rescue mode โดยเลือก 3 เพื่อออกไปที่ shell





เลือก 1 เพื่อดำเนินการต่อ แล้วเปลี่ยน root filesystem มาที่ disk ด้วยคำสั่ง

# chroot  /mnt/sysimage

หรือ เลือก 3 เพื่อออกมาที่ shell แล้ว mount root และ boot partition ตามขั้นตอนที่ 3

Note: ขั้นตอนด้านล่าง (2 - 8) จะเป็นขั้นตอนเมื่อเลือก 3 สำหรับการดำเนินการ
          ในกรณีที่เลือก 1 การเปลี่ยนตำแหน่ง directory ให้ใช้ "cd /boot" แทน "cd /mnt/boot"
           และ "cd /" แทน "cd /mnt/root" เป็นต้น


2. ตรวจสอบ disk และโครงสร้าง disk ด้วยคำสั่ง "fdisk -l" และ "lsblk"

โดยที่

/dev/sda1      /boot

/dev/sda2      /

/dev/sda3     /tmp

/dev/sda5     swap

/dev/sda6     /var



3. mount disk partition ที่เป็น root ขึ้นมา

# mkdir /mnt/root
# mount /dev/sda2 /mnt/root
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot

3. ตรวจสอบค่า UUID ของ disk ด้วยคำสั่ง "blkid" ตัวอย่างเช่น

# blkid /dev/sda2
/dev/sda2: UUID="1f3785ea-8daf-42e1-8665-bc8a0fcac0f6f" TYPE="xfs"

หรือถ้าต้องการดูทั้งหมด

# blkid


4. แก้ไขไฟล์ /etc/fstab โดยใช้ค่า UUID ที่ได้จาก "lsblk" และ "blkid"

# cd /mnt/root/etc
# vi fstab

หรือ

# nano fstab

ดำเนินการแก้ไขค่า UUID ในกรณีที่ใช้ filesystem type "ext4", "xfs" รวมถึง swap


UUID=1f3785ea-8daf-42e1-8665-bc8a0fcac0f6f   /           xfs     defaults        0 0 UUID=f0efa4e8-8f54-47a6-a841-d271bde620c4 /boot         xfs     defaults        0 0 UUID=9456ce38-15a7-4ad3-9f83-30a67a326e67   swap        swap    defaults        0 0 UUID=d44d622e-0d3d-4a0d-8489-4eff50c1e661 /tmp xfs     defaults        0 0 UUID=22bd8b4e-dc70-4139-81bc-f4ee076d7eff /var xfs     defaults        0 0


5. แก้ไขไฟล์ /etc/default/grub

# cd /mnt/root/etc/default
# vi grub

ไปยังบรรทัดที่มี GRUB_CMDLINE_LINUX อยู่ และดำเนินการเปลี่ยนค่าแรกสำหรับ UUID ของ root และอีกค่าสำหรับ UUID ของ swap


6. ทุกครั้งที่ดำเนินการเปลี่ยน /etc/default/grub จะต้อง update ข้อมูลในไฟล์ /boot/grub2/grub.cfg ทุกครั้ง (ห้ามแก้ไขไฟล์นี้โดยตรง)

# cd /mnt/boot/grub2
# cp -p grub.cfg grub.cfg-ddmmyyyy
# grub2-mkconfig > grub.cfg

7. ตรวจสอบความถูกต้องของค่า UUID ในไฟล์ /boot/grub2/grub.cfg 

# more grub.cfg

8. umount boot and root

# cd /
# umount /mnt/boot
# umount /mnt/root

9. Reboot Server เพื่อใช้งาน

# Shutdown -r now
หรือ
# reboot




Boot Problem on CentOS(and other Linux) After migrate Server, it shown error about UUID does not exist Boot Problem on CentOS(and other Linux) After migrate Server, it shown error about UUID does not exist Reviewed by Wisoot Amatariyakul on 9:28 PM Rating: 5

Linux Training Course

Linux Training Course

รวบรวม Course อบรมสำหรับผู้สนใจเกี่ยวกับ Linux มีเนื้อหาครอบคลุมตั้งแต่ขั้นพื้นฐาน ระดับ admin และเนื้อหาเกี่ยวกับการตรวจสอบ Performance ระบบ

 Linux Basic Training

  • What is UNIX?
  • What is Linux?
  • Which Linux Distribution is better?
  • UNIX structures
  • Directories, Files, Inodes
  • File type
  • Access permissions
  • Special characters
  • Control characters
  • Pipes
  • Shell Variable
  • Process
  • Manual 
  • Login & Log out
  • Basic Commands
    • ls
    • cd, pwd
    • which, whereis
    • find, grep, file
    • su, sudo
    • rpm, yum, apt
    • cat, last, tail, touch
    • cp, mv, rm, ln, mkdir
    • chgrp, chsh, chmod, chown, newgrp, umask
    • id, whoami, who, w
    • ps, top
    • jobs, kill
    • tar, gzip
    • df, du, free
    • uname, hostname
    • fdisk
  • vi Editor


  • What is UNIX?
  • What is Linux?
  • Which Linux Distribution is better?
  • UNIX structures
  • Directories, Files, Inodes
  • File type
  • Access permissions


                                                                             Part 2/7

  • Special characters
  • Control characters


                                                                             Part 3/7

  • Control Character (Continue)
  • Pipes
  • Shell variable
  • Process
  • Manual (help)
  • Login & Log out
  • ls, cd, pwd, which, whereis, find, su
  • rpm, yum, apt
  • echo, cat
  • cp, mv, mkdir, rm
  • chgrp, chsh, chown, file, id, newgrp, grep


                                                                             Part 4/7

  • grep
  • chmod
  • umask


                                                                                Part 5/7

  • ln (hard, soft link)
  • last
  • Showing who is logged on (who, w)
  • tty
  • touch
  • more, tail
  • ps, top


                                                                                Part 6/7

  • nohup, jobs, kill
  • tar, gzip
  • df, du
  • uname, hostname
  • Showing disk partition
  • Showing CPU information
  • Showing memory information
  • Showing swap information
  • Showing network interface information
  • Showing network routing information


                                                                                 Part 7/7 

using vi Editor



Linux Administration Training

  • Kernel Configuration
  • User Administration
  • System Initialization
  • Process Management (cron)
  • Networking
  • Troubleshooting
  • Filesystem Management

Part 1/5

  • Kernel Configuration
  • User Administration


Part 2/5

  • User Administration (Continue)
  • System Initialization
  • Process Management (cron)


Part 3/5

  • Networking
  • Troubleshooting


Part 4/5 Filesystem Management

  • Partition Categories
  • SWAP partition
  • Partition Table
  • Manage Disk Partition


Part 5/5 Filesystem Management

  • Filesystem Integrity
  • Software RAID
  • LVM




Linux Performance Monitoring Training

• Major Resource

• Common performance concerns

• Numbers to notice

• Behaviors to notice

• Monitoring Tools

• OS Performance

• Performance Monitoring – CPU Utilization

• Performance Monitoring – Memory Utilization

• Performance Monitoring – I/O Utilization

• Performance Monitoring – network




หวังว่าคงช่วยให้ท่านที่สนใจได้รับความรู้ไม่มากก็น้อย

วิสูจน์ อมตาริยกุล


Linux Training Course Linux Training Course Reviewed by Wisoot Amatariyakul on 8:16 PM Rating: 5

Linux : วิธีการเปลี่ยน partition ให้มากกว่า 4 partition ในกรณีมีเนื้อที่เหลือแต่ partition เต็ม 4 Primary partition

 วิธีการเปลี่ยน partition ให้มากกว่า 4 partition ในกรณีมีเนื้อที่เหลือแต่ partition เต็ม 4 Primary partition

ขั้นตอนที่จะดำเนินการต่อไปนี้จะต้องมี disk อีก 1 ลูกที่มีเนื้อที่มากกว่าหรือเท่ากับ primary partition ที่ 4

ในตัวอย่างจะทำการเปลี่ยน partition #4 ของ disk /dev/sdf (/dev/sdf4) เพื่อให้สามารถใช้งานเนื้อที่ที่เหลือได้



ขั้นตอนที่ 1 ทำการเพิ่ม disk ก้อนใหม่เข้ามา และทำการ create partition ให้เรียบร้อย โดยที่มี partition ที่ต้องการนำมาใช้มีขนาด มากกว่าหรือเท่ากับ primary partition ที่ 4


ในที่นี้จะใช้ partition /dev/sdg11 มาใช้ในการดำเนินการ

ก่อนอื่นให้เปลี่ยน partition type เป็น LVM ก่อน

# fdisk /dev/sdg


ขั้นตอนที่ 2 เพิ่ม disk /dev/sdg11 ไปยัง Volume group ที่ต้องการ

#  pvs


# vgextend vg-test /dev/sdg11

# pvs


# df -h 


ขั้นตอนที่ 3 นำ partition ที่ 4 ของ disk เก่าออกจาก volume group

แสดงข้อมูลปัจจุบันของ volume group

# pvs


ย้ายข้อมูลจาก /dev/sdf4 ไปยัง /dev/sdg11

#  pvmove /dev/sdf4


ตรวจสอบ disk

# pvs



ทำการลบ disk ออกจาก volume group

# vgreduce vg-test /dev/sdf4


แสดงข้อมูลปัจจุบันของ volume group อีกครั้ง

# pvs


ลบ LVM partition type 

# pvremove /dev/sdf4


ขั้นตอนที่ 4 เปลี่ยน Partition type จาก primary เป็น Logical 

# fdisk /dev/sdf

ลบ partition ที่ 4


สร้าง Extended partition เพื่อการใช้งานแบบ logical partition


สร้าง logical parttion ตามต้องการ สามารถสร้างได้ตั้งแต่ 5 ถึง 12




 

ทำการบันทึกก่อนออกจากคำสั่ง fdisk


ขั้นตอนที่ 5 เพิ่ม disk /dev/sdf5 ไปยัง Volume group ที่ต้องการ


# vgextend  vg-test /dev/sdf5


แสดงข้อมูลปัจจุบันของ volume group อีกครั้ง


ขั้นตอนที่ 6 นำ disk /dev/sdg11 ออกจาก volume group

ย้ายข้อมูลจาก /dev/sdg11 ไปยัง /dev/sdf5

# pvmove /dev/sdg11



ทำการลบ disk ออกจาก volume group

# vgreduce vg-test /dev/sdg11


แสดงข้อมูลปัจจุบันของ volume group อีกครั้ง


ลบ LVM partition type 

# pvremove /dev/sdg11



หลังจากนี้ก็สามารถใช้งานเนื้อที่ที่เหลืออยู่ได้ตามต้องการ 


https://www.youtube.com/watch?v=91FfRqFOilo

Linux : วิธีการเปลี่ยน partition ให้มากกว่า 4 partition ในกรณีมีเนื้อที่เหลือแต่ partition เต็ม 4 Primary partition Linux : วิธีการเปลี่ยน partition ให้มากกว่า 4 partition ในกรณีมีเนื้อที่เหลือแต่ partition เต็ม 4 Primary partition Reviewed by Wisoot Amatariyakul on 2:08 AM Rating: 5

How to disable shutdown and reboot commands in Linux

 คำสั่ง shutdown ใช้ตั้งเวลาก่อนที่ระบบ Linux จะ down แบบ halt, power off หรือ reboot เครื่อง ขึ้นอยู่กับ option ที่ระบุมาพร้อมกับคำสั่ง และคำสั่ง reboot ใช้ในการ restart เครื่อง

บทความนี้จะกล่าวถึงการยกเลิกการใช้งานคำสั่ง shutdown และ reboot สำหรับผู้ใช้งานทั่วไป 

วิธีที่ง่ายในการยกเลิกการใช้งานคำสั่ง shutdown และ reboot โดยการแก้ไขไฟล์ /etc/sudoers โดยสามารถระบุผู้ใช้ หรือกลุ่มของผู้ใช้ที่มีสิทธิ์ใช้งานคำสั่ง sudo ที่จะไม่อนุญาตให้ใช้งานคำสั่งเหล่านี้

# vi /etc/sudoers                                                                                                                        

เพิ่มบรรทัดเข้าไปในส่วน Command Alias

Cmnd_Alias SHUTDOWN = /sbin/shutdown,/sbin/reboot,/sbin/halt,/sbin/poweroff        


ถ้าไม่อนุญาตผู้ใช้ชื่อ tsombat ใช้งาน

# User privilege specification                                                                                                   

tsombat   ALL=(ALL:ALL) ALL, !SHUTDOWN                                                                 



ถ้าไม่อนุญาตผู้ใช้ที่อยู่ในกลุ่มที่มีสิทธิ์ใช้งานคำสั่ง sudo 

# Allow members of group sudo to execute any command                                                  

%wheel  ALL=(ALL:ALL) ALL, !SHUTDOWN                                                                

ทดสอบใช้งานคำสั่งจากผู้ใช้ที่อยู่กลุ่มที่ใช้คำสั่ง sudo


นอกจากนี้ยังมีวิธีอื่นที่ใช้ป้องกันผู้ใช้ทั่วไปใช้งานคำสั่งเหล่านี้โดยการเปลี่ยนแปลงสิทธิ์ในคำสั่ง shutdown และ reboot (สำหรับ CentOS/RedHat version 6.x หรือต่ำกว่า)

# chmod o-x /sbin/shutdown                                                                                                       

# chmod o-x /sbin/reboot                                                                                                             


ถ้าเป็น CentOS/RedHat version 7 หรือสูงกว่า (หรือ Linux ตระกูลอื่นที่ใช้งาน systemctl) คำสั่ง /sbin/shutdown, /sbin/poweroff, /sbin/halt และ /sbin/reboot จะทำ symbolic link ไปยังคำสั่ง /bin/systemctl


ดังนั้นการป้องกันไม่ให้ผู้ใช้งานอื่นๆนอกจาก root สามารถใช้งานคำสั่งเหล่านี้ จะต้องเปลี่ยนแปลงสิทธิ์ของคำสั่ง /bin/systemctl 

# chmod o-x /bin/systemctl                                                                                                           

อ้างอิง url:
https://www.tecmint.com/disable-shutdown-and-reboot-commands-in-linux/

How to disable shutdown and reboot commands in Linux How to disable shutdown and reboot commands in Linux Reviewed by Wisoot Amatariyakul on 8:52 PM Rating: 5
ads 728x90 B
Powered by Blogger.