드라이브 마운트안된 파티션 내용에 접근과 유의할점.
2019.03.07 09:02
앞서 마운트없이 EFI 파티션에 bcdboot를 수행할수 있다는 글을 올렸는데요
모든 시스템에 인식된 모든 NTFS/FAT 파티션은 마운트에 상관없이 dir 명령으로 접근이 가능합니다.
mountvol 결과 나오는 디바이스 트리 uuid 부터 경로를 적어주면 됩니다.
예 : dir \\?\Volume{ad843443-4ba4-4d58-9122-f5189d69328a}\efi
결과는
\\?\Volume{ad843443-4ba4-4d58-9122-f5189d69328a} 드라이브의 볼륨: system
볼륨 일련 번호: 0EC0-0A96
\\?\Volume{ad843443-4ba4-4d58-9122-f5189d69328a}\efi 디렉터리
2019-02-23 오전 05:04 <DIR> .
2019-02-23 오전 05:04 <DIR> ..
2019-02-23 오전 05:04 <DIR> Microsoft
2019-02-23 오전 05:04 <DIR> Boot
0개 파일 0 바이트
4개 디렉터리 76,914,688 바이트 남음
이렇게 잘 나오네요. (내용은 관리자권한일때만 보여짐...)
따라서 bcdedit /store ... 에서도 위 디바이스 트리로부터 BCD 경로를 적어주면 됩니다.
그런데 bcdboot /s 에서는 위의 디바이스 트리 외에 \Device\HarddiskVolume# 형식도 지원하고 (#은 번호)
그냥 # 번호만 써줘도 되는데 중요한건 이때 # 번호가 diskpart의 list vol 에서 나오는 볼륨번호와는 전혀 별개 입니다.
즉 diskpart list vol 의 숫자는 임의로 나열순서를 써놓은것일뿐 디바이스 트리와는 전혀 별개이기에 조심해야 합니다.
디바이스트리 의 볼륨은 0 이 아닌 1부터 시작하느것부터 다릅니다.
\Device\HarddiskVolume 형식의 볼륨값은 파워쉘에서 다음의 코드를 봍여넣기 하면 나오지만
마운트 안된것은 나오지가 않습니다.
$DynAssembly = New-Object System.Reflection.AssemblyName('SysUtils')
$AssemblyBuilder = [AppDomain]::CurrentDomain.DefineDynamicAssembly($DynAssembly, [Reflection.Emit.AssemblyBuilderAccess]::Run)
$ModuleBuilder = $AssemblyBuilder.DefineDynamicModule('SysUtils', $False)
# Define [Kernel32]::QueryDosDevice method
$TypeBuilder = $ModuleBuilder.DefineType('Kernel32', 'Public, Class')
$PInvokeMethod = $TypeBuilder.DefinePInvokeMethod('QueryDosDevice', 'kernel32.dll', ([Reflection.MethodAttributes]::Public -bor [Reflection.MethodAttributes]::Static), [Reflection.CallingConventions]::Standard, [UInt32], [Type[]]@([String], [Text.StringBuilder], [UInt32]), [Runtime.InteropServices.CallingConvention]::Winapi, [Runtime.InteropServices.CharSet]::Auto)
$DllImportConstructor = [Runtime.InteropServices.DllImportAttribute].GetConstructor(@([String]))
$SetLastError = [Runtime.InteropServices.DllImportAttribute].GetField('SetLastError')
$SetLastErrorCustomAttribute = New-Object Reflection.Emit.CustomAttributeBuilder($DllImportConstructor, @('kernel32.dll'), [Reflection.FieldInfo[]]@($SetLastError), @($true))
$PInvokeMethod.SetCustomAttribute($SetLastErrorCustomAttribute)
$Kernel32 = $TypeBuilder.CreateType()
$Max = 65536
$StringBuilder = New-Object System.Text.StringBuilder($Max)
Get-WmiObject Win32_Volume | ? { $_.DriveLetter } | % {
$ReturnLength = $Kernel32::QueryDosDevice($_.DriveLetter, $StringBuilder, $Max)
if ($ReturnLength)
{
$DriveMapping = @{
DriveLetter = $_.DriveLetter
DevicePath = $StringBuilder.ToString()
}
New-Object PSObject -Property $DriveMapping
}
}
저는 다음과 같이 나오는데
DevicePath DriveLetter
---------- -----------
\Device\HarddiskVolume2 C:
\Device\HarddiskVolume3 A:
\Device\HarddiskVolume5 Z:
\Device\HarddiskVolume6 B:
여기서 빠진 Volume 1과 Volume 4가 EFI 파티션 입니다. (diskpart list vol 에서는 전혀 다른 순서와 값이 나옴)
이 형식은 dir로 출력은 안되며 다소 고전적인 포맷이라 여겨지며 이유는 위에서 설명드린대로 볼륨순번이 중구난방 이기에
mountvol에서 얻은 \\?\Volume{uuid} 형식이 정상적인 포맷으로 간주되어 잘 쓰이는것 같습니다.
댓글 [1]
-
왕초보 2019.03.07 09:41
번호 | 제목 | 글쓴이 | 조회 | 등록일 |
---|---|---|---|---|
[공지] | 자유 게시판 이용간 유의사항 (정치, 종교, 시사 게시물 자제) [1] | gooddew | - | - |
47223 | 쩝.... [1] | 테츠로 | 529 | 03-26 |
47222 | 이거 레지스트리 파일로 만들려면 어떻게 해야하나요? [3] | 소소생 | 503 | 03-26 |
47221 | USB 꽃았더니 게임이 팅기는걸 경험했네요. | 치토스 | 274 | 03-26 |
47220 | supermium 브라우저 [6] | [벗님] | 749 | 03-26 |
47219 | 신기한 하드디스크입니다(2) [11] | 『ⓖⓤⓝ』 | 1212 | 03-26 |
47218 | 이런 경우도 있네요 | 복구시디 | 536 | 03-26 |
47217 | 신기한 하드디스크네요 [5] | 『ⓖⓤⓝ』 | 1332 | 03-26 |
47216 | 키보드,마우스 대신 게임 패드로 사용 - JoyToKey [5] | 보[BORAM]람 | 482 | 03-25 |
47215 | 윈도우10 LTSC라는게 있었군요? [9] | 『ⓖⓤⓝ』 | 1069 | 03-25 |
47214 | 몇일 전에 질답에 올린 컨텍스트 메뉴 파일명 [4] | 라랑 | 361 | 03-25 |
47213 | 【수정】 Win10 Wifi 223mb PEUtils DVD PE [32] | 딸랑쇠 | 1719 | 03-25 |
47212 | 구형 노트북인데.. 윈도우 10 설치후에 [11] | 소소생 | 877 | 03-25 |
47211 | 고전 소프트웨어 중심 FTP에 대하여 [3] | Niconii | 516 | 03-25 |
47210 | 샤오미 TV.. [2] | 테츠로 | 1122 | 03-25 |
47209 | 고프로6 [6] | 긍지버림 | 808 | 03-24 |
47208 | 노트북 페기물 재활용 [8] | 엄마갯돈 | 1263 | 03-24 |
47207 | 테스트 [1] | 엄마갯돈 | 585 | 03-24 |
47206 | 근본 치킨 | FINAL | 557 | 03-24 |
47205 | 블로그 하나 만들었습니다 + 두 가지 질문 | Niconii | 488 | 03-24 |
47204 | flibustier 윈도우 11 이라고 있길래... [4] | [벗님] | 615 | 03-23 |
귀한 정보를 알려주셔서 감사합니다..
파워셀은 한번도 사용해본적이 없습니다만..능력이...막강하네요..
오늘 하루도..좋은일만 있으시길 바랍니다..