码迷,mamicode.com
首页 > 系统相关 > 详细

linux_ext4恢复超级块.txt

时间:2019-07-09 12:13:25      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:rac   Fix   miss   missing   desc   error   file   wrong   tmpfs   

恢复ext4文件系统superblock 2014-04-01 17:00:17
分类: Linux


恢复ext4文件系统superblock
1. Create ext4 文件系统。
[root@localhost ~]# mkfs.ext4 /dev/vdb1
[root@localhost ~]# partprobe /dev/vdb

2. 挂载文件系统
[root@localhost ~]# grep vdb2 /etc/fstab
/dev/vdb1 /ext4 ext4 defaults 0 0

[root@localhost ~]# mount -a

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vdb1 100G 1.7G 94G 2% /ext4

3. 卸载文件系统,并破坏super block
[root@localhost ~]# umount /ext4
[root@localhost ~]#
[root@localhost ~]# dd if=/dev/zero of=/dev/vdb1 bs=1024 count=5
5+0 records in
5+0 records out
5120 bytes (5.1 kB) copied, 0.00481915 s, 1.1 MB/s

[root@localhost ~]# partx /dev/vdb
partx: /dev/vdb: failed to read partition table
[root@localhost ~]#
[root@localhost ~]# mount /ext4
mount: wrong fs type, bad option, bad superblock on /dev/vdb1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

[root@localhost ~]# dmesg
[22600278.492089] EXT4-fs (vdb1): VFS: Can‘t find ext4 filesystem

4. 恢复superblock
[root@localhost ~]# fsck -t ext4 /dev/vdb1
fsck from util-linux 2.20.1
e2fsck 1.41.14 (22-Dec-2010)
fsck.ext4: Superblock invalid, trying backup blocks...
One or more block group descriptor checksums are invalid. Fix? yes

Group descriptor 0 checksum is invalid. FIXED.
Group descriptor 1 checksum is invalid. FIXED.
Group descriptor 2 checksum is invalid. FIXED.
...
Fix? yes


/dev/vdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/vdb1: 11/6553600 files (0.0% non-contiguous), 459349/26214144 blocks

5. 测试是否恢复了。
[root@localhost ~]# mount -a
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vdb1 100G 1.7G 94G 2% /ext4

 

---------------------------------------------------------------------------
247 上准确的一次扩容:
从其中一个LV 取容量 到 其他LV 上


[root@zjgl ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_zjgl-lv_root
50G 47G 0 100% /
tmpfs 7.9G 172K 7.9G 1% /dev/shm
/dev/sda1 485M 11M 449M 3% /boot
/dev/mapper/vg_zjgl-lv_home
483G 198M 458G 1% /home

  

ifconfig -a
603 df -lh
604 cd /
605 umount /home
606 df -lh
607 resize2fs -p /dev/mapper/vg_zjgl-lv_home 200G
608 e2fsck -f /dev/mapper/vg_zjgl-lv_home
609 resize2fs -p /dev/mapper/vg_zjgl-lv_home 200G

[root@orcl /]# e2fsck -f /dev/mapper/vg_xnzhoracle-lv_home
resize2fs -p /dev/mapper/vg_xnzhoracle-lv_home 300G

lvreduce -L 300G /dev/mapper/vg_xnzhoracle-lv_home
lvextend -L +140G /dev/mapper/vg_xnzhoracle-lv_root
resize2fs -p /dev/mapper/vg_xnzhoracle-lv_root


610 mount /home
611 df -h
612 lvreduce -L 200G /dev/mapper/vg_zjgl-lv_home
613 vgdisplay
614 lvextend -L +100G /dev/mapper/vg_zjgl-lv_root
615 resize2fs -p /dev/mapper/vg_zjgl-lv_root
616 df -h
617 cd /home
618 ls
619 cd /
620 ls
621 ls -l

[root@zjgl /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_zjgl-lv_root
148G 47G 94G 34% /
tmpfs 7.9G 172K 7.9G 1% /dev/shm
/dev/sda1 485M 11M 449M 3% /boot
/dev/mapper/vg_zjgl-lv_home
197G 188M 187G 1% /home

---------------------------------------------------------------------------


more /etc/fstab

创建LV:

 


635 vgdisplay
636 vgscan
637 lvscan
638 df -lh
639 lvcreate -L 100G -n lv_arch /dev/vg_zjgl
640 mkfs -t ext3 /dev/vg_zjgl/lv_arch
641 mount /dev/vg_zjgl/lv_arch /arch
642 df -lh
643 vgdisplay
644 lvdisplay
645 df -lh
646 cd /home
647 sl
648 ls
649 la -al
650 cd /
651 umount /home

/opt/oracle/oradata/orcl/archive1


--------------------------------------------------------------------------

 

 


[root@orcl /]# e2fsck -f /dev/mapper/vg_xnzhoracle-lv_home
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_xnzhoracle-lv_home: 721271/32735232 files (0.1% non-contiguous), 5611311/130922496 blocks
[root@orcl /]# resize2fs -p /dev/mapper/vg_xnzhoracle-lv_home 300G
resize2fs 1.41.12 (17-May-2010)df
Resizing the filesystem on /dev/mapper/vg_xnzhoracle-lv_home to 78643200 (4k) blocks.
Begin pass 3 (max = 3996)
Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/mapper/vg_xnzhoracle-lv_home is now 78643200 blocks long.

[root@orcl /]# mount /home
[root@orcl /]# df -lh

 

 

 

 

477 fuser -m -k /home
478 umount /home
479 fsck -f /dev/vg_zjgl/lv_home
480 mount /dev/vg_zjgl/lv_home /home
481 df -lh
482 lvresize -L +340G /dev/vg_zjgl/lv_home
483 mkfs.ext4 /dev/vg_zjgl/lv_home
484 mount
485 umount /home
486 mount
487 lvresize -L +340G /dev/vg_zjgl/lv_home
488 mkfs.ext4 /dev/vg_zjgl/lv_home
489 mount /dev/vg_zjgl/lv_home /home
490 df -lh
491 history 50

 

478 ls
479 vgscan
480 vgdisplay
481 cd /vg_zj
482 cd vg_zjgl/
483 ls
484 pwd
485 fsck -f /dev/vg_zjgl/lv_home
486 mount
487 mount /dev/vg_zjgl/lv_home /home
488 vgscan
489 lvscan
490 more /etc/fstab
491*
492 ls -lh /etc/fstab
493 vi /etc/fstab
494 fsck -t ext4 /dev/mapper/vg_zjgl-lv_home
495 me
496 lvresize -L -450G /dev/vg_zjgl/lv_home
497 lvresize -L -400G /dev/vg_zjgl/lv_home
498 lvresize -L -40G /dev/vg_zjgl/lv_home
499 fsck -t ext4 /dev/mapper/vg_zjgl-lv_home
500 df -lh
501 mount /dev/vg_zjgl/lv_home /home
502 mkfs.ext4 -n device
503 mkfs.ext4 -b superblocknum device
504 lvscan
505 mkfs.ext4 -b superblocknum device
506 cd /
507 mkfs.ext4 -b superblocknum device
508 mkfs.ext4 -n device
509 cd
510 cd /dev
511 ls
512 mkfs.ext4 /dev/vg_zjgl/lv_home
513 mount /dev/vg_zjgl/lv_home /home
514 df -lh
515 cd /home
516 ls
517 lvresize -L +450G /dev/vg_zjgl/lv_home
518 lvresize -L +350G /dev/vg_zjgl/lv_home
519 lvresize -L +340G /dev/vg_zjgl/lv_home
520 lvscan
521 df -h
522 df -lh
523 mkfs.ext4 /dev/vg_zjgl/lv_home
524 history 50

 

linux_ext4恢复超级块.txt

标签:rac   Fix   miss   missing   desc   error   file   wrong   tmpfs   

原文地址:https://www.cnblogs.com/bayaim/p/11156399.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!