[svlug] How to back up my son's GPT?

Steve Litt slitt at troubleshooters.com
Wed Nov 26 23:06:49 PST 2014

On Thu, 27 Nov 2014 01:25:48 -0500
Steve Litt <slitt at troubleshooters.com> wrote:

> According to
> http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_.28LBA_1.29 ,
> it would seem that the size to be backed up from the front of /dev/sda
> is the number in ((offset 40) - 1), multiplied by the LBA size, which
> I think is the sector size. My understanding is that sector size is
> usually, but not always, 512 bytes, and I have no idea how to find the
> sector size on the disk. Does anyone know?

The following program reports 4096 as the sector size for the
mountpoint of every partition I have. Does that sound reasonable, or
does the f_bsize field of struct statvfs mean something other than
sector size/LBA size?

#include <sys/statvfs.h>
#include <sys/types.h>

void main(int argc, char * argv[]){
	struct statvfs buf;
	statvfs(argv[1], &buf);
	printf("Sect size is %d.\n", (int)buf.f_bsize);



Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance

More information about the svlug mailing list