fdupoux / fsarchiver

file system archiver for linux
http://www.fsarchiver.org
GNU General Public License v2.0
263 stars 42 forks source link

Error on mke2fs when trying to restore a backup #100

Closed komodin closed 3 years ago

komodin commented 3 years ago

Hi, I'm using fsarchiver over systemrescuecd-7.0.0 and when I try to restore the backup (also made with systemrescuecd-7.0.0 but on another machine), it gives me an error at the moment of format the partition:

# fsarchiver restfs backup-2.fsa id=0,dest=/dev/nvme0n1p2 -j4 -v
============= extracting filesystem 0 =============
executing [mke2fs -V]...
command [mke2fs -V] returned 0
executing [mke2fs -V]...
command [mke2fs -V] returned 0
executing [mke2fs /dev/nvme0n1p2  -q  -F    -b 4096  -U 9423c6d9-f44b-434e-a1cf-7d976c590d88  -I 256  -r 1  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,^64bit,^inline_data,^ea_inode,^large_dir,large_file,huge_file,sparse_super,uninit_bg,dir_nlink,extra_isize,^bigalloc,^metadata_csum,^project ]...
command [mke2fs /dev/nvme0n1p2  -q  -F    -b 4096  -U 9423c6d9-f44b-434e-a1cf-7d976c590d88  -I 256  -r 1  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,^64bit,^inline_data,^ea_inode,^large_dir,large_file,huge_file,sparse_super,uninit_bg,dir_nlink,extra_isize,^bigalloc,^metadata_csum,^project ] returned 1
fs_ext2.c#373,extfs_mkfs(): command [mke2fs /dev/nvme0n1p2  -q  -F    -b 4096  -U 9423c6d9-f44b-434e-a1cf-7d976c590d88  -I 256  -r 1  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,^64bit,^inline_data,^ea_inode,^large_dir,large_file,huge_file,sparse_super,uninit_bg,dir_nlink,extra_isize,^bigalloc,^metadata_csum,^project ] failed with return status=1
oper_restore.c#1296,extractar_filesystem_extract(): cannot make filesystem ext4 on partition /dev/nvme0n1p2

Detailed output of mke2fs:

# mke2fs -vvvv /dev/nvme0n1p2   -F    -b 4096  -U 9423c6d9-f44b-434e-a1cf-7d976c590d88  -I 256  -r 1  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,^64bit,^inline_data,^ea_inode,^large_dir,large_file,huge_file,sparse_super,uninit_bg,dir_nlink,extra_isize,^bigalloc,^metadata_csum,^project
mke2fs 1.45.6 (20-Mar-2020)
fs_types for mke2fs.conf resolution: 'ext2'
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1648320 inodes, 6591744 blocks
329587 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
202 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Filesystem UUID: 9423c6d9-f44b-434e-a1cf-7d976c590d88
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000

Allocating group tables: done
Writing inode tables: done
ext2fs_update_bb_inode: Cannot iterate data blocks of an inode containing inline data while setting bad block inode

But if I do an mkfs.ext4, it works correctly:

# mkfs.ext4 -vvvv /dev/nvme0n1p2
mke2fs 1.45.6 (20-Mar-2020)
fs_types for mke2fs.conf resolution: 'ext4'
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1648320 inodes, 6591744 blocks
329587 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2155872256
202 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Filesystem UUID: ea85265c-f912-4acd-b89b-5af57eff4c1e
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Anyone can tell me if I am doing anything wrong or if I can try something?

Thanks

komodin commented 3 years ago

I've found that if I enable the metadata_csum it formats correctly the partition:

[root@sysrescue ~]# mke2fs -vvvv /dev/nvme0n1p2   -F    -b 4096  -U 9423c6d9-f44b-434e-a1cf-7d976c590d88  -I 128  -r 1  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,64bit,^inline_data,^ea_inode,^large_dir,large_file,huge_file,sparse_super,uninit_bg,dir_nlink,extra_isize,^bigalloc,metadata_csum,^project
mke2fs 1.45.6 (20-Mar-2020)
fs_types for mke2fs.conf resolution: 'ext2'
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1648320 inodes, 6591744 blocks
329587 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2155872256
202 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Filesystem UUID: 9423c6d9-f44b-434e-a1cf-7d976c590d88
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

But what calls my attention is that if I run the command that I've pointed out on the previous comment on a Gentoo Linux running on the same computer, it works correctly:

# mke2fs -vvvv /dev/nvme0n1p2   -F    -b 4096  -U 9423c6d9-f44b-434e-a1cf-7d976c590d88  -I 128  -r 1  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,^64bit,^inline_data,^ea_inode,^large_dir,large_file,huge_file,sparse_super,uninit_bg,dir_nlink,extra_isize,^bigalloc,^metadata_csum,^project
mke2fs 1.45.6 (20-Mar-2020)
/dev/nvme0n1p2 contains a ext4 file system
    created on Sat Jan 16 18:07:48 2021
fs_types for mke2fs.conf resolution: 'ext2'
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1648320 inodes, 6591744 blocks
329587 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
202 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Filesystem UUID: 9423c6d9-f44b-434e-a1cf-7d976c590d88
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
    4096000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

I'm about to lose my head with this issue haha.

I can't figure out if it's an issue with the Kernel of the systemrescuecd or something like that: the version of fsarchiver and e2fsprogs are the same.

marcosfrm commented 3 years ago

Try -E lazy_itable_init=0,lazy_journal_init=0.