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 parted command in Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to use the parted command in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Linux common commands parted command is a powerful disk partition and partition resizing tool developed by the GNU organization. Unlike fdisk, it supports resizing partitions.

Parted disk Partition and Partition Sizing tool

As a tool designed for Linux, it is not built to handle multiple partition types associated with fdisk, but it can handle the most common partition formats, including: ext2, ext3, fat16, fat32, NTFS, ReiserFS, JFS, XFS, UFS, HFS, and Linux swap partitions.

Syntax parted (options) (parameters) option-h: displays help information;-I: interactive mode;-s: script mode without prompting the user;-v: displays the version number. Parameter device: specify the device file corresponding to the hard disk to be partitioned

Command: the parted command to execute.

Since the emergence of serial technology, more and more users have chosen to use large-capacity SATA hard drives to create disk arrays; in particular, MD1000/MD3000 can easily break through 2T LUN, so I will give you some guidance here.

Red Hat Enterprise Linux 4 Update 4 provides support for disk devices greater than 2 terabytes (TB).

Please refer to the following procedure:

Note:

Green represents the commands you need to use.

Red represents the output information you need to pay attention to, which you need to use later.

[root@localhost] # fdisk-l Disk / dev/sda: 35.8GB, 35862976512 bytes 255heads, 63 sectors/track 4360 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks id System / dev/sda1 * 1 13 104391 83 Linux / dev/sda2 14 144 1052257 + 82 Linux swap / dev/sda3 145 4360 33865020 83 Linux Disk / dev/sdb: 2147 MB, 2147483648 bytes 255heads, 63 sectors/track 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk / dev/sdb doesn't contain a valid partition table [root@localhost] # parted / dev/sdb GNU Parted Copyright (C) 1998-2004 free Software Foundation, Inc. This program is free software, covered by the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Disk geometry using / dev/sdb (parted) mklabel gpt (parted) print / dev/sdb: 0.000-2048.000 megabytes disk label type: gpt Minor start and end point file system name flag (parted) mkpart primary 0 2048 (parted) print / dev/sdb disk geometry: 0.000-2048.000 megabyte disk label type : gpt Minor start point end point file system name flag 1 0.017 2047.983 (parted) quit if necessary Don't forget to update / etc/fstab.

[root@localhost] # fdisk-l Disk / dev/sda: 35.8GB, 35862976512 bytes 255heads, 63 sectors/track 4360 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System / dev/sda1 * 1 13 104391 83 Linux / dev/sda2 14 144 1052257 + 82 Linux swap / dev/sda3 1450 4360 33865020 83 Linux WARNING: GPT (GUID Partition Table) detected on'/ devamp sdbstores! The util fdisk doesn't support GPT. Use GNU Parted. Disk / dev/sdb: 2147 MB, 2147483648 bytes 255heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System / dev/sdb1 1262 2097151 + ee EFI GPT Partition 1 has different physical/logical beginnings (non-Linux?): phys= (0lad 0,1) logical= (0L 0,2) Partition 1 has different physical/logical endings: phys= (1023,254,63) logical= (261,21) 16) [root@localhost ~] # mkfs.ext3 / dev/sdb1 mke2fs 1.35 (28-Feb-2004) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 262144 inodes, 524279 blocks 26213 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=536870912 16 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768,98304,163840,229376 294912 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 28 mounts or 180 days, whichever comes first. Use tune2fs-c or-i to override. [root@localhost ~] # mount / dev/sdb1 / mnt [root@localhost ~] # df-h Filesystem capacity available available mount point / dev/sda3 32G 2.6G 28G 9% / / dev/sda1 99m 12m 82m 13% / boot none 252m 0252m 0% / dev/shm / dev/sdb1 2.0g 36m 1.9g 2% / mnt is all the contents of the article "how to use parted commands in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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