/var/log/messages
파티션 테이블 복제(백업)하기 본문
localhost:~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 20G 0 rom
sr1 11:1 1 15.9G 0 rom
vda 253:0 0 55G 0 disk
├─vda1 253:1 0 8M 0 part
└─vda2 253:2 0 55G 0 part
├─system-swap 254:0 0 3.8G 0 lvm [SWAP]
├─system-root 254:1 0 10G 0 lvm /
└─system-home 254:2 0 25G 0 lvm /home
vdb 253:16 0 4G 0 disk
├─vdb1 253:17 0 954M 0 part
├─vdb2 253:18 0 954M 0 part
├─vdb3 253:19 0 954M 0 part
├─vdb4 253:20 0 1K 0 part
└─vdb5 253:21 0 476M 0 part
vdc 253:32 0 4G 0 disk
vdd 253:48 0 4G 0 disk
vde 253:64 0 4G 0 disk
localhost:~ # sfdisk -d /dev/vdb > vdb.img
localhost:~ # cat vdb.img
label: dos
label-id: 0xc78ac9c7
device: /dev/vdb
unit: sectors
sector-size: 512
/dev/vdb1 : start= 2048, size= 1953792, type=83
/dev/vdb2 : start= 1955840, size= 1953792, type=83
/dev/vdb3 : start= 3909632, size= 1953792, type=83
/dev/vdb4 : start= 5863424, size= 976896, type=5
/dev/vdb5 : start= 5865472, size= 974848, type=83
localhost:~ # mkdir /mnt/temp
localhost:~ # ls -l /mnt/temp
total 0
localhost:~ # mkfs.xfs /dev/sda
meta-data=/dev/sda isize=512 agcount=4, agsize=1310720 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=0 bigtime=0 inobtcount=0
data = bsize=4096 blocks=5242880, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
localhost:~ # mount /dev/sda /mnt/temp
localhost:~ # cp vdb.img /mnt/temp/
localhost:~ # ll /mnt/temp/
total 4
-rw-r--r-- 1 root root 375 Jan 30 12:49 vdb.img
localhost:~ # sfdisk /dev/vdc < /mnt/temp/vdb.img
Checking that no-one is using this disk right now ... OK
Disk /dev/vdc: 4 GiB, 4294967296 bytes, 8388608 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
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0xc78ac9c7.
/dev/vdc1: Created a new partition 1 of type 'Linux' and of size 954 MiB.
/dev/vdc2: Created a new partition 2 of type 'Linux' and of size 954 MiB.
/dev/vdc3: Created a new partition 3 of type 'Linux' and of size 954 MiB.
/dev/vdc4: Created a new partition 4 of type 'Extended' and of size 477 MiB.
/dev/vdc5: Created a new partition 5 of type 'Linux' and of size 476 MiB.
/dev/vdc6: Done.
New situation:
Disklabel type: dos
Disk identifier: 0xc78ac9c7
Device Boot Start End Sectors Size Id Type
/dev/vdc1 2048 1955839 1953792 954M 83 Linux
/dev/vdc2 1955840 3909631 1953792 954M 83 Linux
/dev/vdc3 3909632 5863423 1953792 954M 83 Linux
/dev/vdc4 5863424 6840319 976896 477M 5 Extended
/dev/vdc5 5865472 6840319 974848 476M 83 Linux
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
localhost:~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 20G 0 disk /mnt/temp
sr0 11:0 1 15.9G 0 rom
vda 253:0 0 55G 0 disk
├─vda1 253:1 0 8M 0 part
└─vda2 253:2 0 55G 0 part
├─system-swap 254:0 0 3.8G 0 lvm [SWAP]
├─system-root 254:1 0 10G 0 lvm /
└─system-home 254:2 0 25G 0 lvm /home
vdb 253:16 0 4G 0 disk
├─vdb1 253:17 0 954M 0 part
├─vdb2 253:18 0 954M 0 part
├─vdb3 253:19 0 954M 0 part
├─vdb4 253:20 0 1K 0 part
└─vdb5 253:21 0 476M 0 part
vdc 253:32 0 4G 0 disk
├─vdc1 253:33 0 954M 0 part
├─vdc2 253:34 0 954M 0 part
├─vdc3 253:35 0 954M 0 part
├─vdc4 253:36 0 1K 0 part
└─vdc5 253:37 0 476M 0 part
vdd 253:48 0 4G 0 disk
vde 253:64 0 4G 0 disk
이 과정은 다른 디스크에게 복제를 하는 시나리오입니다.
그러나, 문제가 있는 디스크를 fsck 관련 툴을 실행하기 전에, 해당 정보를 백업 후 적용할 수 있는 방법으로도 이용할 수 있습니다!
'SUSE' 카테고리의 다른 글
error: cluster.join: [Errno 2] No such file or directory: '/etc/corosync/corosync.conf (0) | 2024.03.18 |
---|---|
xfs 파일시스템 '안전하게' 복구하기 (0) | 2024.02.05 |
XFS 에러 (2) | 2024.01.30 |
시스템 종료 쉘 스크립트 (2) | 2024.01.08 |
ethtool 정리 (2) | 2023.12.07 |