A resolution of 1024x768 or higher is advised.

Thank you, common type of warning from 1998.
 


Please Read:  Rules for the use of services at pcrpg.org
 
Linux Disk Service Reference
Table of Contents

Cloning a GPT Disk (Even to a Different Size of Disk)
Unlike MBR disks, GPT disks contain two copies of its header. The primary copy resides at the very start of the disk just like it does on an MBR disk. The backup copy resides at the very end of the disk, and this copy is a new addition not found on MBR disks. In order for a GPT disk to be mountable, it is required that both copies of the header be present and valid. If one copy is missing or corrupt, the disk is likely to be rejected by Windows and perhaps other operating systems as well.

This introduces a few extra steps when cloning a GPT disk that weren't necessary when cloning older MBR style disks. In addition to doing a block copy of the source disk to a target disk, it is necessary to copy the primary header to the end of the disk if the target disk isn't exactly the same size as the source disk. This can be accomplished by using the gdisk tool. If you do not have gdisk, it should be available in your repositories if you're using Debian. Other distributions may also contain it.

  1. Install gdisk if not present: sudo apt-get install gdisk
     
  2. Optional: Install lsscsi if not present: sudo apt-get install lsscsi
     
  3. Identify your source and target drives using parted, gparted, lsscsi, etc.
     
  4. If the target disk is smaller than the source disk: Shrink and rearrange any partitions as necessary using parted or gparted so that there exists at least a few megabytes between the last partitioned byte on the source disk and the total size of the target disk. This is where the backup GPT header will end up being located and as such it needs to be unallocated space. Smaller partitions will also let you copy the source disk to the target disk more quickly. You can always expand the partitions to fit the target disk after the rest of the steps below are finished. If you cannot shrink the source disk's partitions enough to fit on the target, try deleting files from the source partitions that you do not need (temp files, old backups, old downloads, etc). If this does not free up enough space, you cannot proceed.
     
  5. Optional: Blank the target disk using dd or hdparm. At the very least, blank the last few megabytes of the target disk where the backup GPT header will be stored. The block copy below will take care of the space occupied by the primary copy.
     
  6. Block copy the allocated portion of the source disk to the target disk using dd.
    Ex: sudo dd if=/dev/sd# of=/dev/sd# bs=1M count=#
    if=source, of=target, bs=block size (1 MiB in our example), count=blocks to copy (MiB if bs=1M)
     
    NOTE: If count is omitted, dd will copy until it reaches either the end of the input device or the end of the output device. This won't hurt anything, but limiting the scope being copied to just slightly exceed the allocated portion of the source disk will save time. As an example, if your source disk contains a 100 MB, 300 MB, and 32 GB partition you might copy 100 + 300 + 32768 MB = 33168 MB + ~4 GB safety margin for partition table, offsets, alignment, and peace of mind = ~37000 MB. If you're just going to let it copy overnight, this probably isn't a concern. Also, block size can be specified in two ways when using dd. Including a B with the units indicates base-10 while omitting it indicates base-2. That is to say, KB = 1000 bytes but K = 1024 bytes. All standard prefixes work (B, K, M, G, T, etc).
     
  7. Launch gdisk: sudo gdisk /dev/sd# (specify the target drive)
  8. x (expert menu)
  9. e (copy backup header to end of disk)
  10. w (write partition table to disk)
  11. y (yes / confirm)
     
    NOTE: The gdisk step will also automatically correct the mismatch between the size of the disk as defined in the GPT header (because of it coming from the old disk which was a different size) and the size of the new disk.
     
  12. If copying a boot drive, you will want to probably keep the same disk GUID so that your operating system's boot manager continues to work correctly. If so, omit the three steps below. If you are copying a data drive, you should probably assign a new GUID to the target disk so that it and the source do not have the same GUID.
  13. Launch gdisk: sudo gdisk /dev/sd# (specify the target drive)
  14. g (assign new GUID to the disk)
  15. c (assign new GUIDs to the disk's partitions)
     
  16. Exit gdisk.
     
  17. Expand the partitions on the target disk using parted or gparted if desired. Note that fdisk does not work with GPT disks!
     
  18. You are done.


Secure Erase ATA Disk
  1. Make sure the drive reports as "not frozen" and "not enabled". You may need to hotplug the drive to reset the device if one of the states are incorrect.

    sudo hdparm -I /dev/sd_

  2. Set a username and password on the drive. You can use any value for each, but for this demo we'll use "u" and "p" respectively for quick typing later.

    sudo hdparm --user-master u --security-set-pass p /dev/sd_

  3. Make sure the drive now reports as "enabled". This indicates that the username and password set successfully.

    sudo hdparm -I /dev/sd_

  4. Execute the secure erase command. Time it if desired. SSDs typically take between 10 seconds and 5 minutes.

    time sudo hdparm --user-master u --security-erase p /dev/sd_

  5. Make sure the drive now reports as "not enabled" again. This indicates that the process is finished.

    sudo hdparm -I /dev/sd_

  6. You are done.

Hits for this page (Since 4/18/2015): 1,409

Other places you need to visit:
www.clanorb.com   

NOTICE: This page is written in overly-complicated PHP.
Document rendered in 0.023 seconds.

The whisper in the wind