All posts tagged mirror

Copied from https://gist.github.com/plepe


md: multiple devices
command description


show status of all raids


detailed status of raid md0


new raid /dev/md0 with 2 disks, raid level 1 on /dev/sda1 and /dev/sda2


remove /dev/sda1 from /dev/md0


add /dev/sda1 to /dev/md0


use 3 disks in raid /dev/md0 (e.g. add an additional disk, so a damaged drive can be removed later-on)


Assemble /dev/md0 (e.g. when running live system)


Update list of arrays in /etc/mdadm/mdadm.conf ; you should remove old list by hand first!


What is this disk / partition?


Set minimum raid rebuilding speed to 10000 kiB/s (default 1000)


Copy partition table from sdX to sdY (MBR only)


Copy partition table from sdX to sdY (GPT)

To boot a machine even with a degraded array, modify /etc/initramfs-tools/conf.d/mdadm and run update-initramfs -c -kall (Use with caution!)


pv: physical device (e.g. /dev/md0 or /dev/sda1)
vg: volume group (consists of 1 or more pvs, contains lvs); has a name (e.g. lvm)
lv: logical volume (has a name which defines its path, e.g. /dev/lvm/root which equals dev/mapper/lvm-root)
command description


initializes /dev/md0 as phys device for a volume group


create volume group lvm with phys device /dev/md0


create logical volume root, sized 30G in volume group lvm; format with ext4


extend /dev/lvm/root to 60G; also resize file system to new size


show short info about pv, vg and lv


show long info

scan disks for physical volumes (e.g. when running live system)


add phys device /dev/md1 to volume group lvm (need pvcreate first!)


move all logical volumes from /dev/md0 and remove phys device from volume group

create bios grub partition


Was in a little jam today and we needed to take backups of a couple of systems. The problem was the local drives didn’t have enough space to take a full disk image. This system was also failing to mount a file system over NFS due to some firewall issues. I had my mind set on taking down the hosts and either using partimage or clonezilla, which I know for sure would have worked. I’m sure you don’t have to use root and could use unpriv’d user with sudo. I’ve used this with tar a bunch of times and was quite amazed when dd worked with it.

$ sudo dd if=/dev/cciss/c0d0 | ssh root@backupserver 'dd of=/some/backup/path/disk.img'

How you can dd a image file directly from within a tar.gz archive.

$ sudo tar xzOf filename.tar.gz | dd of=/dev/sdb bs=1M

How to dd an image from one host and pipe over ssh to remote host

-O = extract files to standard out

How to create a tar.gz from a directory and pipe over ssh