LVM problem

General support questions
Post Reply
InfernalRed
Posts: 6
Joined: 2018/01/31 12:41:58

LVM problem

Post by InfernalRed » 2018/03/26 19:12:53

Hi all. I have 2 VM. On the first VM i attach second physical disk, mount him, and copy files to him. Then i shutdown first VM, and attach this is disk to second VM. Mount LVM like on first VM, but i don't see my files. What i am doing wrong? :(

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: LVM problem

Post by TrevorH » 2018/03/26 22:32:50

What exactly did you do on the first VM? Give the exact commands you issued and in what order. You can probably retrieve those by looking at the output from the history command or by browsing through the contents of /root/.bash_history.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

InfernalRed
Posts: 6
Joined: 2018/01/31 12:41:58

Re: LVM problem

Post by InfernalRed » 2018/03/27 05:14:24

Thank you ;)

Code: Select all

df -h
fdisk -l
gdisk
gdisk help
gdisk -l
gdisk /sdb
gdisk sdb
gdisk /dev/sdb
df -h
fdisk -l
pvdisplay
pvcreate
pvccreate PV
pvcreate PV
pvcreate --help
gdisk -l
gdisk
mc
partprobe
pvcreate /dev/sdb1
df -h
fdisk -l
pvdisplay
vgcreate backup
vgcreate backup /dev/sdb1
pvdisplay
lvcreate -name lv_backup -l +100%FREE backup
lvcreate -name backup -l +100%FREE backup
lvcreate -name lv_backup -l +100%FREE backup
pvdisplay
df -h
pvdisplay
gdisk /dev/sdb
mkfs.xfs /dev/sdb1
vgdisplay
lvs
lvdisplay
lvcreate -name lv_backup -L +100%FREE backup
lvcreate -n lv_backup -L +100%FREE backup
lvcreate -n lv_backup -L+100%FREE backup
lvcreate --help
pvdisplay
lvcreate -n lv_backup -L 60G backup
lvcreate -n lv_backup -L 59G backup
lvs
lvdisplay
mc
mkfs.xfs /dev/backup/lv_backup
mc
mkdit /mnt/dir_backup
mkdir /mnt/dir_backup
mount /dev/backup/lv_backup /mnt/dir_backup
df -h
cd /mnt/
ll
ls -l
mc
reload
reboot
mc
reboot
mc
lsblk
blkid
mc
ll
tar cvpzf /mnt/dir_backup/26.03.2018/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/tmp
tar cvpzf /mnt/dir_backup/26.03.2018/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/tmp --exclude=/sys/ /
mc
df -h
lvdisplay
pvs
lvdisplay
vgdisplay
mc
pvsdisplay
pvc
pvdisplay
mc
df -h
mc
lvdisplay
lvs

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: LVM problem

Post by aks » 2018/03/30 11:22:29

Is the LVM activated on the second VM (lvchange -y)?

InfernalRed
Posts: 6
Joined: 2018/01/31 12:41:58

Re: LVM problem

Post by InfernalRed » 2018/04/10 08:43:35

Code: Select all

[root@srv100 ~]# lvscan
  ACTIVE            '/dev/backup/lv_backup' [59.00 GiB] inherit
  ACTIVE            '/dev/centos/swap' [3.75 GiB] inherit
  ACTIVE            '/dev/centos/home' [<18.06 GiB] inherit
  ACTIVE            '/dev/centos/root' [<36.99 GiB] inherit
yes.active

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: LVM problem

Post by TrevorH » 2018/04/10 08:48:07

Your history says you mounted it on /mnt/dir_backup but when you ran the tar command you were not in that directory so your files won't have been put there. You did cd /mnt/ first though your history also shows you rebooted shortly afterwards and didn't remount the LV nor did you cd to it again and only then did you untar your file.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

InfernalRed
Posts: 6
Joined: 2018/01/31 12:41:58

Re: LVM problem

Post by InfernalRed » 2018/04/10 10:28:05

No, then i shutdown VM1, after mount VHD disk to VM2 and power ON. Mount disk and don't see files, folder have been created on VM1.

VM1

Code: Select all

[root@localhost dir_backup]# ll
26.03.2018/ test1/      test2/      test3/      test4/
[root@localhost dir_backup]# ll ls
[root@localhost dir_backup]# ls
26.03.2018  test1  test2  test3  test4
VM2

Code: Select all

# mount /dev/backup/lv_backup /mnt/dir_backup
[root@srv100 dir_backup]#
[root@srv100 dir_backup]# ll
11111/ 33333/ test1/
[root@srv100 dir_backup]# ll
total 0
drwxr-xr-x. 2 root root 6 Mar 26 13:39 11111
drwxr-xr-x. 2 root root 6 Mar 26 13:39 33333
drwxr-xr-x. 2 root root 6 Mar 26 14:10 test1

InfernalRed
Posts: 6
Joined: 2018/01/31 12:41:58

Re: LVM problem

Post by InfernalRed » 2018/04/14 16:46:45

Maybe if LVM was be created another VM1, VM2 hasn't rights to this LVM? But she have saw this LVM disk.

Post Reply