因此,我有一台运行 Scientific Linux 6.9 的服务器,我想在上面安装 7。显然不支持升级,所以我需要进行全新安装,这没问题。
我使用 Kickstart 安装了 SL6 服务器,并采用以下选项:
...
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb vga=788"
clearpart --all --drives=sda
part /boot --fstype=ext4 --size=500
part pv.008002 --grow --size=1
volgroup vg_main --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=lv_root --vgname=vg_main --size=8192
logvol /home --fstype=ext4 --name=lv_home --vgname=vg_main --fsoptions="usrquota" --size=8192 --grow
logvol swap --name=lv_swap --vgname=vg_main --size=1024
...
我只想/home
在新安装期间保留 LV。我已阅读--noformat
文档中有关该选项的信息,但它可以应用于分割,卷组, 和逻辑卷配置。我不清楚应该在哪个级别使用它,更重要的是,它将如何识别相关结构。
幸好这是虚拟机,所以我有快照可以依靠,但我不想在这上面浪费太多时间。那么,我应该使用哪些选项来安装 SL7 以确保它/home
不受影响?
fdisk -l
如果有帮助的话输出:
Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000852f6
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 32636 261630976 8e Linux LVM
Disk /dev/mapper/vg_main-lv_root: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_main-lv_swap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_main-lv_home: 258.2 GB, 258243297280 bytes
255 heads, 63 sectors/track, 31396 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
输出vgdisplay -v
:
Using volume group(s) on command line.
--- Volume group ---
VG Name vg_main
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 249.51 GiB
PE Size 4.00 MiB
Total PE 63874
Alloc PE / Size 63874 / 249.51 GiB
Free PE / Size 0 / 0
VG UUID T03S3I-cgaj-A2OY-1e9d-FBiQ-8xpJ-NN3hUo
--- Logical volume ---
LV Path /dev/vg_main/lv_root
LV Name lv_root
VG Name vg_main
LV UUID FPXNoA-pqjg-Krbx-O5Sn-jFzg-GGsb-Ual7ww
LV Write Access read/write
LV Creation host, time rainicorn.domain.internal, 2014-06-05 14:12:41 -0400
LV Status available
# open 1
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/vg_main/lv_home
LV Name lv_home
VG Name vg_main
LV UUID E38kVe-nxYm-rKop-Gwka-80Lh-T2VF-vGUkHE
LV Write Access read/write
LV Creation host, time rainicorn.domain.internal, 2014-06-05 14:12:44 -0400
LV Status available
# open 1
LV Size 240.51 GiB
Current LE 61570
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/vg_main/lv_swap
LV Name lv_swap
VG Name vg_main
LV UUID HoZ84h-eXye-lgNw-ggTN-YIEc-X0fZ-ZLcRCo
LV Write Access read/write
LV Creation host, time rainicorn.domain.internal, 2014-06-05 14:13:07 -0400
LV Status available
# open 1
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Physical volumes ---
PV Name /dev/sda2
PV UUID shdyY0-fhMC-c7kB-LoKG-Jlk8-qN81-14toG3
PV Status allocatable
Total PE / Free PE 63874 / 0
答案1
这就是我在 SL7 kickstart 文件中最终成功实现的。该part
指令有一个--onpart
选项可以指定在哪个驱动器上查找分区,其余的似乎都是从那里开始的。一些明智的使用--useexisting
确保--noformat
我的数据在安装后等待着我。
zerombr
bootloader --location="mbr" --driveorder="sda" --append="crashkernel=auto rhgb vga=788"
part /boot --fstype="xfs" --recommended --onpart=sda1
part pv.008002 --grow --size=1 --noformat --onpart=sda2
volgroup vg_main --pesize=4096 --useexisting --noformat
logvol / --fstype="xfs" --name="lv_root" --vgname="vg_main" --size=8192 --useexisting
logvol swap --name="lv_swap" --vgname="vg_main" --size=1024 --useexisting
logvol /home --fstype=ext4 --name=lv_home --vgname=vg_main --fsoptions="usrquota" --size=8192 --grow --noformat