Page 3 of 3

Re: How to backup your stuff UNIX-style

Posted: Fri Jun 23, 2017 7:54 pm
by whitelight999
Regarding the first part of the tutorial

So if you wanted a script which had to run on both MBR and GPT drives
sudo gdisk -l /dev/sda | grep "MBR only"
sudo gdisk -l /dev/sda | grep "GPT present"


If #MBR
then
dd if=/dev/hda of=/tmp/hda-mbr.bin bs=512 count=1
elseif #GPT
???
fi

Anyone know what to put in for ??? to solve this?

Re: How to backup your stuff UNIX-style

Posted: Tue Dec 19, 2017 8:51 pm
by typematrix
whitelight999 wrote:Regarding the first part of the tutorial
So if you wanted a script which had to run on both MBR and GPT drives
sudo gdisk -l /dev/sda | grep "MBR only"
sudo gdisk -l /dev/sda | grep "GPT present"
If #MBR
then
dd if=/dev/hda of=/tmp/hda-mbr.bin bs=512 count=1
elseif #GPT
???
fi
Anyone know what to put in for ??? to solve this?
# ??? in bash

echo "GPT partition table detected "
sudo dd if=/dev/hda of=/tmp/hda-gpt.bin bs=512 skip=1 count=33

I can show you how to detect GPT and MBR as well and what file drive the file system is on.