Linux disk partitions: fdisk partitions and parted partitions

Source: Internet
Author: User
Linux disk partition fdisk partition and parted partition disk physical structure track 63 sector sectors (sector) 512-byte cylindrical (cylinder) head partition: primary partition extended partition logical partition MBR (MasterBootRecord) primary boot record 4 primary partitions... linux disk partition fdisk partition and parted partition disk physical structure track 63 sector sectors (sector) 512-byte cylindrical (cylinder) head partition: primary partition extended partition logical partition MBR (Master Boot Record) the primary guide records four primary partitions, and an extended partition occupies the position of a primary partition. a maximum of 2 TB partitions can be created. up to one extended partition extension partition cannot be directly used to store data, the primary partition and logical partition cannot be formatted and can be used to store data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ Disk partition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. create a partition [root @ localhost ~] # Fdisk-l View disk partitions [root @ localhost ~] # Fdisk/dev/sdbCommand (m for help): m for help, run the Command actiona toggle a bootable flagb edit bsd disklabelc toggle the dos compatibility flagd delete a partition list known partition typesm print this menun add a new partitiono create a new empty DOS partition. tablep print the partition tableq quit without saving changess create a new empty Sun disklabelt change a partition's system idu c Hange display/entry unitsv verify the partition tablew write table to disk and exitx extra functionality (experts only) Command (m for help ): n create partition Command actione extended # extend Partition p primary partition (1-4) p # primary Partition partition number (1-4 ): 1 Primary Partition number First cylinder (1-10443, default 1): Using default value 1 Last cylinder, + cylinders or + size {K, M, G} (1-10443, default 10443): + 10G # specify the partition size 2. format [root @ localhost ~] # Mkfs. ext4/dev/sdb1 format the sdb1 Partition 3. create Mount directory mkdir/music create Mount directory 4. mount the file by using mount/dev/sdb1/music and use the new partition ==== cd/music === copy some files, test == ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Parted disk partition ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ Usage: parted [option]... [device [command [parameter]...] COMMAND: check minor to perform a simple check on the file system. cp [FROM-DEVICE] FROM-minor to-MINOR copies the file system TO another partition. help [COMMAND] prints the common help information, or the COMMAND information mklabel label type to create a new disk label (partition table) mkfs MINOR file system type in the file system where the MINOR creation type is "file system type" mkpart partition type [file system type] start point termination point create a partition mkpartfs partition type file system type start point termination click Create a partition with a file system move MINOR start point stop point move MINOR partition name MINOR name the partition number MINOR is named "name" print [MINOR] print partition table, or partition quit Exit program rescue start point stop point save the lost partition resize MINOR start point near "start point" and "end point" change the size of the file system rm MINOR deleted in the partition numbered MINOR for a select device with the id minor, select the device set MINOR flag. for a partition with the ID changed to MINOR, fdisk cannot be used for a large disk partition in linux, MBR partition tables only support 2 TB disks. Therefore, GPT partition tables must be used for disks larger than 2 TB. The following describes the specific steps: 1. there are two primary partitions (create the disk label mklable first, and then create the partition mkpart partition type) [root @ localhost ~] # Parted/dev/sdb # use parted to operate on the GPT disk and enter the interactive mode GNU Parted 1.8.1 Using/dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt # format the MBR disk as GPT (parted) print # print the current partition (parted) mkpart primary 0 4.5 TB # divide it into a primary partition (parted) of TB) mkpart primary 4.5 TB 12 TB # Split a 7.5T primary partition (parted) print # print the current partition (parted) quit to exit Information: Don't forget to update/etc/fstab, if necessary. 1 2. format it to ext4 and install the e4fsprogs package. x86_64 (yum install e4fsprogs. x86_64. [Root @ localhost ~] # Mkfs. ext4/dev/sdb1 [root @ localhost ~] # Mkfs. ext4/dev/sdb2 3. then mount the partition [root @ localhost] # mount-t ext4/dev/sdb1/bk [root @ localhost] # mount-t ext4/dev/sdb2/mail [root @ localhost ~] # Df-ThFilesystem Type Size Used Avail Use % Mounted on/dev/sda6 ext3 39G 9.4G 28G 26% // dev/sda1 ext3 122 M 13 M 103 M 12%/bootnone tmpfs 1004 M 0 1004 M 0%/dev/shm/dev/sdb1 ext4 4.1 T 194 M 3.9 T 1%/bk/dev/sdb2 ext4 6.8 T 179 M 6.4 T 1%/mail 4. finally, modify/etc/fstab and add the following two lines to enable automatic mounting upon startup. /dev/sdb1/bk ext4 defaults, noatime 1 2/dev/sdb2/mail ext4 defaults, noatime 1 2 related logs vsftpd debug OpenVPN server and client configuration 6 steps to deal with l2tp + ips under centos 6 The ec VPN server configures RHEL/CentOS/Fedora sources (EPEL, Remi, RPMForge, RPMFusion) and configures selinux, causing httpd to call ZendOptimizer. so error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ MBR backup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ MBR Master Boot Record (MBR), also known as the Master Boot sector, is the first sector that must be read when the computer accesses the hard disk after it is started, its 3D address on the hard disk is (cylindrical, head, sector) = (0, 0, 1 ). MBR is generated by a partition program (such as Fdisk and Parted). it does not depend on any operating system, and the hard disk boot program can be changed to implement multi-system boot. Backup mbr principles: it is better to copy the file to another computer after the backup to another local disk [root @ lichao520 music] # dd if =/dev/sda of =/music/sda-mbr.bak bs = 512 count = 1 backup to another machine [root @ lichao520 music] # scp sda-mbr.bak 10.0.0.253: /root/[root @ lichao520 music] # hexdump-C sda-mbr.bak to view the contents in the backup mbr, display in hexadecimal format and asc letters to destroy mbr [root @ lichao520 music] # dd if =/dev/zero of =/dev/sda bs = 512 count = 1 rescue mode 1. you can attach a CD to the optical drive and start it from the CD. Or boot from the network to the rescue mode 2. restore mbr from the backup disk or from the network backup
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.