root@ubuntu113:~# fdisk /dev/sdb Welcome to fdisk (util-linux 2.39.3). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS (MBR) disklabel with disk identifier 0x8e65a061. Command (m for help): p#查看当前分区表 Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors Disk model: Virtual disk Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x8e65a061 Command (m for help): n#创建新分区 Partition type pprimary(0 primary, 0 extended, 4 free) eextended(container for logical partitions) Select (default p): p# 选择主分区 Partition number (1-4, default 1): # 分区号,直接回车使用默认值1 First sector (2048-20971519, default 2048):#起始扇区,直接回车使用默认 Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): # 结束扇区,直接回车使用整个硬盘 Created a new partition 1 of type 'Linux' and of size 10 GiB. Command (m for help): t#更改分区类型 Selected partition 1 Hex code or alias (type L to list all): L#查看分区类型 00 Empty27 Hidden NTFS Win82 Linux swap / Soc1 DRDOS/sec (FAT- 01 FAT1239 Plan 983 Linuxc4 DRDOS/sec (FAT- 02 XENIX root3c PartitionMagic84 OS/2 hidden orc6 DRDOS/sec (FAT- 03 XENIX usr40 Venix 8028685 Linux extendedc7 Syrinx 04 FAT16 <32M41 PPC PReP Boot86 NTFS volume setda Non-FS data 05 Extended42 SFS87 NTFS volume setdb CP/M / CTOS / . 06 FAT164d QNX4.x88 Linux plaintextde Dell Utility 07 HPFS/NTFS/exFAT4e QNX4.x 2nd part8e Linux LVMdf BootIt 08 AIX4f QNX4.x 3rd part93 Amoebae1 DOS access 09 AIX bootable50 OnTrack DM94 Amoeba BBTe3 DOS R/O 0a OS/2 Boot Manag51 OnTrack DM6 Aux9f BSD/OSe4 SpeedStor 0b W95 FAT3252 CP/Ma0 IBM Thinkpad hiea Linux extended 0c W95 FAT32 (LBA)53 OnTrack DM6 Auxa5 FreeBSDeb BeOS fs 0e W95 FAT16 (LBA)54 OnTrackDM6a6 OpenBSDee GPT 0f W95 Ext'd (LBA)55 EZ-Drivea7 NeXTSTEPef EFI (FAT-12/16/ 10 OPUS56 Golden Bowa8 Darwin UFSf0 Linux/PA-RISC b 11 Hidden FAT125c Priam Ediska9 NetBSDf1 SpeedStor 12 Compaq diagnost61 SpeedStorab Darwin bootf4 SpeedStor 14 Hidden FAT16 <363 GNU HURD or Sysaf HFS / HFS+f2 DOS secondary 16 Hidden FAT1664 Novell Netwareb7 BSDI fsf8 EBBR protective 17 Hidden HPFS/NTF65 Novell Netwareb8 BSDI swapfb VMware VMFS 18 AST SmartSleep70 DiskSecure Multbb Boot Wizard hidfc VMware VMKCORE 1b Hidden W95 FAT375 PC/IXbc Acronis FAT32 Lfd Linux raid auto 1c Hidden W95 FAT380 Old Minixbe Solaris bootfe LANstep 1e Hidden W95 FAT181 Minix / old Linbf Solarisff BBT 24 NEC DOS Aliases: linux-83 swap-82 extended-05 uefi-EF raid-FD lvm-8E linuxex-85 Hex code or alias (type L to list all): 8e# 设置LVM分区类型 Changed type of partition 'Linux' to 'Linux LVM'. Command (m for help): p# 验证分区表 Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors Disk model: Virtual disk Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x8e65a061 DeviceBoot StartEndSectors Size Id Type /dev/sdb12048 20971519 2096947210G 8e Linux LVM Command (m for help): w#保存并退出 The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. root@ubuntu113:~# |