LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-10-2016, 11:04 AM   #91
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled

Thank you very much. In that case I have a 10TB disk. Can I use this to take the recover the files than write to the sda? Is it possible? How can I do this?
Code:
[root@bioworkstation /]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0  14.6T  0 disk 
├─sda1            8:1    0   500M  0 part 
└─sda2            8:2    0  14.6T  0 part 
sdb               8:16   0 111.8G  0 disk 
├─sdb1            8:17   0   500M  0 part /boot
└─sdb2            8:18   0 111.3G  0 part 
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0     4G  0 lvm  [SWAP]
  └─centos-home 253:2    0  57.2G  0 lvm  /home
sdc               8:32   0  10.9T  0 disk 
├─sdc1            8:33   0   500M  0 part /run/media/zillur/3d20300c-4bda-4c44-8543-3a6a93451377
└─sdc2            8:34   0  10.9T  0 part 
sr0              11:0    1  1024M  0 rom
sdc is the new disk.
Best Regards
Zillur
 
Old 08-10-2016, 11:20 AM   #92
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
You can mount sdc2 and save files to it

Last edited by michaelk; 08-10-2016 at 11:22 AM.
 
1 members found this post helpful.
Old 08-10-2016, 11:25 AM   #93
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much. I can mount sdc1 anywhere I want. But in sdc1 I have only few MB (494MB) and in sdc2 I have 10 TB. I can't mount sdc2. In that case only mounting sdc1 will solve the problem?
Code:
[root@bioworkstation /]# mount /dev/sdc2 /mordor/
mount: unknown filesystem type 'LVM2_member'
Thank you very much.

Best Regards
Zillur
 
Old 08-10-2016, 11:33 AM   #94
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
If I mount sdc1 in a directory than it gives me only 494MB which is not enough for me.

Thank you.
 
Old 08-10-2016, 12:59 PM   #95
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
Post the output of vgs command
 
1 members found this post helpful.
Old 08-10-2016, 01:02 PM   #96
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much.
Code:
[root@bioworkstation zillur]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree 
  centos   1   3   0 wz--n- 111.30g 60.00m
  centos   1   3   0 wz--n-  10.92t 60.00m
 
Old 08-10-2016, 02:14 PM   #97
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
And the output of lvdisplay
 
Old 08-10-2016, 02:17 PM   #98
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Now the reason you cannot use sda to save files is that you don't know WHERE the files are, thus nothing will know where it can write that will not damage the data on sda.

The only thing you can do is recover a few files and write them on a mounted filesystem - then copy them to a backup storage; delete the files... and then recover some more.

It is a SLOW process - but it is also the ONLY one that is reasonably assured to work reliably.

There are some UNRELIABLE methods and if they don't work the data on the disk is damaged even more. for instance, if sda did NOT have a LVM format, then it MIGHT be possible to recover a filesystem using fsck.

NOTE: THIS IS NOT RELIABLE. And if it doesn't work the data on disk can be damaged even more (see the manpage on fsck.ext4). I DO NOT RECOMMEND THIS as it is really reserved for use by people used to doing such activity. (Fortunately? it doesn't happen that often so people tend to forget that it is even remotely possible). Doing so requires a lot of prior information about the disk - how it was used, formatted, what happened to the disk, how to read the errors.

Another little used method is via debugfs (for ext2/3/4 filesystems), which can be used to examine the disk... and update things. Sometimes even to fix things. I DEFINITELY DO NOT RECOMMEND THIS. It requires knowledge of how the ext filesystems work - and that is NOT generally known. It also requires all the other prior knowledge about the filesystem.
 
Old 08-10-2016, 05:12 PM   #99
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much. Here is it:
Code:
[root@bioworkstation recup_dir.1]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                5onkyt-tsZg-PhaL-Omal-6so1-SUhZ-reVIQD
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-08-07 17:12:16 -0400
  LV Status              available
  # open                 4
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                s5n2yy-tehD-XFMb-yDBD-hPNk-LIzc-JiX31P
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-08-07 17:12:16 -0400
  LV Status              available
  # open                 3
  LV Size                57.24 GiB
  Current LE             14653
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                gVxeQQ-GMt4-P2b2-t3Kt-N5JQ-DONY-ej3S3i
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-08-07 17:12:39 -0400
  LV Status              available
  # open                 3
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                EMTcko-rQjY-y1gM-cXLj-9HoI-FKuV-zRAvmf
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-08-03 19:50:35 -0400
  LV Status              NOT available
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                heg9yd-s0DY-DzV7-hsh5-601z-nH8B-DAkluO
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-08-03 19:50:35 -0400
  LV Status              NOT available
  LV Size                10.86 TiB
  Current LE             2847618
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                vafBhA-bRUy-0Veu-5yZx-z0qr-2d3l-nYqt8o
  LV Write Access        read/write
  LV Creation host, time localhost, 2016-08-03 19:51:25 -0400
  LV Status              NOT available
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
Code:
[root@bioworkstation zillur]# vgdisplay 
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               111.30 GiB
  PE Size               4.00 MiB
  Total PE              28492
  Alloc PE / Size       28477 / 111.24 GiB
  Free  PE / Size       15 / 60.00 MiB
  VG UUID               ybqHGe-BUO3-NmWv-DMAw-gqDM-mX1j-vG6vrK
   
  --- Volume group ---
  VG Name               centos
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               10.92 TiB
  PE Size               4.00 MiB
  Total PE              2861457
  Alloc PE / Size       2861442 / 10.92 TiB
  Free  PE / Size       15 / 60.00 MiB
  VG UUID               Uroagx-QmOS-wM9V-BlZ4-8iMf-M2hg-BEpgtz
Code:
[root@bioworkstation zillur]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0  14.6T  0 disk 
├─sda1            8:1    0   500M  0 part 
└─sda2            8:2    0  14.6T  0 part 
sdb               8:16   0 111.8G  0 disk 
├─sdb1            8:17   0   500M  0 part /boot
└─sdb2            8:18   0 111.3G  0 part 
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0     4G  0 lvm  [SWAP]
  └─centos-home 253:2    0  57.2G  0 lvm  /home
sdc               8:32   0  10.9T  0 disk 
├─sdc1            8:33   0   500M  0 part /mordor
└─sdc2            8:34   0  10.9T  0 part 
sr0              11:0    1  1024M  0 rom
I appreciate your kind help and suggestions.

Best Regards
Zillur
 
Old 08-10-2016, 05:39 PM   #100
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
It appears that you have two separate volume groups that are both named "centos". That is a recipie for disaster. You will need to rename the volume group on that "new" disk to something else.
Code:
vgrename Uroagx-QmOS-wM9V-BlZ4-8iMf-M2hg-BEpgtz something_else
You can of course choose a name more to your liking than "something_else". Note that the command uses the VG UUID to identify the drive uniquely.
 
1 members found this post helpful.
Old 08-11-2016, 10:13 AM   #101
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much. I have recovered almost more than 10TB data.
Code:
[root@bioworkstation zillur]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   50G  6.9G   44G  14% /
devtmpfs                  87G     0   87G   0% /dev
tmpfs                     87G  2.8M   87G   1% /dev/shm
tmpfs                     87G   98M   87G   1% /run
tmpfs                     87G     0   87G   0% /sys/fs/cgroup
/dev/mapper/centos-home   58G  196M   58G   1% /home
/dev/sdb1                497M  215M  283M  44% /boot
tmpfs                     18G   24K   18G   1% /run/user/1000
/dev/sdc1                494M   26M  469M   6% /run/media/zillur/3d20300c-4bda-4c44-8543-3a6a93451377
/dev/mapper/pagla-home    11T   11T   60K 100% /mordor
tmpfs                     18G   16K   18G   1% /run/user/42
But I have another difficult problem. The system renamed everything (files and folders). Is there any way to recover them by their own name?
Code:
oot@bioworkstation old_data]# ls
recup_dir.1    recup_dir.116  recup_dir.133  recup_dir.150  recup_dir.168  recup_dir.185  recup_dir.201  recup_dir.219  recup_dir.38  recup_dir.55  recup_dir.72  recup_dir.9
recup_dir.10   recup_dir.117  recup_dir.134  recup_dir.151  recup_dir.169  recup_dir.186  recup_dir.202  recup_dir.22   recup_dir.39  recup_dir.56  recup_dir.73  recup_dir.90
recup_dir.100  recup_dir.118  recup_dir.135  recup_dir.152  recup_dir.17   recup_dir.187  recup_dir.203  recup_dir.220  recup_dir.4   recup_dir.57  recup_dir.74  recup_dir.91
recup_dir.101  recup_dir.119  recup_dir.136  recup_dir.153  recup_dir.170  recup_dir.188  recup_dir.204  recup_dir.23   recup_dir.40  recup_dir.58  recup_dir.75  recup_dir.92
recup_dir.102  recup_dir.12   recup_dir.137  recup_dir.154  recup_dir.171  recup_dir.189  recup_dir.205  recup_dir.24   recup_dir.41  recup_dir.59  recup_dir.76  recup_dir.93
recup_dir.103  recup_dir.120  r
Code:
f1503616.elf    f2269591808.txt   f2472700672.gz   f2861771008.gz    f3780578176.gz  f4203904.txt    f4293949952.txt   f4293984128.h                      f8177280.ttf
f1506304.elf    f2269670016.txt   f2474205696.gz   f2864458368.gz    f3780767744.gz  f4203989120.gz  f4293950080.txt   f4293984256.txt                    f8177408.ttf
f1527424.txt    f2270175488.txt   f2478697984.gz   f2910689792.gz    f3780846080.gz  f4204456576.gz  f4293950208.java  f4294028032.txt                    f8177920.h
f1540096.txt    f2271040384.txt   f2480256.txt     f3068370688.gz    f3781306624.gz  f4208385536.gz  f4293950336.txt   f4294030080.c                      f8178176.gz
f1552768.txt    f2271041920.txt   f2484096.txt     f33610240.tar.gz  f3781530496.gz  f4215228800.gz  f4293950464.txt   f4294030208.c                      f8390656.xfs
f16200192.txt   f2271258752.txt   f2484224.txt     f3581534208.gz    f3782252544.gz  f4220344576.gz  f4293950720.txt   f4294030336.java
f16244864.txt   f2271292800.txt   f2484352.txt     f3584377472.gz    f3782750208.gz  f4220638592.gz  f4293950848.c     f4294030464.c
f16259072.txt   f2271303936.txt   f2485376.txt     f3587231360.gz    f3783097984.gz  f4222639616.gz  f4293951872.txt   f4294030592.h
f1629952.txt    f2271433984.txt   f2486016.txt     f3590704512.gz    f3787252608.gz  f4236573568.gz  f4293952256.c     f4294030720.c
[root@bioworkstation recup_dir.2]#
Thanks a lot for helping me all the way.

Best Regards
Zillur
 
Old 08-11-2016, 10:59 AM   #102
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
Not that I know. Filenames are stored in the file system metadata which was deleted. Photorec searches the disk and find files based on their signatures. I did say it was going to be difficult.
 
Old 08-11-2016, 11:27 AM   #103
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Let's try this. Assuming (Yes I know -- ass, u, me!) that the PV on sda3 contained exactly one LV, which, in turn, held your filesystem, you can try creating a read-only loop device at the offset where that filesystem would have started, and then see if you can mount that loop device:
Code:
losetup --offset 1048576 -f --show /dev/sda3
### (Ignore the warning about a file smaller than 512 bytes.)
file -s /dev/loop0 /mnt/tmp
fsck -n /dev/loop0
mount -r /dev/loop0 /mnt/tmp
The device name reported by that first command might not be "/dev/loop0". Adjust the name in the subsequent commands as required. If something looks wrong at any stage ("file" doesn't report a filesystem, "fsck" shows something horribly wrong, etc.), don't continue. The "fsck -n" is just a sanity check before attempting to mount. The "-n" will keep it from trying to "fix" anything, since that could well be disasterous for your data. If you don't already have a "/mnt/tmp" mount point directory, you will have to create it first. If you're lucky, all your data will be there.

The easier way to access the PV would be to run "pvextend --restoremissing centos /dev/sda3", but something doesn't seem quite right here, so I don't trust that command to preserve the existing content.
 
1 members found this post helpful.
Old 08-11-2016, 11:45 AM   #104
zillur
Member
 
Registered: Apr 2015
Posts: 217

Original Poster
Rep: Reputation: Disabled
Thank you very much. Here is the output:
Code:
[root@bioworkstation /]# file -s /dev/loop0 /mnt
/dev/loop0: data
/mnt:       directory
[root@bioworkstation /]# fsck -n /dev/loop0
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/loop0

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
Can I proceed to mount??
Thanks again.

Best Regards
Zillur
 
Old 08-11-2016, 12:37 PM   #105
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by zillur View Post
Thank you very much. Here is the output:
Code:
[root@bioworkstation /]# file -s /dev/loop0 /mnt
/dev/loop0: data
/mnt:       directory
[root@bioworkstation /]# fsck -n /dev/loop0
fsck from util-linux 2.23.2
e2fsck 1.42.9 (28-Dec-2013)
ext2fs_open2: Bad magic number in super-block
...
Can I proceed to mount??
No. It would certainly fail. Just delete the loop device (losetup -d /dev/loop0).

Let's see what is in that PV header. There should be some ASCII text starting in sector 9.
Code:
dd if=/dev/sda3 of=/tmp/stuff.txt skip=9 count=10
Open that file in an editor, delete everything after the first instance of a line that begins "# Generated by", and post the rest.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Failing to boot up due to failing to acces the GRUB spenot09 Linux - Software 7 10-19-2015 10:56 AM
Jessie boot cd failing to boot on a Poweredge R905 Jasambo Debian 5 06-15-2015 04:38 PM
Boot Problem in Grub (Chainloader failing? /boot messed up?) gjemmott Linux - Desktop 2 03-15-2010 10:26 AM
eth1 failing on boot, IEEE firewire card driver failing, help jackuss_169 Linux - Laptop and Netbook 5 03-05-2005 07:34 AM
LILO install failing, Boot failing, but Installation fine. sramelyk Slackware 9 08-23-2003 02:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:42 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