将逻辑卷上的根文件系统移动到不同的磁盘

将逻辑卷上的根文件系统移动到不同的磁盘

我正在尝试将我的根 LV 移动到我的全新 SSD 上的新 VG,这让我发疯。我想我用 rsync 完成了它,但现在 grub 拒绝从 /dev/vg_ssd/lv_root 注册新的引导选项。为什么linux不像AIX那样有cplv或lvmove?

我想使用 vg_ssd/root 挂载到 / 而不是 vg_dopey/lv00。 /boot 是独立的。 Grub2/FC17。 Linux dopey 3.6.2-4.fc17.x86_64 #1 SMP 10 月 17 日星期三 02:43:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

lv显示

--- Logical volume ---
  LV Path                /dev/vg_ssd/root
  LV Name                root
  VG Name                vg_ssd
  LV UUID                oDms4t-cKve-Eg27-jdcW-H3Wu-kvhs-qHhJQm
  LV Write Access        read/write
  LV Creation host, time dopey, 2012-10-22 20:25:31 -0400
  LV Status              available
  # open                 0
  LV Size                32.00 GiB
  Current LE             8191
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/vg_dopey/lv01
  LV Name                lv01
  VG Name                vg_dopey
  LV UUID                2tSy4L-kPnC-8rSE-jXX8-Dad4-9F4v-TPVmQz
  LV Write Access        read/write
  LV Creation host, time dopey, 2012-10-01 22:50:49 -0400
  LV Status              available
  # open                 1
  LV Size                468.69 GiB
  Current LE             14998
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/vg_dopey/lv00
  LV Name                lv00
  VG Name                vg_dopey
  LV UUID                SYe9Ze-XFUb-kIcu-UxEO-dhMd-ubaf-oAphsk
  LV Write Access        read/write
  LV Creation host, time dopey, 2012-10-01 22:50:53 -0400
  LV Status              available
  # open                 1
  LV Size                19.53 GiB
  Current LE             625
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

/etc/fstab,在新旧 root lvs 上

#/dev/mapper/vg_dopey-lv00 /                       ext4    defaults        1 1
UUID=587081f1-e607-43bd-85f5-7632d833726e /boot                   ext4    defaults        1 2
/dev/vg_dopey/lv01      /home       ext4    defaults    1 2
UUID=8dec0c61-6593-4e1d-a7b1-86de1816a601 /opt/media              ext4    defaults        1 2
UUID=910763ef-317b-4c48-b92f-8f24a729ffb8 swap                    swap    defaults        0 0
#/dev/mapper/vg_ssd-root
UUID=f7ada493-298d-4c09-8260-a8988ede1cfe / ext4 discard,noatime,errors=remount-ro 0 1

/boot/grub2/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="${saved_entry}"

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod part_msdos
insmod lvm
insmod ext2
set root='lvm/vg_dopey-lv00'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='lvm/vg_dopey-lv00'  67deba56-4839-41c3-8c51-46185c8efd0e
else
  search --no-floppy --fs-uuid --set=root 67deba56-4839-41c3-8c51-46185c8efd0e
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-67deba56-4839-41c3-8c51-46185c8efd0e' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
    else
      search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
    fi
    echo    'Loading Linux 3.6.2-4.fc17.x86_64 ...'
    linux   /vmlinuz-3.6.2-4.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet 
    echo    'Loading initial ramdisk ...'
    initrd  /initramfs-3.6.2-4.fc17.x86_64.img
}
submenu 'Advanced options for Fedora' $menuentry_id_option 'gnulinux-advanced-67deba56-4839-41c3-8c51-46185c8efd0e' {
    menuentry 'Fedora, with Linux 3.6.2-4.fc17.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.2-4.fc17.x86_64-advanced-67deba56-4839-41c3-8c51-46185c8efd0e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
        else
          search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
        fi
        echo    'Loading Linux 3.6.2-4.fc17.x86_64 ...'
        linux   /vmlinuz-3.6.2-4.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-3.6.2-4.fc17.x86_64.img
    }
    menuentry 'Fedora, with Linux 3.6.2-4.fc17.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.2-4.fc17.x86_64-recovery-67deba56-4839-41c3-8c51-46185c8efd0e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
        else
          search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
        fi
        echo    'Loading Linux 3.6.2-4.fc17.x86_64 ...'
        linux   /vmlinuz-3.6.2-4.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro single rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-3.6.2-4.fc17.x86_64.img
    }
    menuentry 'Fedora, with Linux 3.6.1-1.fc17.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.1-1.fc17.x86_64-advanced-67deba56-4839-41c3-8c51-46185c8efd0e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
        else
          search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
        fi
        echo    'Loading Linux 3.6.1-1.fc17.x86_64 ...'
        linux   /vmlinuz-3.6.1-1.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-3.6.1-1.fc17.x86_64.img
    }
    menuentry 'Fedora, with Linux 3.6.1-1.fc17.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.1-1.fc17.x86_64-recovery-67deba56-4839-41c3-8c51-46185c8efd0e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
        else
          search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
        fi
        echo    'Loading Linux 3.6.1-1.fc17.x86_64 ...'
        linux   /vmlinuz-3.6.1-1.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro single rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-3.6.1-1.fc17.x86_64.img
    }
    menuentry 'Fedora, with Linux 3.5.6-1.fc17.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.5.6-1.fc17.x86_64-advanced-67deba56-4839-41c3-8c51-46185c8efd0e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
        else
          search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
        fi
        echo    'Loading Linux 3.5.6-1.fc17.x86_64 ...'
        linux   /vmlinuz-3.5.6-1.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet 
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-3.5.6-1.fc17.x86_64.img
    }
    menuentry 'Fedora, with Linux 3.5.6-1.fc17.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.5.6-1.fc17.x86_64-recovery-67deba56-4839-41c3-8c51-46185c8efd0e' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos6'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  587081f1-e607-43bd-85f5-7632d833726e
        else
          search --no-floppy --fs-uuid --set=root 587081f1-e607-43bd-85f5-7632d833726e
        fi
        echo    'Loading Linux 3.5.6-1.fc17.x86_64 ...'
        linux   /vmlinuz-3.5.6-1.fc17.x86_64 root=/dev/mapper/vg_dopey-lv00 ro single rd.md=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.luks=0 LANG=en_US.UTF-8 rd.lvm.lv=vg_dopey/lv00 rhgb quiet
        echo    'Loading initial ramdisk ...'
        initrd  /initramfs-3.5.6-1.fc17.x86_64.img
    }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Microsoft Windows XP Professional (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-AA0C2EE80C2EAF6F' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  AA0C2EE80C2EAF6F
    else
      search --no-floppy --fs-uuid --set=root AA0C2EE80C2EAF6F
    fi
    drivemap -s (hd0) ${root}
    chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=2013244k,nr_inodes=503311,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
/dev/mapper/vg_dopey-lv00 on / type ext4 (rw,noatime,seclabel,discard,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=27,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel,mode=755)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
/dev/sdc1 on /opt/media type ext4 (rw,relatime,seclabel,data=ordered)
/dev/sda6 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg_dopey-lv01 on /home type ext4 (rw,relatime,seclabel,data=ordered)
gvfs-fuse-daemon on /run/user/me/gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)

答案1

pvmove会将 VG 内的 LV 从现有 PV 移动到另一个 PV。

这可能会解决你的问题...

答案2

你的 fstab 听起来坏了,只需修改/etc/fstab,并将安装根目录的行更改为新的,可能是 UUID=XXX,

要查找所有 uuid,请blkid以 root 身份运行。

如果您的 grub.cfg 已过期,请使用grub-mkconfig -o /boot/grub/grub.cfg重新生成 grub.cfg

编辑

请注意,当 grub 扫描根设备时,它会将当前安装的设备作为根设备。您需要手动修改grub.cfg并从SSD启动,然后grub-mkconfig再次运行

相关内容