Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Partition table corruption

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Senlis
Posts: 29
Joined: 2016-07-04 15:22

Partition table corruption

#1 Post by Senlis »

I was attempting to resize LVs so I could make my home partition smaller and then my root partition bigger. I apparently did it incorrectly and can not longer mount my home partition. I was using this guide http://www.tecmint.com/extend-and-reduce-lvms-in-linux/

Now, when I run: e2fsck /dev/senlis-G75VW-vg/home
e2fsck 1.42.13 (17-May-2015)
The filesystem size (according to the superblock) is 112721920 blocks
The physical size of the device is 111688704 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>?

Continuing does not fix the filesystem.

Any help would be greatly appreciated. I made sure I didn't have anything I could afford to lose in /home, but being unable to recover would result in many hours re-installing Debian and all my programs/configurations. Thank you,

lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home senlis-G75VW-vg -wi-a----- 426.06g
root senlis-G75VW-vg -wi-a----- 29.31g
swap_1 senlis-G75VW-vg -wi-a----- 9.65g

pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 senlis-G75VW-vg lvm2 a-- 465.02g 0

Disk /dev/mapper/senlis--G75VW--vg-root: 29.3 GiB, 31474057216 bytes, 61472768 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


Disk /dev/mapper/senlis--G75VW--vg-swap_1: 9.7 GiB, 10359930880 bytes, 20234240 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


Disk /dev/mapper/senlis--G75VW--vg-home: 426.1 GiB, 457476931584 bytes, 893509632 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

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Partition table corruption

#2 Post by bw123 »

Don't tell me there's no backup? aw man. I've been there,

I don't use LVM, if you want help you should probably post a lot more info, don't do much if you want to save it until you hear a few opinions. Don't run any of the commands I ask about.

What happened when you mounted it read only?
What happened when you ran resize2fs on it?
Did you reboot or run partprobe after changing the partition?
Did you back it up first?
If it's not backed up, what would happen if you used dd on it and backed it up now?
resigned by AI ChatGPT

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#3 Post by Senlis »

I haven't tried mounting it read only. I have to admit I don't know how to do that, but I will find out.

Running resize2fs just tells me to run e2fsck

I am running dd right now and I will see what happens.

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#4 Post by Senlis »

DD copying a 420 GB partition from an internal SSD to an external SSD over USB 2. I wonder how long that will take.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Partition table corruption

#5 Post by GarryRicketson »

How long will it take to copy a 420 GB partition using the dd command ?

That depends on how you wrote the command, what size of "blocks" you use,
and also many other things, on your hardware,..cpu , etc.
On mine, using the default "512" bytes, it takes about 4 hours, to transfer a 500gb
HD, to a portable usb HD, of the same size.

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#6 Post by Senlis »

GarryRicketson wrote:How long will it take to copy a 420 GB partition using the dd command ?

That depends on how you wrote the command, what size of "blocks" you use,
and also many other things, on your hardware,..cpu , etc.
On mine, using the default "512" bytes, it takes about 4 hours, to transfer a 500gb
HD, to a portable usb HD, of the same size.
Good to know. This matches some data I had from a previous copy where it said it transferred at 111 MB/s, which would put the copy somewhere between 4 and 5 hours.

I performed a dd copy from the 'home' LV to an Ext4 partition on an external SDD. Is that the right way to attempt this?

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Partition table corruption

#7 Post by GarryRicketson »

Postby bw123 » 2016-08-11 16:28
Don't tell me there's no backup? aw man. I've been there,

I don't use LVM, if you want help you should probably post a lot more info, don't do much if you want to save it until you hear a few opinions. Don't run any of the commands I ask about.
I do not use LVM either, so I can not be much help there.
I hope I do not sound "condescending" or what ever the english word would be,
I don't meant to, but it does not sound like the OP is paying much attention
to any advice,
don't do much if you want to save it until you hear a few opinions.
I performed a dd copy from the 'home' LV to an Ext4 partition on an external SDD. Is that the right way to attempt this?
The 'dd' command is very powerfull, if you were not sure about having the command
written correctly, you definitely should have posted it, using "code boxes", and shown us what you were planning to do, before you tried.
I don't know, and can not say if that was the right way, with out seeing exactly how you
wrote the command, and also some information on what drives, including external ones, and the partitions,..
Example ONLY, :

Code: Select all

$ df 
Filesystem                                             1K-blocks      Used Available Use% Mounted on
rootfs                                                 650169080 257379128 359763244  42% /
udev                                                       10240         0     10240   0% /dev
tmpfs                                                     307592       880    306712   1% /run
/dev/disk/by-uuid/d986a2f8-bc36-4476-a75a-719daf1373a9 650169080 257379128 359763244  42% /
tmpfs                                                       5120         0      5120   0% /run/lock
tmpfs                                                     615180       136    615044   1% /run/shm
This is a example , to see what disks, and devices, also

Code: Select all

garry@debian:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 698.7G  0 disk 
├─sda1   8:1    0   100M  0 part 
├─sda2   8:2    0  34.2G  0 part 
├─sda3   8:3    0  34.4G  0 part 
└─sda4   8:4    0   630G  0 part /
sr0     11:0    1  1024M  0 rom  

At this point, I do not have any external devices attached, but below, I will show
what I have with a device attached:
lsblk

Code: Select all

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 698.7G  0 disk 
├─sda1   8:1    0   100M  0 part 
├─sda2   8:2    0  34.2G  0 part 
├─sda3   8:3    0  34.4G  0 part 
└─sda4   8:4    0   630G  0 part /
sr0     11:0    1  1024M  0 rom  
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0 337.3G  0 part /media/usb0
├─sdb2   8:18   0     1K  0 part 
├─sdb3   8:19   0  50.7G  0 part /media/rootMX
├─sdb4   8:20   0  34.2G  0 part /media/44d5a5e7-87ac-45dc-bb3a-7ea83d67c4d6
├─sdb5   8:21   0    39G  0 part /media/502a8cb6-bd77-4a3f-a041-3c26306d840f
├─sdb6   8:22   0   4.7G  0 part 
└─sdb7   8:23   0 465.8G  0 part /media/home
Now, this is 2 examples, DO NOT USE THEM,..
they are just examples, of what we would need to see,
to be able to tell you if the command was correct or not.

Code: Select all

dd if=/dev/sda of=/dev/sdb bs=4M; sync
This could copy everything from, /dev/sda to /dev/sdb
I hope that is not what you did, because it will over write
the entire device.
=====================
Notes: if=FILE
read from FILE instead

of=FILE
write to FILE instead of stdout
=================
another example:

Code: Select all

dd if=/dev/sda3 of=/dev/sdc4 bs=4M; sync
This writes from sda3, to sdc4 ,,....
In any event, nobody can guess if the command you wrote, is correct, or not , without
seeing exactly what you said in the command. The above are examples, to show
what information would be needed.
Yes the dd command can be used to copy from a /home partition, or directory,
to a ext4 partition, and safely,.. but who knows how you worded the command ?
We can not guess, if you worded it correctly or not.

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#8 Post by Senlis »

I decided to start with the dd command because, from what I understand of it, it can fail without altering the original data. In other words, I didn't have anything to lose but time. The command I ran was

dd if=/dev/senlis-G75VW-vg/home of=/dev/sdd2

where /dev/sdd2 is an ext4 partition I want to overwrite with the contents of the home partition.

I'm still waiting for the copy to finish. For my own education, why don't you use LVM? I didn't think there was any disadvantages to it, but I really don't know much about it.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Partition table corruption

#9 Post by GarryRicketson »

That looks like it should be ok.
by Senlis » For my own education, why don't you use LVM? I didn't think there was any disadvantages to it, but I really don't know much about it.
I don't know that much about partitioning, and even less (nothing) about LVM,
Downsides of LVM

Of course, all of this comes at a price: the initial set-up of LVM is more complex than just partitioning a disk, and you will definitely need to understand the LVM terminology and model (Logical Volumes, Physical Volumes, Volume Groups) before you can start using it. (Once it is set up, using it is much easier, though.)

Also if you use LVM across hard drives you may loose all your data when only one drive fails.

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#10 Post by Senlis »

Good news is that dd copy worked, I now have access to all the files that were on my home partition on an external drive.

Later today, when I have time, I will delete my old corrupted /home LV, re-create it with the same name, and then dd copy all the data to the new /home LV. I'm predicting the computer should continue as it did before. I will post updates here if it works or not.

Please leave me any feedback you have on my plan. Thank you,

User avatar
kiyop
Posts: 3983
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan
Been thanked: 3 times

Re: Partition table corruption

#11 Post by kiyop »

Check if there is any bad block with "fsck -c-c".

Code: Select all

man fsck
ddrescue is also good tool.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#12 Post by Senlis »

I tried to dd copy to a new /home LV, but it wouldn't mount. I went back to my backup, and all the sudden the filesystem can't mount it. I am running another fsck on the backup, and if I can access the files again I will 'cp' all the files to another partition.

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#13 Post by Senlis »

So I went ahead and created a new fresh home directory on my laptop. Right now it is running, just without any of the previous files.

On my external SDD, when I run fsck now, I get:
fsck -C -c /dev/sdd
fsck from util-linux 2.25.2
e2fsck 1.42.12 (29-Aug-2014)
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
fsck.ext4: Group descriptors look bad... trying backup blocks...
fsck.ext4: The ext2 superblock is corrupt while using the backup blocksfsck.ext4: going back to original superblock
One or more block group descriptor checksums are invalid. Fix<y>? yes
Group descriptor 0 checksum is 0x0000, should be 0x4f6f. FIXED.
[a whole lot more of those with incrementing group descriptors]
fsck.ext4: e2fsck_read_bitmaps: illegal bitmap block(s) for /dev/sdd

/dev/sdd: ***** FILE SYSTEM WAS MODIFIED *****

/dev/sdd: ********** WARNING: Filesystem still has errors **********

When I try to mount, I get the error:
Error mounting /dev/sdd at /media/richard/b1a6bc67-6f31-412a-bd52-2266623c6cdc: Command-line `mount -t "ext4" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdd" "/media/richard/b1a6bc67-6f31-412a-bd52-2266623c6cdc"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdd,
missing codepage or helper program, or other error


In some cases useful info is found in syslog - try
dmesg | tail or so.
(udisks-error-quark, 0)

Any suggestions would be greatly appreciated. I can't think of anything else, and am starting to consider just moving on without my old files. One thing is for sure, I will definitely back up my files next time.

User avatar
kiyop
Posts: 3983
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan
Been thanked: 3 times

Re: Partition table corruption

#14 Post by kiyop »

Maybe due to bad blocks ... ?
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/

Senlis
Posts: 29
Joined: 2016-07-04 15:22

Re: Partition table corruption

#15 Post by Senlis »

kiyop wrote:Maybe due to bad blocks ... ?
Maybe. My understanding is that fsck would have fixed bad blocks if it could. I tried running TestDisk on what was left of my /home backup, but it was unable to recover the partition or recover my files. At this point, I am going to call the files lost and move on. It would have been really nice to have the files back, but they aren't anything that I can't live without.

I'm sure I am going to run into the same problem on my desktop computer where the root partition runs out of space because Debian allocates to little space for the partition by default. I will be sure then to backup my home partition to at least two places before attempting to shrink it.

Thank you for the help, even though it didn't work out.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5347
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 13 times
Been thanked: 66 times

Re: Partition table corruption

#16 Post by dilberts_left_nut »

The filesystem size (according to the superblock) is 112721920 blocks
The physical size of the device is 111688704 blocks
Looks like you miscalculated - your filesystem is larger than the device it is on ....
AdrianTM wrote:There's no hacker in my grandma...

User avatar
kiyop
Posts: 3983
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan
Been thanked: 3 times

Re: Partition table corruption

#17 Post by kiyop »

dilberts_left_nut wrote:
The filesystem size (according to the superblock) is 112721920 blocks
The physical size of the device is 111688704 blocks
Looks like you miscalculated - your filesystem is larger than the device it is on ....
Great!
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/

Horizon_Brave
Posts: 8
Joined: 2016-03-28 22:48

Re: Partition table corruption

#18 Post by Horizon_Brave »

So, my question is how was this able to work in the first place? If the OP slapped a FS on the underlying drive that was smaller than the logical volume partition, how should it have even worked to begin with? Shouldn't it have given an error upon him even trying to write the filesystem onto the miscalculated space?

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Partition table corruption

#19 Post by GarryRicketson »

Shouldn't it have given an error upon him even trying to write the filesystem onto the miscalculated space?
Senlis wrote:DD copying a 420 GB partition from an internal SSD to an external SSD over USB 2. I wonder how long that will take.
The dd command does not work that way, no it does not give any warning, it will try to do what ever the command is written to do,..
That includes also, it will not tell the user it is the wrong drive or device, nor question
it , it will try.
see :

Code: Select all

man dd 
I don't think they mention it, I suppose they assume most people are "logical" enough
to go figure, and check to make sure the target is the same size or bigger, then the source .

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Partition table corruption

#20 Post by bw123 »

dd wasn't the culprit, error was made in lvm manipulation from link in first post?

http://www.tecmint.com/extend-and-reduce-lvms-in-linux/
Reducing Logical Volume (LVM)

Here we are going to see how to reduce the Logical Volumes. Everyone say its critical and may end up with disaster while we reduce the lvm.

Before starting, it is always good to backup the data, so that it will not be a headache if something goes wrong.
resigned by AI ChatGPT

Post Reply