[SLUG] GPT partions, losetup and mounting NTFS

327 views
Skip to first unread message

Dave Kempe

unread,
Sep 2, 2009, 5:08:15 AM9/2/09
to sl...@slug.org.au
Hi,

I have a GPT partition like so:

#parted /dev/mapper/storagevg0-ntserveriscsi
GNU Parted 1.7.1
Using /dev/mapper/storagevg0-ntserveriscsi
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p

Disk /dev/mapper/storagevg0-ntserveriscsi: 1100GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 134MB 134MB Microsoft reserved partition msftres
2 134MB 1100GB 1099GB ntfs Basic data partition

(parted) q

And I would like to mount the ntfs basic data partion.

According to this:

http://ubuntuforums.org/showthread.php?t=945028
I can use losetup with an offset in bytes to find the ntfs data and mount it like so:

root@storage:~ #losetup -o 137216 /dev/loop2 /dev/storagevg0/ntserveriscsi
root@storage:~# mount -t ntfs-3g /dev/loop2 /mnt/storage/
NTFS signature is missing.
Failed to mount '/dev/loop2': Invalid argument
The device '/dev/loop2' doesn't have a valid NTFS.
Maybe you selected the wrong device? Or the whole disk instead of a
partition (e.g. /dev/hda, not /dev/hda1)? Or the other way around?

Which doesn't work. Any ideas on how to find the correct offset in bytes? parted only prints it in MB, which I assume is an approximation.
Or any other tips for mounting a windows created GPT partition?

Thanks,
Dave
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Dave Kempe

unread,
Sep 2, 2009, 6:18:05 AM9/2/09
to sl...@slug.org.au
Answering my own question, you can use the undocumented parameter 'unit' to set the units to bytes in parted.

root@storage:~# parted /dev/mapper/storagevg0-ntserveriscsi unit B print

Disk /dev/mapper/storagevg0-ntserveriscsi: 1099511627775B


Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags

1 17408B 134235135B 134217728B Microsoft reserved partition msftres
2 134235136B 1099510596607B 1099376361472B ntfs Basic data partition

Information: Don't forget to update /etc/fstab, if necessary.

root@storage:~# losetup -d /dev/loop2
root@storage:~# losetup -o 134235136 /dev/loop2 /dev/storagevg0/ntserveriscsi


root@storage:~# mount -t ntfs-3g /dev/loop2 /mnt/storage/

Just for the archives. Thank you, you've been a great help as always :)

Dave

Dave Kempe

unread,
Sep 2, 2009, 6:49:42 AM9/2/09
to Chris MacKenzie, sl...@slug.org.au

----- "Chris MacKenzie" <cmack...@internode.on.net> wrote:

> I prefer to use kpartx to create device mappings from lvm disk
> images,
> it's much easier than fapping about with offsets :)
>
> usage : kpartx [-a|-d|-l] [-v] wholedisk
> -a add partition devmappings
> -d del partition devmappings
> -l list partitions devmappings that would be added by -a
> -p set device name-partition number delimiter
> -g force GUID partition table (GPT)
> -v verbose

Ahh yes I remember now from when I was mucking around with multipath. That would probably have worked. Might use it in the scripts I have to write now to make all this work.

Chris MacKenzie

unread,
Sep 2, 2009, 6:45:38 AM9/2/09
to Dave Kempe, sl...@slug.org.au
Dave Kempe wrote:
> Hi,
>
> I have a GPT partition like so:
>
> #parted /dev/mapper/storagevg0-ntserveriscsi
> GNU Parted 1.7.1
> Using /dev/mapper/storagevg0-ntserveriscsi
> Welcome to GNU Parted! Type 'help' to view a list of commands.
> (parted) p
>
> Disk /dev/mapper/storagevg0-ntserveriscsi: 1100GB
> Sector size (logical/physical): 512B/512B
> Partition Table: gpt
>
> Number Start End Size File system Name Flags
> 1 17.4kB 134MB 134MB Microsoft reserved partition msftres
> 2 134MB 1100GB 1099GB ntfs Basic data partition
>
> (parted) q
>
> And I would like to mount the ntfs basic data partion.
>
>
I prefer to use kpartx to create device mappings from lvm disk images,
it's much easier than fapping about with offsets :)

usage : kpartx [-a|-d|-l] [-v] wholedisk
-a add partition devmappings
-d del partition devmappings
-l list partitions devmappings that would be added by -a
-p set device name-partition number delimiter
-g force GUID partition table (GPT)
-v verbose

--

Reply all
Reply to author
Forward
0 new messages