0

I installed a LVM storage on my computer and I had very important information inside /HFT.

Here is the way I installed that LVM storage:

  1. sudo pvcreate /dev/sdb1 /dev/sdc1
  2. sudo vgcreate VG /dev/sdb1 /dev/sdc1
  3. sudo lvcreate -n LV -L 3T VG
  4. sudo mkfs .ext3 /dev/VG/LG (could be .ext4)
  5. mkdir /HFT
  6. sudo mount /dev/VG/LG /HFT

Before restarting, I got a nice 3TB storage, I could see it clearly with df -h. Now, after restarting my computer, if I make df -h, I got

┌─╼ [~]
└╼ cd /dev
autofs           disk         fuse       i2c-11   input     loop-control        psaux   sdb   sg5       tty0   tty20  tty32  tty44  tty56      ttyS0   ttyS20  ttyS4      vboxdrvu    vcsa3
block            dm-0         fw0        i2c-12   kmsg      mapper              ptmx    sdb1  sg6       tty1   tty21  tty33  tty45  tty57      ttyS1   ttyS21  ttyS5      vboxnetctl  vcsa4
bsg              dm-1         hidraw0    i2c-13   kvm       mcelog              ptp0    sdc   sg7       tty10  tty22  tty34  tty46  tty58      ttyS10  ttyS22  ttyS6      vboxusb     vcsa5
btrfs-control    dm-2         hidraw1    i2c-14   lightnvm  mei0                ptp1    sdd   sg8       tty11  tty23  tty35  tty47  tty59      ttyS11  ttyS23  ttyS7      vcs         vcsa6
bus              dm-3         hidraw2    i2c-2    log       mem                 pts     sde   shm       tty12  tty24  tty36  tty48  tty6       ttyS12  ttyS24  ttyS8      vcs1        vfio
cdrom            dri          hidraw3    i2c-3    loop0     memory_bandwidth    random  sdf   snapshot  tty13  tty25  tty37  tty49  tty60      ttyS13  ttyS25  ttyS9      vcs2        vga_arbiter
cdrw             drm_dp_aux0  hidraw4    i2c-4    loop1     mqueue              rfkill  sdg   snd       tty14  tty26  tty38  tty5   tty61      ttyS14  ttyS26  ubuntu-vg  vcs3        vhci
char             dvd          hpet       i2c-5    loop2     net                 rtc     sdh   sr0       tty15  tty27  tty39  tty50  tty62      ttyS15  ttyS27  uhid       vcs4        vhost-net
console          dvdrw        hugepages  i2c-6    loop3     network_latency     rtc0    sg0   stderr    tty16  tty28  tty4   tty51  tty63      ttyS16  ttyS28  uinput     vcs5        vhost-vsock
core             ecryptfs     hwrng      i2c-7    loop4     network_throughput  sda     sg1   stdin     tty17  tty29  tty40  tty52  tty7       ttyS17  ttyS29  urandom    vcs6        zero
cpu              fb0          i2c-0      i2c-8    loop5     null                sda1    sg2   stdout    tty18  tty3   tty41  tty53  tty8       ttyS18  ttyS3   usb        vcsa
cpu_dma_latency  fd           i2c-1      i2c-9    loop6     port                sda2    sg3   tpm0      tty19  tty30  tty42  tty54  tty9       ttyS19  ttyS30  userio     vcsa1
cuse             full         i2c-10     initctl  loop7     ppp                 sda3    sg4   tty       tty2   tty31  tty43  tty55  ttyprintk  ttyS2   ttyS31  vboxdrv    vcsa2
┌─╼ [/dev]
└────╼ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                          34G     0   34G   0% /dev
tmpfs                        6.7G   11M  6.7G   1% /run
/dev/mapper/ubuntu--vg-root  151G   61G   83G  43% /
tmpfs                         34G   29M   34G   1% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
tmpfs                         34G     0   34G   0% /sys/fs/cgroup
/dev/sda2                    705M  401M  253M  62% /boot
/dev/sda1                    511M  4.7M  507M   1% /boot/efi
tmpfs                        6.7G   16K  6.7G   1% /run/user/121
tmpfs                        6.7G   20K  6.7G   1% /run/user/1000
/home/infinity/.Private      151G   61G   83G  43% /home/infinity

Now, /HFT still exists, but it is empty.

I don't know if I lost everything. Is there a way to restore information? Why is the whole procedure cleared up everything once I rebooted my computer? What is the proper way that such an error does not happen again in the future?

UPDATE

sudo lvdisplay
  WARNING: Device for PV rat7TF-lEMd-U3Gi-29du-7Fn3-2bNC-9CVmqL not found or rejected by a filter.
  --- Logical volume ---
  LV Path                /dev/VG/LV
  LV Name                LV
  VG Name                VG
  LV UUID                Bm0ThM-KWDU-oyjm-F8Zt-NXdF-yyFO-2rvM9d
  LV Write Access        read/write
  LV Creation host, time infinity-ThinkStation-D30, 2018-04-16 15:00:57 -0400
  LV Status              NOT available
  LV Size                3.00 TiB
  Current LE             786432
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                f1TYvS-XFq1-Z6Nu-iuXg-H95j-0XUN-8J4vi3
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2017-11-14 13:28:06 -0500
  LV Status              available
  # open                 1
  LV Size                154.38 GiB
  Current LE             39522
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                q2kHAa-Q3jc-8C1t-JQvi-PtTo-3KR4-zoNH2a
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2017-11-14 13:28:07 -0500
  LV Status              available
  # open                 1
  LV Size                67.92 GiB
  Current LE             17387
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

UPDATE 2

┌─╼ [/]
└────╼ fdisk -l /dev/sdc
fdisk: cannot open /dev/sdc: Permission denied
┌─╼ [/]
└╼ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9619624a

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdc1        2048 3907026943 3907024896  1.8T  7 HPFS/NTFS/exFAT

I tried to run sudo mount /dev/VG/LV /HFT, but it seems not working fine. I've had the problem mount: /HFT: special device /dev/VG/LV does not exist.

UPDATE 3

root@infinity-ThinkStation-D30:/HFT# lvchange -ay --activationmode partial /dev/VG/LV
  PARTIAL MODE. Incomplete logical volumes will be processed.
  WARNING: Device for PV rat7TF-lEMd-U3Gi-29du-7Fn3-2bNC-9CVmqL not found or rejected by a filter.

┌─╼ [/HFT]
└╼ sudo mount /dev/VG/LV /HFT
mount: /HFT: can't read superblock on /dev/mapper/VG-LV.
  • 1
    1. You haven't mounted the filesystem yet – roaima Apr 19 '18 at 21:16
  • 1
    2. If you have really important information on an LV, spreading it across two disks like you have is equivalent to halving the lifetime of a disk. If either disk dies you will lose all your data. I hope you have a backup somewhere else. – roaima Apr 19 '18 at 21:19
  • 1
    4. If in your step 4 you used ext3 instead of ext4 you're setting yourself up for pain later down the road. There is almost no reason to use ext3 nowadays. – roaima Apr 19 '18 at 21:23
  • 1
    WARNING: Device for PV rat7TF-lEMd-U3Gi-29du-7Fn3-2bNC-9CVmqL not found or rejected by a filter. is worrying; also I don't see /dev/sdc1 in your listing (though I do see /dev/sdc)... Did something else happen to that disk? – derobert Apr 19 '18 at 21:37
  • 1
    What does fdisk -l /dev/sdc say? – derobert Apr 19 '18 at 21:41
1

What's happened here is that you don't have /dev/sdc1, which contains half of the volume group VG. Without it you cannot activate VG, which in turn means you cannot access the logical volume LV.

Currently you no access to any of your data on VG/LV. It might be stored on the missing disk, or you might be lucky and enough of it might be on the disk that's present.

Non-invasive steps I would recommend you take:

  1. Power off your system. Carefully check all the connectors for disk /dev/sdc to ensure it is fully connected. Restart.
  2. Run fdisk -l /dev/sdc to see if the partition even exists.
  3. Look in /etc/lvm/lvm.conf to see if there's a filter blocking access to your /dev/sdc1. Ignore all lines beginning with #. None of the rest should have a keyword that mentions filter.

Invasive steps I would not recommend you take unless everything else has failed:

  1. Run vgchange -ay /dev/VG --activationmode partial

    THIS ↑ ↑ MAY DESTROY YOUR DATA. On the other hand it may let you recover it.

  2. Run mount -o ro,noload /dev/VG/LV /HFT to mount what filesystem it can find and see if any of the data is present. If it is, copy it to a safe place and rebuild your LVM volume group. The mount is read-only so you won't be able to change anything in the LV.


As an aside, if you have important data there are two things you can do to mitigate its potential loss

  1. Take regular automated backups. Preferably to a separate location. (I use a cloud storage provider.)
  2. Use RAID 1 to mirror data across two same-sized disks. You'll need 2x 3TB disks to store 3TB data but it's worth it. Really it is. You can do this either using the mdadm RAID toolset or directly in LVM.
  • What cloud storage do you use? Like google drive, and you pay $14 per month for that service? – Jeremie Apr 19 '18 at 22:30
  • What do you mean, "it works fine"? Your update 3 didn't use the solutions I suggested, and from what I can see you've got a broken filesystem. – roaima Apr 19 '18 at 22:51
  • I applied vgchange -ay /dev/VG --activationmode partial and mount -o ro,noload /dev/VG/LV /HFT, and I worked fine! – Jeremie Apr 19 '18 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.