View previous topic :: View next topic |
Author |
Message |
manwe_ l33t
Joined: 01 Feb 2006 Posts: 632 Location: Kraków/Cracow, Poland
|
Posted: Sat Dec 05, 2015 5:14 pm Post subject: [SOLVED] Block device with GPT - accessing partitions |
|
|
Hi *.
I have SSD drive [/dev/sdb] with one partition [/dev/sdb1]. This partition is LUKS-crypted. While decrypted, it's mapped to device /dev/mapper/ntfs, which then is passed to Qemu for Windows10 virtual machine [-drive format=raw,file=/dev/mapper/ntfs,...]. On that drive Windows created GPT with few partitions, including main one with all the data.
My question is, how can I force Gentoo to read partition table on that /dev/mapper/ntfs and create "sub-devices". Somethin like /dev/mapper/ntfs1, ntfs2, etc. What for? I'd like to be able sometimes to mount that main windows partition with ntfs3g and access some files.
Last edited by manwe_ on Mon Dec 07, 2015 7:45 pm; edited 1 time in total |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sat Dec 05, 2015 7:12 pm Post subject: Re: Block device with GPT - accessing partitions |
|
|
manwe_ wrote: | My question is, how can I force Gentoo to read partition table on that /dev/mapper/ntfs and create "sub-devices". Somethin like /dev/mapper/ntfs1, ntfs2, etc. What for? I'd like to be able sometimes to mount that main windows partition with ntfs3g and access some files. |
manwe_ ... /dev/mapper/ntfs is a block device, so you could use a loop, and have losetup '-P,--partscan' provide the partition table ... you would then mount these onto /mnt/* or what-have-you. See: man mount | less -p '^THE LOOP DEVICE' and 'man losetup'.
HTH & best ... khay |
|
Back to top |
|
|
manwe_ l33t
Joined: 01 Feb 2006 Posts: 632 Location: Kraków/Cracow, Poland
|
Posted: Sun Dec 06, 2015 7:52 pm Post subject: |
|
|
OK, thanks, we're getting somewhere.
Code: | # losetup -f --show -P /dev/mapper/ntfs
/dev/loop0
# ls -l /dev/loop0*
brw-rw---- 1 root disk 7, 0 12-06 20:48 /dev/loop0
brw-rw---- 1 root disk 259, 0 12-06 20:48 /dev/loop0p1
|
So there is a partition, but only one. Should be 4.
Code: | Disk /dev/loop0: 119.2 GiB, 128032530432 bytes, 250063536 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: gpt
Disk identifier: 21333FDF-2F72-47BF-B849-014B4CAC368E
Device Start End Sectors Size Type
/dev/loop0p1 2048 923647 921600 450M Windows recovery environment
/dev/loop0p2 923648 1126399 202752 99M EFI System
/dev/loop0p3 1126400 1159167 32768 16M Microsoft reserved
/dev/loop0p4 1159168 250062847 248903680 118.7G Microsoft basic data
|
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54232 Location: 56N 3W
|
Posted: Sun Dec 06, 2015 9:01 pm Post subject: |
|
|
manwe_,
I bet /dev/loop0p1 is the protective MSDOS partition.
I would guess that -P does not find the GPT table.
There is another way. You know the start addresses of the partitions
Code: | Device Start
/dev/loop0p1 2048
/dev/loop0p2 923648
/dev/loop0p3 1126400
/dev/loop0p4 1159168 |
You can mount them with the offset= option. Convert the above block addresses to bytes by multiplying by 512.
Code: | mount -t <FSTYPE> -o ro,offset=X /dev//mapper/ntfs /mnt/<someplace> | for a read only mount.
Rinse and repeat for various values of X and <someplace> _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sun Dec 06, 2015 9:05 pm Post subject: |
|
|
manwe_ wrote: | So there is a partition, but only one. Should be 4. |
manwe_ ... ummmm, not sure why that would be the case, I might speculate that an --offset is required, try setting LOOPDEV_DEBUG=all and see if this provides some clue. You might also search for examples using the search terms 'losetup, gpt, loop0p1, etc'. Sorry, not something I've done for a windows image, so there may be something I'm not aware of ITR.
best ... khay |
|
Back to top |
|
|
manwe_ l33t
Joined: 01 Feb 2006 Posts: 632 Location: Kraków/Cracow, Poland
|
Posted: Mon Dec 07, 2015 7:45 pm Post subject: |
|
|
NeddySeagoon wrote: | You can mount them with the offset= option. Convert the above block addresses to bytes by multiplying by 512. |
Works like a charm. Thanks a lot It's a pity though, that --partscan does not support GPT. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54232 Location: 56N 3W
|
Posted: Mon Dec 07, 2015 8:35 pm Post subject: |
|
|
manwe_,
You can add entries to fstab if you wish, with the noauto option, so you need to use the lazy form of mount to mount those partition without remembering the offset values. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|