从T450笔记本迁移archlinux操作系统之T460s笔记本,同时:

1。  使用cryptsetup做底层块加密。

2.    全新使用btrfs文件系统。

一,硬盘分区。 1T的SSD,使用UEFI启动。

parted /dev/nvme0n1
mkpart fat32 1MiB 512MiB
mkpart linux-swap 513MiB 107530MiB
mkpart xfs 107530MiB %
set boot on
name 1 PARTITION_BOOT
name 2 PARTITION_SWAP
name 3 PARTITION_SECURITY

二, 块加密

[cipher][archlinux][disk encryption][btrfs] 磁盘分区加密 + btrfs

cryptsetup luksFormat /dev/nvme0n1p3
cryptsetup open /dev/nvme0n1p3 crypto_disk
mkfs.btrfs -L CRYPTO_DISK /dev/mapper/crypto_disk
mount /dev/mapper/crypto_disk mnt
btfs subvolume create mnt/_top
btfs subvolume create mnt/_top/root
btfs subvolume create mnt/_top/home
mkdir mnt/snapshot
mkdir mnt/snapshot/home
mkdir mnt/snapshot/root
btrfs subvolume set-default ./

三,挂载

umount mnt/
mount -o compress=lzo,subvol=_top/root /dev/mapper/crypto_disk mnt
mkdir mnt/home
mkdir mnt/boot
mount -o compress=lzo,subvol=_top/home /dev/mapper/crypto_disk mnt/home
mount /dev/nvme0n1p1 mnt/boot
swapon /dev/nvme0n1p2

四, rsync 从备份服务器做系统迁移

参考:[daily][archlinux][rsync] rsync

使用进行备份时同样的命令。

五,修改fstab,并安装EFISTUB

# genfstab -U /mnt >> /mnt/etc/fstab

https://wiki.archlinux.org/index.php/Dm-crypt/System_configuration

当前的配置
HOOKS="base systemd autodetect modconf block bcache sd-lvm2 filesystems keyboard fsck"
修改后的配置
HOOKS="base systemd autodetect modconf block sd-encrpt filesystems keyboard fsck"
BINARES="/usr/bin/btrfs"
# mkinitcpio -p linux

https://wiki.archlinux.org/index.php/Arch_boot_process

https://wiki.archlinux.org/index.php/EFISTUB

参考:

[troubleshoot][archlinux][bcache] 修改linux文件系统 / 分区方案 / 做混合硬盘 / 系统转生大!手!术!(调整底层架构,不!重!装!)

以及:https://wiki.archlinux.org/index.php/EFISTUB#Using_UEFI_directly

中的第11,15小节,用如下命令:

#efibootmgr -d /dev/nvme0n1 -p  -c -L "T7" -l /vmlinuz-linux -u "cryptdevice=UUID=`cat uuid.txt`:crypto_data root=/dev/mapper/crypto_data 
initrd=/initramfs-linux.img resume=/dev/nvme0n1p2"

因为我们是加密的,所以内容上有些特殊。

六:因为我们用的是SSD,需要支持TRIM

  https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard.2FTRIM_support_for_solid_state_drives_.28SSD.29

6.1  fstab 增加discard选项

6.2  增加启动选项

#efibootmgr -d /dev/nvme0n1 -p  -c -L "T7" -l /vmlinuz-linux -u "cryptdevice=UUID=`cat uuid.txt`:crypto_data:allow_discards 
root=/dev/mapper/crypto_data initrd=/initramfs-linux.img resume=/dev/nvme0n1p2 rd.luks.options=discard"

七: 重启

reboot

八: 启动失败

报错如下:

sed_opal:OPAL: Error on step function: with error -: unknown Error 

https://vxlabs.com/2015/02/11/use-the-hardware-based-full-disk-encryption-your-tcg-opal-ssd-with-msed/

http://resources.infosecinstitute.com/linux-tpm-encryption-initializing-and-using-the-tpm/

https://security.stackexchange.com/questions/54921/opal-hardware-encryption

https://www.pugetsystems.com/labs/articles/Introduction-to-Self-Encrypting-Drives-SED-557/

经过调查:

  这个事叫做: SED(Self-Encrypting Drivers)https://wiki.archlinux.org/index.php/Self-Encrypting_Drives

  T460s的硬盘是 NVME的ssd,

  可是目前,他们不支持:

Note: NVMe disks are only partially supported: The sedutil-cli --scan command and the Linux PBA (pre-boot-authorisation) image currently 
only see SATA disks. It is possible to enable self-encryption on an NVMe device by passing the name to sedutil-cli, but not possible to
boot from a locked NVMe disk (the PBA image does not see it). More details here.

  如果想用,貌似不行要自己fork然后patch一段代码进去,用于启动时解密, 这就尴尬了。。。hhh

  https://github.com/Drive-Trust-Alliance/sedutil/issues/120

yaourt -S sedutil

果然使用 sedutil-cli 无法看见我的硬盘。

只能放弃加密。

不对,我不是全盘加密啊。。。。 我只加密了根分区。要再调查一下。

也许是STUB启动出了问题。用grub再启动一次。

成功启动,555555555,只需要在/etc/default/grub 中增加一个参数

GRUB_CMDLINE_LINUX_DEFAULT="luks.uuid=652c137a-xxxx-xxxx-xxxxxxx quiet"

也就是说,之前写的内核参数是不对的,因为我们用了sd-crypt, 却给了crypto的参数。

sd-crypt参数详见:https://www.freedesktop.org/software/systemd/man/systemd-cryptsetup-generator.html

根据以上内容,参照grub的内核参数,重新修改STUB的内核参数。

成功启动!

增加 intel-ucode 支持:

另外测试了,将两个img cat到一个文件里,也是好用的:

修改其他硬件相关的配置:

网卡重命名等。略。

指点杆力度设置:

https://wiki.archlinux.org/index.php/TrackPoint

KVM错误

/home/tong/VM/kingkong-centos6. [tong@T7] [:]
> sudo qemu-system-x86_64 -enable-kvm
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory

参考:https://bobcares.com/blog/how-to-fix-error-could-not-access-kvm-kernel-module/

原因有二: 1. CPU没有开启虚拟化。 2.  kernel 没有加载KVM模块。

/home/tong/VM/kingkong-centos6. [tong@T7] [:]
> lsmod |grep ^kvm
kvm

很显然,BIOS中没有开启。

完!

TODO:

https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface

https://wiki.archlinux.org/index.php/Secure_Boot

[archlinux][crypto] 从T450迁移archlinux操作系统至T460s笔记本的更多相关文章

  1. [archlinux][hardware] ThankPad T450自带SSD做bcache之后的使用寿命分析

    这个分析的起因,是由于我之前干了这两个事: [troubleshoot][archlinux][bcache] 修改linux文件系统 / 分区方案 / 做混合硬盘 / 系统转生大!手!术!(调整底层 ...

  2. [archlinux] 迁移T7从T460s到T470

    这已经不是第一次做OS的迁移了,T7早已经迁移过多台设备了.所以,其实只需要如下三步: 1.  rsync 我一直有全系统备份的习惯,T7一直会不定期的全系统rsync到Tstation上面去.所以我 ...

  3. ArchLinux 安装笔记 --zz

    为何安装 ArchLinux 为了更深层次的理解 Linux (其实只是闲的蛋疼 准备安装介质 U盘首选,没有之一.自己的本子是 MBR 的,UEFI 神马的我才不知道呢哼! 制作 U 盘启动: Li ...

  4. Create Access Point on Archlinux

    Create Access Point on Archlinux */--> Create Access Point on Archlinux 1 Solution Download creat ...

  5. Arch Linux 系统迁移

    镜像下载.域名解析.时间同步请点击 阿里巴巴开源镜像站 备份 Arch Linux 系统 安装 pigz 使用 pigz 多线程压缩比使用 tar 单线程压缩速度明显提升多倍 sudo pacman ...

  6. Linux 下源码编译安装 vim 8.1

    前言 目前 linux 的各个发行版基本上都是带了一个 vi 编辑器的,而本文要说的 vim 编辑器对 vi 做了一些优化升级,更好用.当我们需要远程操作一台 linux 服务器的时候,只能使用命令行 ...

  7. 顿悟:Linux是拿来用的,不是拿来折腾的

    Linux是拿来用的,而不是折腾其本身.相信这个道理不少聪明人(实用主义者)都明白,然而总是有那么一群人拿Linux去安装各种发行版.研究Linux命令.配置桌面.美化桌面.研究各种wm/DE.永无止 ...

  8. (openssh、telnet、vsftpd、nfs、rsync、inotify、samba)

    (openssh.telnet.vsftpd.nfs.rsync.inotify.samba) 一:OpenSSH服务与Telnet服务(必须掌握) 前言:OpenSSH是加密传输,Telnet是明文 ...

  9. links and softwares

    links 普通 http://www.ncpa-classic.com//special/2014gejujie/index.shtml ; 中国大剧院 http://tieba.baidu.com ...

随机推荐

  1. 【Python】将python3.6软件的py文件打包成exe程序

    下载pyinstaller pyinstaller 改变图标 pyinstaller -F --icon=my.ico xxx.py 采用命令行操作的办法 在cmd命令行中,输入代码: 首先,前往Py ...

  2. Android Launcher分析和修改12——Widget列表信息收集

    很久没写Launcher分析的文章,最近实在太忙.今天七夕本来是想陪女朋友逛街 ,碰巧打台风呆在家里,就继续写一篇文章.今天主要是讲一下Launcher里面的Widget列表,这方面信息比较多,今天重 ...

  3. 【iCore1S 双核心板_ARM】例程九:DAC实验——输出直流电压

    实验原理: STM32内部集成12位DAC,可以配置成12位或8位,DAC具有两个独立转换通道, 在双DAC模式下,DA转换可被配置成独立模式或工作模式,iCore1S中DAC参考电压为 2.5V.本 ...

  4. centos 7 配置tomcat开机启动

    1. tomcat 需要增加一个pid文件 在tomca/bin 目录下面,增加 setenv.sh 配置,catalina.sh启动的时候会调用,同时配置java内存参数. #add tomcat ...

  5. js 规范

    1.原型链的弊端是不支持多重继承.记住,原型链会用另一类型的对象重写类的 prototype 属性 2.注意:调用 ClassA 的构造函数,没有给它传递参数.这在原型链中是标准做法.要确保构造函数没 ...

  6. Kubernetes集群部署之二CA证书制作

    创建TLS证书和秘钥 kubernetes 系统的各组件需要使用 TLS 证书对通信进行加密,本文档使用 CloudFlare 的 PKI 工具集 cfssl 来生成 Certificate Auth ...

  7. swoole 定时器

    timer.php <?php //创建websocket服务器对象,监听0.0.0.0:9502端口 $ws = ); swoole_timer_tick(, function ($timer ...

  8. 利用反射将Model转化为sql

    public string GetInsertSqlByModel(Object o) { StringBuilder sbStart = new StringBuilder(); StringBui ...

  9. [IR] Search Server - Sphinx

    使用 Sphinx 更好地进行 MySQL 搜索 - IBM 尽管 MySQL 是一个出色的通用数据库,但是如果您的应用程序需要进行大量搜索,那么使用 Sphinx 可获得更好的性能. 尽管 Sphi ...

  10. SpringBoot thymeleaf模板页面没提示,SpringBoot thymeleaf模板插件安装

    SpringBoot thymeleaf模板插件安装 SpringBoot thymeleaf模板Html页面没提示 SpringBoot  thymeleaf模板页面没提示 SpringBoot t ...