To partition a hard disk using Shell scripting Automation

Source: Internet
Author: User

In a Linux system, you can use FDISK to partition the hard disk, but to manually execute a lot of commands, it is cumbersome to use, and now remember that a script with Fdisk is automatically executed.

1 #make Partition2Ddif=/dev/zero OF=/DEV/MMCBLK1 bs=1024x768Count=1024x768                              3FDISK/DEV/MMCBLK1 <<EOF4 N5 P6 1                                                                               7 2048                                                                            8+100M9 NTen P One 2                                                                                A                                                                                  -                                                                                  - T the 1                                                                                - C - a - 1                                                                                + W -Eof

The words of my hard drive are/DEV/MMCBL1K1

First erase the partition table,

Then use the Fdisk command to repartition him.

Here's a little command, << EOF.

This command keeps the command that is about to jump to another shell terminal to continue running in this terminal.

The end of the logo is EOF

The two empty lines in the middle represent the carriage return, the default meaning.

1 umount/dev/mmcblk1p1                                                           2 /dev/                                                  mmcblk1p13 umount/ dev/mmcblk1p2                                                           4 mkfs.ext3/dev/mmcblk1p2                                                        

The following is a format for him, the format is finished to write data.

To partition a hard disk using Shell scripting Automation

Related Article

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.