os信息备份

系统版本

1
2
3
4
5
6
cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)


# uname -r
3.10.0-957.el7.x86_64

el7是RHEL7系列的,centos7看到

1
2
❯ uname -r
6.1.0-0.deb11.7-amd64

debian11

图形界面

xface

1
2
3
4
5
6
7
8
#查看当前启动模式
systemctl get-default

#由命令行模式更改为图形界面模式
systemctl set-default graphical.target

#由图形界面模式更改为命令行模式
systemctl set-default multi-user.target

命令行界面—>图形界面

执行startx命令

图形界面—>命令行界面

Ctrl+Alt+F2

CPU信息

1
❯ sudo dmidecode | grep -A16 "Memory Device" | grep 'Type:\|Speed\|Size:' |grep -v "Unknown\|Installed\|Range"

Size: 8 GB
Type: DDR4
Speed: 2400 MT/s
Size: 8 GB
Type: DDR4
Speed: 2400 MT/s

CPU主频:

1
❯ sudo dmidecode -t processor | grep "Speed"

Max Speed: 8300 MHz

Current Speed: 2700 MHz

1
2
3
4
5
6
7
8
9
10
11
12
13
❯ lscpu | grep "MHz"
CPU MHz: 3400.159
CPU max MHz: 3800.0000
CPU min MHz: 800.0000
❯ cat /proc/cpuinfo | grep "cpu MHz"
cpu MHz : 3399.938
cpu MHz : 3471.310
cpu MHz : 3446.992
cpu MHz : 3497.726
cpu MHz : 3445.833
cpu MHz : 3496.419
cpu MHz : 3448.879
cpu MHz : 943.164
1
2
❯ cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
3800000

引导

启动

1
2
3
4
5
6
7
8
#选择系统图
/usr/share/grub/themes/breeze
#themes配置
/usr/share/grub/themes/breeze/theme.txt


#启动图
/usr/share/images/desktop-base/desktop-grub.png

双系统boot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cs@debian:~$ sudo tree /boot/efi/EFI -L 2
/boot/efi/EFI
├── Boot
│   └── bootx64.efi
├── debian
│   ├── BOOTX64.CSV
│   ├── fbx64.efi
│   ├── grub.cfg
│   ├── grubx64.efi
│   ├── mmx64.efi
│   └── shimx64.efi
└── Microsoft
└── Boot

4 directories, 7 files

1
2
3
4
5
6
7
8
9
10
cs@debian:~$ sudo update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-5.10.0-21-amd64
Found initrd image: /boot/initrd.img-5.10.0-21-amd64
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

https://www.cnblogs.com/coding-my-life/p/12817690.html

备份

步骤

新盘先装系统分好盘

新系统内核与老系统版本一致

1
2
❯ uname -r
6.1.0-0.deb11.6-amd64

查看安装的内核

1
dpkg --get-selections | grep linux-image

卸载无用内核

1
2
sudo apt-get purge linux-image-4.2.0-16-generic
sudo apt autoremove

建议先卸载比较老的内核,不需要的可以删除。正常情况下,除正在使用的其它的都可以卸载,但是由于考虑到刚升级的版本可能不稳定,所以最好保留1个旧版本备用。

进入原系统

备份目录,解压到新系统目录

1
2
3
4
5
6
7
8
9
10
11
12
13
#用户目录配置信息文件
/home/cs$ tar cvpzf cs.tar.gz --exclude=.cache --exclude=cs.tar.gz ./.*

/media/cs/xx/cs$ tar xvpfz cs.tar.gz -C ./

tar -cvpzf ./var.tar.gz --exclude=/var/tmp --exclude=/var/log /var
tar xvpfz var.tar.gz -C /media/cs/xx/var --strip-components 1

tar -cvpzf ./usr.tar.gz /usr
tar xvpfz usr.tar.gz -C /media/cs/xx/usr --strip-components 1

tar -cvpzf ./etc.tar.gz --exclude=/etc/fstab /etc
tar xvpfz etc.tar.gz -C /media/cs/xx/etc --strip-components 1

–exclude 权限问题无法或无需备份的进行过滤文件目录

提前备份新旧系统的2个文件

/etc/fstab(fstab 盘符uuid不一样)

/boot/grub/grub.cfg (grub.cfg 盘符uuid不一样)

登陆新系统验证

grub

win

win os u盘修复win引导在esp盘

linux

无法进入grub

linux u盘 引导修复 ,主要是挂载目录到shell环境

grub>

在救援模式下只有很少的命令可以用:set , ls , insmod , root , prefix

  • ls 查看设备
  • set 查看环境变量,这里可以查看启动路径和分区。
  • root 指定用于启动系统的分区,在救援模式下设置grub启动分区
  • prefix 设定grub启动路径
  • insmod 加载模块normal

1
2
3
4
5
6
7
grub rescue>set root=(hd0,gpt4) 

grub rescue>set prefix=(hd0,gpt4)/boot/grub

grub rescue>insmod normal #启动normal启动

grub rescue>normal #之后你就会看到熟悉的启动菜单栏了

出现选择界面,进入系统

1
2
3
4
5
6
7
8
9
10
11
12
❯ update-grub
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/breeze/theme.txt
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-6.1.0-0.deb11.6-amd64
Found initrd image: /boot/initrd.img-6.1.0-0.deb11.6-amd64
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p6@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

直接操作 update-grub 会导致每次都是 grub> ,重新设置启动 grub-install

grub-install /dev/nvme0n1p1

在进入系统之后,通过grub-install脚本进行安装grub,原先在/boot/grub下的stage文件都删除也没关系,该脚本每次执行都会删除这些文件的。

参数(可省略) 含义
–root-directory 在指定目录安装GRUB镜像
–grub-shell 使用指定文件作为GRUB Shell
–no-floppy 不探测任何软盘驱动器

https://www.cnblogs.com/zhengah/p/4238396.html

new

old

盘/etc/fstab

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
❯ sudo lsblk -o name,uuid
NAME UUID
sda
├─sda1 70BE7BF5BE7BB1E8
├─sda2 0FE407890FE40789
├─sda3 b519f517-5f11-4108-8601-e456e3da4fd1
├─sda4 0CFA1DD20CFA1DD2
└─sda5 2006966506963BAA
sdb
├─sdb1 0003DFF700005BA6
├─sdb2 FF6E-1E1A
├─sdb3 fe04554c-3dae-42e5-9fd5-5ddda44d2f1c
├─sdb4 5f92ed02-f45d-49e5-b245-09f7447eac24
├─sdb5 5cb263cd-27a3-4ab2-9090-7417f4c80536
├─sdb6 abca56cf-7ab5-4c4a-a5ab-f4b2ebdc0c82
└─sdb7 f26d54f8-1746-47a9-8805-3d339062ab3a
nvme0n1
├─nvme0n1p1 8aef5178-364f-47de-9016-3b3bb254aadd
├─nvme0n1p2 ff3aedfa-1448-4161-95fb-3b43fddf4506
├─nvme0n1p3 8c8a753d-b3f4-45ee-b2a8-629c13f4c18e
├─nvme0n1p4 a40908d9-e0e9-4d17-8aad-d7e1a1f90730
├─nvme0n1p5 bb259291-c221-4e34-b422-663e0bea289e
└─nvme0n1p6 E509-52C5

new

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p1 during installation
UUID=8aef5178-364f-47de-9016-3b3bb254aadd / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p6 during installation
UUID=E509-52C5 /boot/efi vfat umask=0077 0 1
# /home was on /dev/nvme0n1p3 during installation
UUID=8c8a753d-b3f4-45ee-b2a8-629c13f4c18e /home ext4 defaults 0 2
# /opt was on /dev/nvme0n1p4 during installation
UUID=a40908d9-e0e9-4d17-8aad-d7e1a1f90730 /opt ext4 defaults 0 2
# /usr was on /dev/nvme0n1p2 during installation
UUID=ff3aedfa-1448-4161-95fb-3b43fddf4506 /usr ext4 defaults 0 2
# swap was on /dev/nvme0n1p5 during installation
UUID=bb259291-c221-4e34-b422-663e0bea289e none swap sw 0 0
# /data was on /dev/sdb3 during installation

old

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda7 during installation
UUID=f26d54f8-1746-47a9-8805-3d339062ab3a / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda2 during installation
UUID=FF6E-1E1A /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda6 during installation
UUID=abca56cf-7ab5-4c4a-a5ab-f4b2ebdc0c82 /home ext4 defaults 0 2
# /opt was on /dev/sda4 during installation
UUID=5f92ed02-f45d-49e5-b245-09f7447eac24 /opt ext4 defaults 0 2
# /usr was on /dev/sda5 during installation
UUID=5cb263cd-27a3-4ab2-9090-7417f4c80536 /usr ext4 defaults 0 2
# swap was on /dev/sda3 during installation
UUID=fe04554c-3dae-42e5-9fd5-5ddda44d2f1c none swap sw 0 0
# /data was on /dev/sdb3 during installation
UUID=b519f517-5f11-4108-8601-e456e3da4fd1 /home/cs/data xfs defaults 0 2

upgrade

更新本地包索引

1
sudo apt update

安装可用更新

1
2
3
$ sudo apt upgrade
$ sudo apt full-upgrade
$ sudo apt --purge autoremove

重启

1
sudo reboot

$ sudo apt-mark showhold | more
$ sudo apt-mark unhold

备份源

1
2
3
4
5
sudo cp -v /etc/apt/sources.list /opt/sources.list-bakup-debian11

sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list

sudo apt update

升级系统

1
sudo apt full-upgrade

Pres-q-to-Proceed-further-Debian-Upgrade 按 q 继续下一步

Keep-Local-Verison-SSHD-During-Debian-Upgrade

Keep-Local-Grub-Version-During-Debian-Upgrade

重启

1
sudo reboot

error

mdadm: no arrays found in config file or automatically

1
2
3
#debian 
sudo rm /etc/initramfs-tools/conf.d/resume
sudo update-initramfs -u

This is the initramfs configuration where mdadm.conf is copied and some magic happens to start the array. Did you create a md raid array or use btrfs array options? If you used mdadm then mdadm --detail --scan >> /etc/mdadm/mdadm.conf will add the array configuration and update-initramfs -u -k all will create a new initramfs image. The resume entry is in /etc/initramfs-tools/conf.d/resume if you want to change that (i had to change it to ‘none’ for encrypted swap).

https://www.reddit.com/r/debian/comments/h8b0am/dell_optiplex_390_gets_stuck_on_mdadm_no_arrays/

点击打赏
文章目录
  1. 1. 系统版本
  2. 2. 图形界面
    1. 2.1. CPU信息
  3. 3. 引导
    1. 3.1. 启动
    2. 3.2. 双系统boot
  4. 4. 备份
    1. 4.1. 步骤
      1. 4.1.1. 新盘先装系统分好盘
      2. 4.1.2. 进入原系统
      3. 4.1.3. 登陆新系统验证
    2. 4.2. grub
      1. 4.2.1. win
      2. 4.2.2. linux
        1. 4.2.2.1. 无法进入grub
        2. 4.2.2.2. grub>
      3. 4.2.3. new
      4. 4.2.4. old
    3. 4.3. 盘/etc/fstab
      1. 4.3.1. new
      2. 4.3.2. old
  5. 5. upgrade
    1. 5.1. 更新本地包索引
    2. 5.2. 安装可用更新
    3. 5.3. 重启
    4. 5.4. 备份源
    5. 5.5. 升级系统
    6. 5.6. 重启
  6. 6. error
    1. 6.1. mdadm: no arrays found in config file or automatically
载入天数...载入时分秒... ,