In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Fdisk
Fdisk [option] changes the partition table
Fdisk [options]-l lists all partition tables
Fdisk-s gives the size of the specified partition in blocks.
This is a command to create and maintain partitions that are compatible with partition tables of type DOS and lists of disks of type BSD or SUN. Note that fdisk does not support hard disk partitions above 2T, so you need to use gdisk at this time.
Related understanding:
The number of heads (Heads) indicates that the hard disk has several heads, that is, there are several disks, and a hard disk has a maximum of 255heads.
The number of cylinders (Cylinders) indicates how many tracks there are on each side of the hard disk
The number of sectors (Sectors) indicates how many sectors there are on each track, with a maximum of 63 sectors per track
(1)。 Option
12 3 4 56 Musi b specifies sector size (512 Magi 1024 ref 2048 or 4096 B)-c turns off DOS compatibility mode-u indicates the starting address of each partition with sector number instead of cylinder number, generally in conjunction with the-l option-C specifies cylinder number-H specifies head number-S specifies track sector number
(2)。 Menu operation instructions:
12 3 4 5 6 7 8 9 10 11 12 13 14 15 16a set bootable flag (switch between active / boot partitions) b edit BSD disk label c set DOS operating system compatibility flag (switch between compatibility / incompatibility) d delete a partition l displays the known partition type, of which 82 is a Linux swap partition 83 display help information for Linux partition m to add a new partition o to create a new blank DOS partition table p display the disk's current partition table Q exit the fdisk program without saving any changes create a new blank Sun disk label t change a partition's system ID Is to change the partition type (such as changing the Linux Swap partition to the Linux partition) u change the display or enter the unit v verify the disk partition table w write the partition table to disk and exit (save and exit) x additional features (expert level)
(3)。 Expansion
The difference between sda and hda
1 2 3 4sd represents the SCSI,SATA interface hard disk hd represents the IDE interface hard disk sda and the last an of hda represents the first hard disk sda1 and hda1 represent the first partition of the hard disk
(4)。 Example
1)。 Use the-l option to list all partition tables
12 34 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 30 31 33 33 37 38 39 40 41 42 43 44 45 46 47 48 49 50 dev/sda:107.4G,107374182400 bytes (B), 255 heads, 63 sectors 13054 Cylindrical (track) * 1 Unit = 16065 Cylindrical (track) * 512 = 8225280 bytes (B) * sector size (logical / physical): 512 bytes / 512 bytes (B) * input / output size (minimum / optimal): 512 bytes (B) / 512 bytes (B) * disk ID: 0x00079700 * / Disk / dev/sda: 107.4 GB, 107374182400 bytes 255heads, 63 sectors/track 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00079700 / * device boot identification start location end location partition ID system (partition type) * / dev/sda1 * 1 64 512000 83 Linux * partition 1 does not end with a cylindrical boundary * / dev/sda2 64 13055 104344576 8e Linux LVM * / Device Boot Start End Blocks Id System / dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. / dev/sda2 64 13055 104344576 8e Linux LVM Disk / dev/sdb: 21.5GB, 21474836480 bytes 255heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I bytes O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk / dev/mapper/vg_centos6-lv_root: 53.7 GB, 53687091200 bytes 255 heads, 63 sectors/track 6527 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk / dev/mapper/vg_centos6-lv_swap: 4194 MB, 4194304000 bytes 255heads, 63 sectors/track 509 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk / dev/mapper/vg_centos6-lv_home: 49.0 GB, 48964304896 bytes 255heads, 63 sectors/track, 5952 cylinders Units = cylinders of 16065 * 512 = 8225 280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I Band O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
2)。 Use the-l and-u options to display all partition tables with sector numbers instead of cylinder numbers
12 34 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39Disk / dev/sda: 107.4 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylinders Total 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00079700 Device Boot Start End Blocks Id System / dev/sda1 * 2048 1026047 512000 83 Linux Partition 1 does not end on cylinder boundary. / dev/sda2 1026048 209715199 104344576 8e Linux LVM Disk / dev/sdb: 21.5GB, 21474836480 bytes 255heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I logical/physical O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk / dev/mapper/vg_centos6-lv_root: 53.7GB, 53687091200 bytes 255heads, 63 sectors/track, 6527 cylinders Total 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk / dev/mapper/vg_centos6-lv_swap: 4194 MB, 4194304000 bytes heads, 63 sectors/track, 509 cylinders Total 8192000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I bytes O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk / dev/mapper/vg_centos6-lv_home: 49.0 GB, 48964304896 bytes 255heads, 63 sectors/track, 5952 cylinders, total 95633408 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier 0x00000000
3)。 As you can see, my / dev/sdb is not yet in use, so let's use this hard drive to briefly demonstrate the operation menu mainly used by fdisk.
1. Under the actions menu, create a new partition
12 34 56 7 89 10 11 12 13 14 15 16 1718 19 20 21 22 23 24 26 27 28 30 31 33 34 36 37 38 39 40 41 42 43 44 45 46 47 48 49 51 53 55 56 57 58 59 60 [root@CentOS6 Desktop] # fdisk / dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xe8517189. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): n Command action e extended / / extended partition. Creating an extended partition will occupy one primary partition, and only after creating an extended partition can you create a logical partition p primary partition (1-4) / / primary partition. Create up to 4 e Partition number (1-4): 1 First cylinder (1-2610, default 1): / / starting cylinder Default is 1 Using default value 1 Last cylinder, + cylinders or + size {K Magna M Magi G} (1-2610, default 2610): / / termination cylinder The default is the last number Using default value 2610 Command (m for help): n Command action l logical (5 or over) / / logical partition p primary partition (1-4) / / main partition l First cylinder (1-2610, default 1): 1 Last cylinder, + cylinders or + size {K Magne M ·G} (1-2610, default 2610): + 10G / / termination cylinder can not only be represented by the number of cylinders. You can also express Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (1307-2610, default 1307) in + [numeric] [unit] format: Using default value 1307 Last cylinder, + cylinders or + size {K default M default G} (1307-2610, default 2610): Using default value 2610 Command (m for help): P Disk / dev/sdb: 21.5GB, 21474836480 bytes 255heads, 63 sectors/track 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xe8517189 Device Boot Start End Blocks Id System / dev/sdb1 1 2610 20964793 + 5 Extended / dev/sdb5 1 1306 10490382 83 Linux / dev/sdb6 1307 2610 10474348 + 83 Linux Command (m for help): W / / write to disk Save and exit, otherwise all previous operations are invalid. Use q The partition table has been altered if you don't want to write to disk! Calling ioctl () to re-read partition table. Syncing disks.
two。 Under the Action menu, delete a partition
12 34 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 26 27 28 30 31 32 33 35 36 37 38 39 40 41 [root@CentOS6 Desktop] # fdisk / dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): P Disk / dev/sdb: 21.5GB, 21474836480 bytes 255heads, 63 sectors/track 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I size O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xe8517189 Device Boot Start End Blocks Id System / dev/sdb1 1 2610 20964793 + 5 Extended / dev/sdb5 1 1306 10490382 83 Linux / dev/sdb6 1307 2610 10474348 + 83 Linux Command (m for help): d Partition number (1-6): 6 / the initial partition number entered here If you delete an extended partition The logical partition under the extended partition will also be deleted Command (m for help): P Disk / dev/sdb: 21.5GB, 21474836480 bytes 255heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I bytes O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xe8517189 Device Boot Start End Blocks Id System / dev/sdb1 12610 20964793 + 5 Extended / dev/sdb5 11306 10490382 Linux Command (m for help): w The partition table has been altered! Calling ioctl () to re-read partition table. Syncing disks.
3. Under the Action menu, modify the partition type
12 34 56 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): t Partition number (1-5): 5 / / which partition Hex code (type L to list codes): l / / you will be prompted here to view the list of types 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 1 FAT12 39 Plan 9 82 Linux swap / So C1 DRDOS/sec (FAT- 2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT- 3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: C6 DRDOS/sec (FAT- 4 FAT16)
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.