LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-10-2021, 04:12 AM   #1
Oomu
LQ Newbie
 
Registered: Dec 2021
Posts: 4

Rep: Reputation: Disabled
Server partition lost?


Hi,

Recently I have edited the file /etc/fstab and did something stupid.
At first it looked like this :

/dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/server--vg-home /home ext4 defaults 0 2
/dev/mapper/server--vg-tmp /tmp ext4 defaults 0 2
/dev/mapper/server--vg-var /var ext4 defaults 0 2

Then in /etc/fstab I did this change (3rd line, var -> home)

/dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/server--vg-home /home ext4 defaults 0 2
/dev/mapper/server--vg-tmp /home ext4 defaults 0 2
/dev/mapper/server--vg-var /var ext4 defaults 0 2

and did a reboot. The system did not like it so I switched back to original setup. After a reboot the system was unable to find the /home directory on my server.

Is there a possibility to recover those files? Nothing has be written since the reboot.

Thanks a lot for your help!
 
Old 12-10-2021, 06:02 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Oomu View Post
After a reboot the system was unable to find the /home directory on my server.
As root, show us
Code:
ls -ld /home
ls -l /home
 
Old 12-10-2021, 06:11 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,123

Rep: Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373
and probably additionally:
Code:
mount
df -h /home
 
Old 12-10-2021, 06:51 AM   #4
Oomu
LQ Newbie
 
Registered: Dec 2021
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi,

So below are the results of the commands. I also realized I might be unclear, sorry : I see the /home directory, it is just empty and the home directories of users are not there anymore. The /home is empty.
Thanks for your help.

$ sudo ls -ld /home :

drwxr-xr-x 7 root root 4096 Dec 6 15:48 /home


$ ls -l /home :

total 0
srwxr-xr-x 1 root root 0 Dec 6 15:44 sddm-auth31d0020d-968a-4789-b759-9130a41c229d


$ df -h /home

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/server--vg-home 21T 28K 20T 1% /home


$ mount :


sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=528125368k,nr_inodes=132031342,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=105629276k,mode=755)
/dev/mapper/server--vg-root on / type ext4 (rw,relatime,errors=remount-ro,stripe=256)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=43,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=166317)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
/dev/nvme1n1p1 on /scratch1 type ext4 (rw,relatime)
/dev/nvme0n1p1 on /scratch0 type ext4 (rw,relatime)
/dev/sda2 on /boot type ext2 (rw,relatime,stripe=1024)
/dev/mapper/server--vg-var on /var type ext4 (rw,relatime,stripe=256)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
/dev/mapper/server--vg-tmp on /tmp type ext4 (rw,relatime,stripe=256)
tmpfs on /run/user/114 type tmpfs (rw,nosuid,nodev,relatime,size=105629272k,mode=700,uid=114,gid=120)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /run/user/1002 type tmpfs (rw,nosuid,nodev,relatime,size=105629272k,mode=700,uid=1002,gid=1002)
/dev/mapper/server--vg-home on /home type ext4 (rw,relatime,stripe=256)
 
Old 12-10-2021, 07:12 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,123

Rep: Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373
it looks like the partition is ok, available and mounted. But the content is lost. I guess you made something else too.
 
Old 12-10-2021, 08:17 AM   #6
Oomu
LQ Newbie
 
Registered: Dec 2021
Posts: 4

Original Poster
Rep: Reputation: Disabled
I think it is all I did. But as I explained I changed

/dev/mapper/server--vg-tmp /tmp ext4 defaults 0 2

to

/dev/mapper/server--vg-tmp /home ext4 defaults 0 2

then I did a reboot and then came back to the original step.

So what happened during this step? Since /home was already existing, I guess this is when the lost of data happened.
Another point : after the first reboot, I was able to login by ssh keys (so the homes where still there I guess). After the second reboot, I add to enter my password and I got the message '/home/monlogin' is not accessible.
 
Old 12-10-2021, 08:26 AM   #7
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,688

Rep: Reputation: Disabled
Quote:
Originally Posted by Oomu View Post
So what happened during this step?
Nothing bad should have happened because of that alone. See this SE question and this LQ thread.

The only plausible explanation I have is that what you actually did was the direct opposite of what you described.

I.e. instead of
Quote:
Originally Posted by Oomu View Post
Then in /etc/fstab I did this change (3rd line, tmp -> home)

/dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/server--vg-home /home ext4 defaults 0 2
/dev/mapper/server--vg-tmp /home ext4 defaults 0 2
/dev/mapper/server--vg-var /var ext4 defaults 0 2
you did home -> tmp
Code:
/dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/server--vg-home /tmp ext4 defaults 0 2
/dev/mapper/server--vg-tmp /home ext4 defaults 0 2
/dev/mapper/server--vg-var /var ext4 defaults 0 2
In that case, /dev/mapper/server--vg-home which was thought of as /tmp by the system could indeed get cleaned on reboot.

Last edited by shruggy; 12-10-2021 at 10:40 AM.
 
Old 12-10-2021, 08:57 AM   #8
Oomu
LQ Newbie
 
Registered: Dec 2021
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for your reply.

No, I am sure I did not swap the two entries.
But I actually remember something else (sorry for remembering only now, I did not do this last step myself :/ ). At the end, because of a wrong copy paste the file /etc/fstab became (3rd line has changed)

/dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/server--vg-home /home ext4 defaults 0 2
/dev/mapper/server--vg-tmp /tmp2 ext4 defaults 0 2
/dev/mapper/server--vg-var /var ext4 defaults 0 2

but tmp2 did not exist ...
So the server was not able to reboot (it was trying to find the partition) and a manual reboot was necessary. It was after that step that the homes disappeared.
 
Old 12-10-2021, 09:25 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,123

Rep: Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373Reputation: 7373
Quote:
Originally Posted by Oomu View Post
Thanks for your reply.

No, I am sure I did not swap the two entries.
But I actually remember something else (sorry for remembering only now, I did not do this last step myself :/ ). At the end, because of a wrong copy paste the file /etc/fstab became (3rd line has changed)

/dev/mapper/server--vg-root / ext4 errors=remount-ro 0 1
/dev/mapper/server--vg-home /home ext4 defaults 0 2
/dev/mapper/server--vg-tmp /tmp2 ext4 defaults 0 2
/dev/mapper/server--vg-var /var ext4 defaults 0 2

but tmp2 did not exist ...
So the server was not able to reboot (it was trying to find the partition) and a manual reboot was necessary. It was after that step that the homes disappeared.
the facts: /home (and /tmp2) will not be deleted magically by any tool, any software.
/tmp can be deleted automatically during boot, that may depend on your OS/configuration.
So either you executed a command yourself (to clean that filesystem) or was handled as /tmp.
Anyway, you may try to use a recovery tool to look for your lost files (for example: https://likegeeks.com/recover-deleted-files-on-linux/)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not formatting a partition while installing Ubuntu but still data getting lost from that partition! ravisingh1 Linux - Laptop and Netbook 5 07-29-2014 01:44 AM
HDD partition lost. xandros DVD + me = lost data lein Linux - General 18 05-22-2007 05:47 AM
Lost mouse after reboot+lost modem BACTRATE Mandriva 3 04-07-2005 06:45 AM
power lost from cable modem, interface lost a10392 Linux - Networking 4 11-16-2004 09:01 AM
C++ templates + linked lists... lost.. very lost.. exodist Programming 2 05-12-2004 11:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration