This is an old revision of the document!
Naplnit disk náhodnými daty:
~$ sudo dd if=/dev/urandom of=/dev/sda bs=4M status=progress
238468+0 záznamů přečteno 238467+0 záznamů zapsáno 1000204886016 bajtů (1,0 TB, 932 GiB) zkopírováno, 29102,6 s, 34,4 MB/s
Vytvořit partition (GPT):
~$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3 Partition table scan: MBR: not present BSD: not present APM: not present GPT: not present Creating new GPT entries. Command (? for help): n Partition number (1-128, default 1): First sector (34-1953525134, default = 2048) or {+-}size{KMGTP}: Last sector (2048-1953525134, default = 1953525134) or {+-}size{KMGTP}: Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem' Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/sda. The operation has completed successfully.
Kontrola:
~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931,5G 0 disk └─sda1 8:1 0 931,5G 0 part
~$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 1953525168 sectors, 931.5 GiB Model: HD650 Sector size (logical/physical): 512/4096 bytes Disk identifier (GUID): 684CCBB4-EEA4-4C92-BC2A-6D16D1B0ADF8 Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 1953525134 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB) Number Start (sector) End (sector) Size Code Name 1 2048 1953525134 931.5 GiB 8300 Linux filesystem
~$ sudo cryptsetup luksFormat /dev/sda1
WARNING! ======== Toto nevratně přepíše data na /dev/sda1. Are you sure? (Type uppercase yes): YES Zadejte heslo pro /dev/sda1: Ověřte heslo:
~$ sudo cryptsetup -v luksOpen /dev/sda1 red
Zadejte heslo pro /dev/sda1: Pozice klíče 0 odemknuta. Příkaz úspěšně vykonán.