New dynamic volume (loop) missed after restart centos

607 views Asked by At

I have Centos on my physical drive. new volume created like commands below:

dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=50G
losetup /dev/loop3 cinder-volumes
fdisk /dev/loop3
n
p
1
ENTER
ENTER
t
8e
w
pvcreate /dev/loop3

All things goes right and I was happy. but after reboot, this volume missed. whats is the problem? thanks Befor Reboot After Reboot

1

There are 1 answers

10
Daein Park On

You can associate the /dev/loop3 with cinder-volumes files as using /etc/rc.d/rc.local conf.

CentOS 6 or less

# vim /etc/rc.d/rc.local

mknod -m 660 /dev/loop3 b 7 3
losetup /dev/loop3 /path/to/cinder-volumes

CentOS 7

# vim /etc/rc.d/rc.local

mknod -m 660 /dev/loop3 b 7 3
losetup /dev/loop3 /path/to/cinder-volumes

After modifying, you set the execution flag to /etc/rc.d/rc.local

# chmod u+x /etc/rc.d/rc.local

And more checks your OS rc-local.service as following,

# systemctl list-unit-files rc-local.service
UNIT FILE        STATE
rc-local.service static

or

UNIT FILE        STATE
rc-local.service disable

If the state is disable, you can be enable the rc-local service, but the state is static is not any more conf.

# systemctl enable rc-local.service

Updated: Adding restore steps based on hypothesis that refer from questions.

★★★In advance, I defined that these steps are just written as the provision of information, I won't be not responsible for data-loss caused by these steps.★★★

  1. Prepare the other server having same specifications as possible as you can.

  2. backup the data (here is cinder-volumes file) with dd or cp commands

  3. check the backup file whether same original data with md5sum command.

  4. the backup data transfer to the new server for testing.

  5. test command; losetup /dev/loop3 /path/to/cinder-volumes and blkid command for check UUID whether same with the original loop3 device.

  6. More tests was always conducted on the new server, not production or important environments.

the loop3 or loopN device is virtual device for using the non-block device as of block device. It is just mapping interfaces. The loop3 device is disappeared but if cinder-volumes is clear, no problem.

I hope you it's helpful.