Use the fdisk and partprobe commands in Linux to create and format partitions without restarting the system (1)

Source: Internet
Author: User

Use the fdisk and partprobe commands in Linux to create and format partitions without restarting the system (1)

Due to work needs, I have been learning Linux for some time. To learn a new knowledge, I like to learn from a book or a certain video system, so that I can have a comprehensive understanding and understanding of the new learning knowledge. So before learning, I bought a private house dish of laruence as a reference book and started to study Linux systematically.

According to laruence's suggestion, an empty capacity is reserved for exercise partition during Virtual Machine installation. Therefore, when Linux system partition is installed on a virtual machine, only a 4G capacity is allocated to the root directory "/", and only a 2G swap partition is divided. There are still 14 GB capacity not allocated.

When learning disk management, use fdisk to continue partitioning the remaining capacity. However, after the partition is created, you cannot use partprobe to reload the partition.

The procedure is as follows:

1. Use fdisk to create a partition

....) The partition operation record is not saved. After executing the command w, the following information appears:

 
 
  1. Disk/dev/sda: 21.5 GB, 21474836480 bytes
  2. 255 heads, 63 sectors/track, 2610 cylinders
  3. Units = cylinders of 16065*512 = 8225280 bytes
  4. Sector size (logical/physical): 512 bytes/512 bytes
  5. I/O size (minimum/optimal): 512 bytes/512 bytes
  6. Disk identifier: 0x000b604c Device Boot Start End Blocks Id System
  7. /Dev/sda1*1 523 4194304 83 Linux
  8. Partition 1 does not end on cylinder boundary.
  9. /Dev/sda2 523 784 2097152 82 Linux swap/Solaris
  10. Partition 2 does not end on cylinder boundary.
  11. /Dev/sda3 784 2610 14672345 5 Extended
  12. /Dev/sda5 784 1421 5121671 83 LinuxCommand (m for help): w
  13. The partition table has been altered! Calling ioctl () to re-read partition table. WARNING: Re-reading the partition table failed with error 16: the device or resource is busy.
  14. The kernel still uses the old table. The new table will be used
  15. The next reboot or after you run partprobe (8) or kpartx (8)
  16. Syncing disks.
  17.  

Save the new partition and prompt "the device or resource is busy". The operation was performed on the/dev/sda hard disk and thought the prompt was normal, so ignore it and continue the next step.

2. Use partprobe to reload the partition table to avoid restarting the system.

 
 
  1. [Root @ stduy/] # partprobe
  2. Warning: WARNING: the kernel failed to re-read the partition table on/dev/sda (the device or resource is busy ). as a result, it may not reflect all of your changes until after reboot.
  3. Warning: you cannot open/dev/sr0 in read/write mode (read-only file system ). /Dev/sr0 is enabled in read-only mode.
  4. Warning: you cannot open/dev/sr0 in read/write mode (read-only file system ). /Dev/sr0 is enabled in read-only mode.
  5. Error: the Partition Table-/dev/sr0 is invalid and recursive partitions appear.

In the above information, the warning "the device or resource is busy, you need to restart the system to make the change take effect" is directly ignored as a normal phenomenon. However, the Error message "Error: Invalid Partition Table-/dev/sr0 indicates recursive partition ." I am a little confused. However, since the prompt "invalid Partition Table" is displayed, I will check the partition information.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.