windows 系统分区表及硬盘格式

  硬盘系统格式  FAT32、NTFS 、FAT

Ntfs格式更好,更安全,适应大文件,有的超过4G的文件在Fat32格式下不支持,只能是Ntfs格式才能识别;u盘一般都是FAT32,存储超过4G单文件需要转换系统格式;

不建议长期在U盘上使用NTFS格式。NTFS读写太频繁,对U盘寿命损害极大;可用压缩文件或用分卷压缩解决FAT32格无法存储4G大文件的问题


win 7系统及以下(winXP等) 是 MBR格式,win 8/win10系统 是GPT格式

GPT(GUID Partition Table)和MBR (Master Boot Record)是分区表类型。如果说BIOS+MBR是传统的启动方式,那么UEFI+GPT则是当前流行的并将取代传统的新的模式。0 R! v& b8 N- Q" C

MBR分区表与GPT分区表的简单区别:0 z* p/ i4 U* R( H, s7 B
1、MBR分区表:最多四个主分区或者三个主分区+一个扩展分区(若干逻辑分区),最大支持硬盘容量2TB。% [, a2 U7 a2 h! @6 h9 ]
2、GPT分区表:最多128个主分区,最大支持容量18EB。关于 TB与 EB的概念换算,大家自行百度一下。

如何转换MBR或GPT分区(友情提醒:转换分区需要格式化硬盘)

一、在装系统时,可以利用“diskpart”来转换硬盘格式。比如在新装系统进入如下图所示的界面时,可以使用shift+f10组合快捷键,打开命令提示符,如下图所示。


二、进入命令操作框后,可以借助以下命令,实现硬盘MBR转换为GPT。

  输入如下一组命令,键入每行命令后,按回车键运行。

  diskpart

  list disk

  select disk *(选择你要转换格式的硬盘)



  之后再运行以下命令:

  clean      (格式化磁盘)

  convert gpt


这里就转换成功了,同理 转换为mbr,使用convert gpt命令



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在C语言中读取Windows系统分区,可以使用Windows API函数来实现。以下是使用Windows API函数读取系统分区的示例代码: ```c #include <stdio.h> #include <windows.h> #include <winioctl.h> int main() { HANDLE hDevice = CreateFile("\\\\.\\PhysicalDrive0", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hDevice == INVALID_HANDLE_VALUE) { printf("Failed to open disk! Error code: %d\n", GetLastError()); return 1; } STORAGE_PROPERTY_QUERY storagePropertyQuery; ZeroMemory(&storagePropertyQuery, sizeof(storagePropertyQuery)); storagePropertyQuery.PropertyId = StorageDeviceProperty; storagePropertyQuery.QueryType = PropertyStandardQuery; STORAGE_DEVICE_DESCRIPTOR storageDeviceDescriptor; ZeroMemory(&storageDeviceDescriptor, sizeof(storageDeviceDescriptor)); DWORD dwBytesReturned; if (!DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY, &storagePropertyQuery, sizeof(storagePropertyQuery), &storageDeviceDescriptor, sizeof(storageDeviceDescriptor), &dwBytesReturned, NULL)) { printf("Failed to get device descriptor! Error code: %d\n", GetLastError()); CloseHandle(hDevice); return 1; } BYTE* buffer = (BYTE*)malloc(storageDeviceDescriptor.Size); ZeroMemory(buffer, storageDeviceDescriptor.Size); if (!DeviceIoControl(hDevice, IOCTL_DISK_GET_DRIVE_LAYOUT_EX, NULL, 0, buffer, storageDeviceDescriptor.Size, &dwBytesReturned, NULL)) { printf("Failed to get partition table! Error code: %d\n", GetLastError()); CloseHandle(hDevice); free(buffer); return 1; } PDRIVE_LAYOUT_INFORMATION_EX driveLayoutInformation = (PDRIVE_LAYOUT_INFORMATION_EX)buffer; printf("Drive layout:\n"); printf("Signature: 0x%08X\n", driveLayoutInformation->Mbr.Signature); for (int i = 0; i < driveLayoutInformation->PartitionCount; i++) { PARTITION_INFORMATION_EX partitionInformation = driveLayoutInformation->PartitionEntry[i].PartitionInformation; printf("\nPartition %d:\n", i + 1); printf("Partition type: 0x%02X\n", partitionInformation.PartitionType); printf("Partition number: %d\n", partitionInformation.PartitionNumber); printf("Starting offset: %lld\n", partitionInformation.StartingOffset.QuadPart); printf("Partition length: %lld\n", partitionInformation.PartitionLength.QuadPart); } CloseHandle(hDevice); free(buffer); return 0; } ``` 这段代码打开物理磁盘设备,并使用DeviceIoControl函数发送IOCTL_DISK_GET_DRIVE_LAYOUT_EX控制码来获取分区数据。然后,它解析分区数据并将其打印到控制台上。请注意,这需要管理员权限才能运行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值