cancel
Showing results for 
Search instead for 
Did you mean: 
AffanMeh
Cadet
Cadet
  • 1,537 Views

/home data missing after unmounting it from a LVM LV

Setup:

Disks: 1 (sda, sdb)

LV: 3 (/, swap, home)

Action:
I unmounted /home from the LVM and all the data disapperaed  from /home. (same path)

Solution:

* Remmounted the disk as before

* Copied data to /tmp

* Unmounted the disk and copied the data back

* Restored SELinux security context.

Question:

  1. Is there a better way of doing this?
  2. Why did it happen and where did my data go?
  3. Is there still any stale data residing on my disk if yes what is its location?

 

Looking forward for an explanation. Thank you guys.

 

Labels (4)
3 Replies
exceed
Flight Engineer
Flight Engineer
  • 1,501 Views

Maybe I'm not understanding you correctly, but these are my comments.

You say that you unmounted the LV volume for /home and the data was all gone. They are gone because the data was stored on the LV volume and when you unmount the volume the data are not shown anymore because the /home is not a part of the / logical volume. The data is still there as you saw yourself, but they are only stored on the part of the disk where the logical volume is stored (the home lv).

What you have done now appears to be that you have copied the data from the logical volume to another area on disk that also contains a logical volume but this time the / volume.

I suggest reading up on LVM to get a better understanding of how it works.

AffanMeh
Cadet
Cadet
  • 1,460 Views

@exceedI will thank you.

I got confused only because when we are mouting a directory to a new LV , at that time all the existing data remains as it is. But unmounting had this behaviour which I saw for the first time. Anyways thank you for your response, I will look it up. Cheers!

0 Kudos
Chetan_Tiwary_
Community Manager
Community Manager
  • 1,453 Views

Hi @AffanMeh ,

Yes you can use a better way of doing this. 

1. Please pefrom  a clean unmount if you are unmounting the data . umount -l is a good option.

2. use fsck or e2fsck or xfs_repair for FS cehck and repair ( there may be FS integrity issues or damage ).

3. Please esure you are using any available backup technology to backup your data. 

If you use forceful unmount or if there is any interruption to service like power or connectivity there can be a damage to filesystem data if the FS was in use. Clean unmount means FS is in consistent state and data on the filesystem is flushed to disk and all of the open files are closed. You can use umount -l /home for the same.

 

 

0 Kudos
Join the discussion
You must log in to join this conversation.