FDisk is a disk partitioning tool for Linux. It can divide a disk into multiple partitions and allocate space. How to use FDisk? The following small series will introduce you to the method of using FDisk partition in Linux, and explain it through examples.
fdsik disk can be divided into several zones, each partition can also specify the partition file systems, such as linux, fat32, linux, linux swap, fat16 and its Unix-like operating system File system, etc.; of course, when we use fdisk to partition the disk operation, it is not an end point. We need to format the partition as needed; such a partition can be used; this is similar to fdisk in DOS.
Usage:
For IDE hard disks, each disk has a device name: corresponding to the four IDE interfaces of the motherboard, the device names are: /dev/hda, /dev/hdb, /dev/hdc, /dev/hdd, etc.
If there is an IDE Raid card, then: /dev/hde, /dev/hdf, /dev/hdg, /dev/hdh.
For SCSI hard disks, the device name is /dev/sda, /dev/sdb… etc.
The command line usage of fdisk is: fdisk hard disk device name
After entering fdisk, first type ’m’ to display all the fdisk menus.
Retype ’p’ to display the current partition table status.
Type & rsquo;n’, add a partition, and then prompt you to select the partition type (basic partition or extended partition), and then select the partition number (1-4).
Note: Each hard disk can be divided into up to four primary partitions (including basic partitions and extended partitions),
where: basic partitions can be divided into up to four, and extended partitions can be divided into up to one. But the extended partition can be divided into multiple logical partitions (up to a few I have not tried, in short).
After selecting the partition type and partition number you want to create, you will be prompted to enter the starting cylinder, starting from 1;
Then enter the ending cylinder, you can enter the actual column. The number of faces can also be entered in the form of "+partition size", for example: +1024M means adding 1024M after the starting cylinder.
The device names of the primary partition are: /dev/hda1, /dev/hda2, /dev/hda3, /dev/hda4, and the device names of the logical partitions are: /dev/hda5, /dev/Hda6, /dev/hda7… and so on.
Type & rsquo;d‘, delete the partition, enter the partition number to delete. Note that when you delete an extended partition, all logical partitions are also deleted.
Type & rsquo;t‘, change the partition flag (this is the most essential part of Linux fdisk!), the new partition default flag is 83 (Linux Ext2), you can change it to 82 (Linux Exchange area), or & rsquo; b & rsquo; (FAT32), & rsquo; f & rsquo; (FAT32 Extend, only extended partition), & rsquo; 86 & prime; (NTFS). . . Wait for dozens of types.
In this way, friends who use multiple operating systems can use the Linux fdisk to partition all the partitions you want!
Type & rsquo;a’ to switch the partition activation switch. Please note: Each time you type, the selected partition will change between active and inactive, but you must ensure that only one partition is activated at the end. At this time, you can get the ’p’ command, and there will be a & rsquo;*’ number on the activated partition.
In addition to the above commands, there are several others, but they are not commonly used.
Finally, type & rsquo;w’, the changes you made to the partition are written to the hard disk; type ’q’, then discard all changes.
Flexible application of fdisk can also repair some corrupted partition tables, provided you have to accurately remember the starting and ending cylinders of each partition.
Add another way to format the hard disk: To format the partition into Linux Ext2 format, use: mkext2fs /dev/hda? To format the partition into FAT32 format, use: mkfs.vfat /dev/hda?
Instances, view machine status via fdisk -l:
Number of hard disks and partitions
[root@localhost beinan]# fdisk -l
Disk /dev/hda: 80.0 GB,80026361856bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 765 6144831 7 HPFS/NTFS
/dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
/Dev/hda3 2806 9729 55617030 5 Extended
/dev/hda5 2806 3825 8193118+ 83 Linux
/dev/hda6 3826 5100 10241406 83 Linux
/dev/hda7 5101 5198 787153+ 82 Linux swap /Solaris
/dev/hda8 5199 6657 11719386 83 Linux
/dev/hda9 6658 7751 8787523+ 83 Linux
/dev/hda10 7752 9729 15888253+ 83 Linux
Disk /dev/sda: 1035 MB, 1035730944 bytes
256 heads, 63 sectors/track, 125 cylinders
Units = cylinders of 16128 * 512 = 8257536 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 25 201568+ c W95 FAT32 (LBA)
/Dev/sda2 26 125 806400 5 Extended
/dev/sda5 26 50 201568+ 83 Linux
/dev/sda6 51 76 200781 83 Linux
With the above information, We know that there are two hard drives (or mobile hard drives) mounted on this machine, one of which is hda and the other is sda; if we want to see a single hard drive, we can use fdisk -l /dev/hda1 or fdisk -l /dev/sda1 To operate; the hard disk ID output by fdisk -l shall prevail; hda has three primary partitions (including extended partitions), which are the primary partitions hda1 hda2 and hda3 (extended partitions); the logical partitions are hda5 to hda10;
where sda has two primary partitions (including extended partitions), namely sda1 and sda2 (extended partition); logical partition is sda5 hda6; total hard disk capacity = total capacity of primary partition (including extended partition)
Extended partition capacity = logical partition total capacity pass In the above example, we can know hda=hda1+hda2+hda3, where hda3=hda5+hda6+hda7+hda8+hda9+hda10
The above is the method of Linux partitioning through FDisk, if You are not satisfied with the layout of the disk, or reinstall the system, you can use FDisk for partitioning.
Linux character interface is easy to be boring for a long time. If you add a person
In Linux system operation, abnormal traffic and other issues are encountered during security monitor
Linux users often use the scp and sftp commands when transferring remote files. How
Those who have used Ubuntu system know that there is a software center in Ubuntu sy
How to install the openssh service on openSUSE
How Linux distinguishes between install command and cp command
How does the CentOS system remove IP from the Fail2ban blacklist
How Linux uses commands to free memory
How to install Eclipse and PyDev extensions in Ubuntu 14.04?
Ubuntu 32/64 bit how to install music tag editor Kid3
How does the Linux system simulate the get or post request of Http?
Linux installation GBK/GB2312 program shows garbled how to do?
What should I do if ORA-12528 reports an error when building DataGuard in Linux?
Linux settings wget download http /https proxy method
How about the compatibility of Win10 Technology Preview?
What should I do if the windows photo gallery viewer is not available?
Win7 main process Rundll32 has stopped working how to solve
Baidu cloud address book viewing method
How to add the "Open this file with Notepad" menu option under Windows system
Linux device files and regular files
IE10 Flash plugin cannot be used under Win8 system
Linux squid proxy server installation and configuration
How to find the shadow of the past to let WinXP restore the old-fashioned face