Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the partprobe command of Linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use the partprobe command of Linux". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use the partprobe command of Linux.

The Linux common command partprobe command is used to reread the partition table, and when a file is deleted, it still takes up space. Partprobe can reread the partition without rebooting.

Reread the partition without restarting partprobe

Syntax partprobe (options) (parameters) option-d: do not update the kernel;-s: display summaries and partitions;-h: display help;-v: display version information. Parameter device: specify the device file corresponding to the hard disk that needs to confirm the partition table change.

The instance uses partprobe to add new disk partitions without rebooting the system. The hard disk of the host exceeds the 300GB. Currently, only 3 primary partitions are used, less than 70GB, as follows:

[root@localhost] # df-h Filesystem Size Used Avail Use% Mounted on / dev/sda1 29G 3.7G 24G 14% / / dev/sda2 29G 22G 5.2G 81% / oracle tmpfs 2.0G 02.0G 0% / dev/shm [root@localhost ~] # cat / proc/partitions major minor # blocks name 80 311427072 sda 81 30716248 sda1 8 2 30716280 sda2 8 3 8193150 sda3 8 16 976896 sdb 8 32 976896 sdc … Omit the other space that now needs to add a 100GB to the system to store data files without affecting the operation of the business on the existing system, use fdisk combined with partprobe command not to restart the system to add a new disk partition. The steps are as follows:

Step 1: add a new disk partition:

[root@localhost] # fdisk / dev/sda The number of cylinders for this disk is set to 38770. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of lilo) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) command (m for help): P Disk / dev/sda: 318.9 GB, 318901321728 bytes 255heads, 63 sectors/track 38770 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks id System / dev/sda1 * 1 3824 30716248 + 83 Linux / dev/sda2 3825 76483071628083 Linux / dev/sda3 76498668 819315082 Linux swap / Solaris Command (m for help): n Command action e extended p primary partition (1-4) p Selected partition 4 First cylinder Default 8669): Using default value 8669 last cylinder or + size or + sizeM or + sizeK (8669-38770, default 38770): + 100G Command (m for help): w The partition table has been altered! Calling ioctl () to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. Step 2 use the tool partprobe to let kernel read the partition information:

[root@localhost ~] # partprobe uses the fdisk tool only to write partition information to disk. If you need mkfs disk partitions, you need to restart the system, while using partprobe can make kernel read the partition information again, thus avoiding restarting the system.

Step 3 format the file system:

[root@localhost] # mkfs.ext3 / dev/sda4 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 12222464 inodes, 24416791 blocks 1220839 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 746 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768,98304,163840,229376,294912,819200,884736,1605632,2654208,4096000, 7962624,1123942420480000 23887872 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 26 mounts or 180 days, whichever comes first. Use tune2fs-c or-i to override. [root@localhost ~] # step 4 mount new partition / dev/sda4:

[root@localhost ~] # e2label / dev/sda4 / data [root@localhost ~] # mkdir / data [root@localhost ~] # mount / dev/sda4 / data [root@localhost ~] # df Filesystem 1K-blocks Used Available Use% Mounted on / dev/sda1 29753556 3810844 24406900 14% / / dev/sda2 29753588 11304616 16913160 41% / oracle tmpfs 2023936 0 2023936 0 % / dev/shm / dev/sda4 96132968 192312 91057300 1% / data use partprobe to create new partitions with the fdisk tool without rebooting the system.

Thank you for your reading, the above is the content of "how to use the partprobe command of Linux". After the study of this article, I believe you have a deeper understanding of how to use the partprobe command of Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report