2

How I can backup(and restore) partition layout of the Disk along with file system types,UUIDs,labels,LVM partitions(Linux LVM) etc, plus with MBRs and VBRs etc but without actual files

I want to later restore it somewhere else and have identical filesystems and partitions and then restore files manually by my self

I need that layout backup to be small so I can't just make empty version of that partition and file systems and make raw image ...

Is there any way to do that?

HopelessN00b
  • 54,273

2 Answers2

4

Looking at partimage is probably the best result; however, if you want to take it further; you probably need to construct something yourself. I don't know of any any tools that will exactly backup & restore EVERYTHING you want.

Partition table/block devices

Dumping MBR partition table:

sfdisk -d /dev/sd$X > $FILE

Restore MBR partition table:

sfdisk /dev/sd$X < $FILE

Dumping GPT:

sgdisk -b $FILE /dev/sd$X

Restore GPT:

sgdisk -l $FILE /dev/sd$X

Show your block devices as a tree

lsblk

Logical block devices

LVM (can recreate PV, VG, LVM structure):

vgcfgbackup ...

vgcfgrestore ...

Filesystems

Showing UUIDS & Labels:

blkid

Show xfs parameters

xfs_info /dev/sd$X$N

Show ext[234] parameters (look at the features line):

dumpe2fs -h /dev/sda1

Backup & Restore XFS metadata:

xfs_metadump -o /dev/sd$X$N FILE

xfs_mdrestore FILE /dev/sd$X$N

robbat2
  • 360
0

I can only think of the dd command. The only problem would be changing the UUID (if used) on the /etc/fstab, which you can do on recovery mode if needed; or change it to a label/device before doing the backup.

Isaac
  • 159