Hi, Kurt Tunkko wrote on 2008-07-16 01:05:30 +0200 [Re: [BackupPC-users] Howto backup BackupPC running on a RAID1 with mdadm for offline-storage]: > Holger Parplies wrote: > > >> 3. Mirror partition tables from one of the existing disks: > >> > >> # sudo sfdisk -d /dev/sda | sfdisk /dev/sdc > [...] > > I took the information above from the page: > > Setting up software RAID in Ubuntu Server > http://advosys.ca/viewpoints/2007/04/setting-up-software-raid-in-ubuntu-server/ > > " [...] > For example, to copy the partition table from the second > drive ???sdb??? onto the first drive ???sda???, the sfdisk command is as > follows: > > sfdisk ???d /dev/sdb | sfdisk /dev/sda"
my point is that your pipeline consists of the two commands sudo sfdisk -d /dev/sda sfdisk /dev/sdc connected by a pipe. It's not as though 'sudo' somehow magically applies to the pipe and not only its own parameters. You need either sudo sh -c "sfdisk -d /dev/sda | sfdisk /dev/sdc" or rather sudo sfdisk -d /dev/sda | sudo sfdisk /dev/sdc Similarly, you can echo 'backuppc hold' | sudo dpkg --set-selections because you don't need root privileges to echo 'backuppc hold', and my favorite for I/O-redirection with root privileges is some-command-that-generates-output | sudo dd of=/root/output.file Sorry, that was off-topic. > I don't know if it's possible to add a 3rd drive to the RAID, that > hasn't got the right partitions on it :-? You're not adding a drive to the RAID, you're adding a partition, i.e. a block device consisting of at least N blocks, where N is the size of the smallest partition currently in the array. You usually choose identically sized partitions to avoid wasting space. If you've got identical disks with only a single partition, you can probably use the disk (/dev/sd[abc]) instead of a partition (/dev/sd[abc]1) and put the first track to good use. It might be desirable to have the partitions of one RAID array in the same place on all disks (identical R/W speed, presuming identical disks) or it might not. You've got a lot of freedom. Of course the partition needs to exist and be large enough though. > [...] > While this approach is much better than the one I suggested yesterday it > still leads to some Questions: > > 1) Is there a way to add the 3rd drive to RAID1 as soon as it will be > connected to the system (External harddrive that is oonnected via usb2)? > Or more generally: Can I run a script when an external storage device is > connected via usb? Yes. Are you sure you want that Windoze-type-oh-no-feeling when you plug a USB stick with valuable data into the computer and it automatically fills it with the first few GBs of your BackupPC pool? :) Not sure if sfdisk will allow the partition table to exceed the device size though ... man udev && good luck > 2) Do I need to resize my RAID after removing the 3rd harddrive with > # sudo mdadm --grow --raid-devices=2 /dev/md0 > Are there any problems when the RAID will be used in clean, but > degraded state? I haven't had any so far with one-way-mirrors. You might get an occasional warning e-mail. Otherwise, I wouldn't expect any difference between non-degraded two-way and degraded three-way mirrors with two operational disks. Finally, you might take a look at the mdadm --write-mostly option. Sounds as if it were meant for cases like this one. Regards, Holger ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: http://backuppc.wiki.sourceforge.net Project: http://backuppc.sourceforge.net/