Linux에서 파티션이 없는 디스크에 대해 장치 파티션 블록 파일을 표시하는 이유는 무엇입니까?

Linux에서 파티션이 없는 디스크에 대해 장치 파티션 블록 파일을 표시하는 이유는 무엇입니까?

무작위 데이터로 덮어쓴 2TB 디스크가 있습니다. fdisk장치에 인식된 파티션 테이블이 없음을 확인합니다. 하지만 디스크에 다음 5개의 장치 파일이 표시됩니다. /dev/sdc{,1,2,3,4}

# for i in /dev/sdc{,1,2,3,4} ; do fdisk -l -u $i ; done

Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc1: 555.1 GiB, 595985804288 bytes, 1164034774 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc2: 1.6 TiB, 1781956913152 bytes, 3480384596 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc3: 928.5 GiB, 997001973760 bytes, 1947269480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdc4: 1 TiB, 1153125198336 bytes, 2252197653 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

다시 말하지만, 장치에는 파티션 테이블이 없습니다.

# fdisk /dev/sdc 

Welcome to fdisk (util-linux 2.25.2). 
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 disklabel with disk identifier 0x56b93c1d. 

Command (m for help): p 
Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors 
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 

파티션 장치가 있는 이유는 무엇입니까? 즉, /dev/sdc뿐만 아니라 /dev/sdc{1,2,3,4}도 있는 이유는 무엇입니까? 또한, 파티션된 장치의 크기가 최대 1.8TiB에 이르지 못하는 이유는 무엇입니까?

답변1

partxLinux는 부팅(또는 디스크 연결) 시 또는 명시적으로 그렇게 하라는 지시가 있을 때(예: 파티션 테이블을 작성한 후 fdisk에 의해 또는 또는 를 사용하여)를 제외하고는 파티션 테이블을 다시 읽지 않습니다 blockdev --rereadpt. 그래서 당신이 그 중 하나를 할 때까지 sdc[1-4]계속 존재할 것입니다.

가장 쉬운 해결 방법은 partprobe커널에 모든 장치의 파티션 테이블을 다시 읽도록 지시하거나 partprobe /dev/sdc해당 디스크에서만 파티션 테이블을 다시 읽도록 호출하는 것입니다. 또는 fdisk를 사용하여 빈 파티션 테이블을 작성할 수 있습니다. 그러면 fdisk는 partprobe.

또한 디스크(또는 해당 파티션)가 사용 중인 경우(예: 파일 시스템, 스왑, LVM PV 등) 커널은 이를 다시 읽지 않는다는 점에 유의하십시오. 물론, 사용 중이던 경우에는 방금 지웠기 때문에 문제가 발생합니다.

마지막으로 이미 강제로 다시 읽기를 시도한 경우 임의의 데이터가 파티션 테이블 서명과 일치할 가능성이 있습니다. Linux는 다양한 파티션 테이블 형식을 지원하며(목록은 커널을 컴파일할 때 선택됨) 일부의 서명은 1바이트만큼 작습니다. 따라서 무작위 데이터가 일치할 확률은 1/256입니다. 다른 것들은 서명이 길어서 확률이 훨씬 낮습니다. 전반적인 가능성이 무엇인지는 잘 모르겠지만 커널 로그를 빠르게 확인하면 커널이 인식한 파티션 테이블 형식이 표시됩니다.

관련 정보