User Tools

Site Tools


harddrive_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
harddrive_setup [2011/04/09 18:03] 192.168.2.30harddrive_setup [2012/06/18 00:40] memeruiz
Line 6: Line 6:
 The rest of the disk is the whole linux system (including /boot). This is going to be a RAID1 (copy) with a LVM on top (to allow future extension) and encryption on top. The rest of the disk is the whole linux system (including /boot). This is going to be a RAID1 (copy) with a LVM on top (to allow future extension) and encryption on top.
  
-  * Create GPT partition table with gdisk+In each harddrive do the following: 
 + 
 +  * Create GPT partition table with gdisk. (Check that the alignment is to 2048-sectors for 4Kb harddrives, if not set it like that)
   * Create a BIOS boot partition of 1MB (necessary for grub2 on GPT disks)   * Create a BIOS boot partition of 1MB (necessary for grub2 on GPT disks)
-  * Create a swap partition +  * Create a Linux swap partition (2G) 
 +  * Create a Linux RAID partition (the rest of space) 
 + 
 +Now in the first harddrive do: 
 + 
 +  * Create the Linux RAID1 device: 
 + 
 +  mdadm --create md0 --level=1 --raid-devices=2 -R /dev/sdf3 missing 
 + 
 +  * Replace "missing" for your second drive if its already connected. 
 + 
 +  * For some reason the drive is read only still: 
 + 
 +  md0 : active (auto-read-only) raid1 sdf3[0] 
 +        ?????? blocks super 1.2 [2/1] [U_] 
 + 
 +  * Make it read/write 
 + 
 +  mdadm --readwrite /dev/md/md0  
 +   
 +  * Update /etc/mdadm/mdadm.conf 
 + 
 +  mdadm --examine --scan >> /etc/mdadm/mdadm.conf 
 + 
 +  * Create an LVM2 logical block device on top of this RAID: 
 + 
 +  pvcreate /dev/md/md0 
 +  vgcreate test /dev/md/md0 
 +  lvcreate -l 100%VG -n root test 
 + 
 +  * Create a dm-crypt on top of the LVM: 
 + 
 +  modprobe sha512_generic 
 +  modprobe aes_generic 
 +  modprobe aes-x86_64 
 +  cryptsetup -y luksFormat /dev/test/root -c aes-xts-plain64 -s 512 
 + 
 +  * Activate dm-crypt: 
 + 
 +  cryptsetup luksOpen /dev/mapper/test-root test-root_crypt 
 + 
 +  * Create ext4 partition: 
 + 
 +  mkfs.ext4 /dev/mapper/test-root_crypt 
 + 
 + 
 +In this moment the disk is ready for installing software on it. What I'm trying to do is to copy my old harddrive installation into this new system. I will probably copy this using rsync, but first I want to check if the ext4 filesystem can be seen by grub2. I plan to test this from the grub console on my currently running system. 
 + 
 +===== Important commands ===== 
 + 
 +blkid - lists uuids of block devices, could be useful for configuring grub. 
 +grub-mkdevicemap - could be necessary if you add more harddrives and want to install grub in the new harddrives. 
 + 
 + 
 + 
 +  
harddrive_setup.txt · Last modified: 2021/02/01 05:55 by 127.0.0.1