ts³11240333140³1version³13³1cache_oldmajor³10³1cache_oldauthor³10³1cache_diff_default_author³11³1revision³11³1tscreate³11240333140³1text_default³1ip³2193.35.132.149³2ts³21240333140³2version³21³2name³2text_default³2data³2summary³3*³3text³3== Current status == 2x250GB SATA disks /dev/sda - blank /dev/sdb1 - / ext3 225G /dev/sdb2 - extended /dev/sdb5 - swap 6G == Target == /dev/sda1 - md0 - 200M Boot mirrored /dev/sdb1 /dev/sda2 - md1 - 2G Swap mirrored /dev/sdb2 /dev/sda3 - md2 ~ 200G Data mirrored /dev/sdb3 == High Level Process == Create necessary partitions on /dev/sda, copy data over, reboot, setup necessary partitions on /dev/sdb, sync mirror. == Detailed Process == * Install necessary stuff apt-get install mdadm lvm2 * Insert the module to make the LVM tools work modprobe dm-mod * Wipe /dev/sda * Create partitions ** Create /dev/sda1 of 200M for /boot ** Create /dev/sda2 of 2G for /swap ** Create /dev/sda3 of 200G for /data Device Boot Start End Blocks Id System /dev/sda1 1 200 1606468+ 83 Linux /dev/sda2 201 2048 14844060 83 Linux /dev/sda3 2049 30515 228661177+ 83 Linux /dev/sda1 1 200 1606468+ fd Linux raid autodetect /dev/sda2 201 2048 14844060 fd Linux raid autodetect /dev/sda3 2049 30515 228661177+ fd Linux raid autodetect * Create RAID parts ** Create md0 for /boot $ sudo mdadm --create /dev/md0 --level 1 --raid-devices=2 /dev/sda1 missing mdadm: /dev/sda1 appears to contain a reiserfs file system size = 56862016K Continue creating array? y mdadm: array /dev/md0 started. ** Create md1 for swap $ sudo mdadm --create /dev/md1 --level 1 --raid-devices=2 /dev/sda2 missing mdadm: array /dev/md1 started. ** Create md2 for data $ sudo mdadm --create /dev/md2 --level 1 --raid-devices=2 /dev/sda3 missing mdadm: array /dev/md2 started. * Display disk setup
 
 $ cat /proc/mdstat
 Personalities : [raid1]
 md2 : active raid1 sda3[0]
       228661056 blocks [2/1] [U_]
 
 md1 : active raid1 sda2[0]
       14843968 blocks [2/1] [U_]
 
 md0 : active raid1 sda1[0]
       1606400 blocks [2/1] [U_]
 
 unused devices: 
* Create boot and swap without LVM ** Create boot filesystem
$ sudo mkfs.ext3 /dev/md0
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
200928 inodes, 401600 blocks
20080 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=415236096
13 block groups
32768 blocks per group, 32768 fragments per group
15456 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
** Create swap
$ sudo mkswap /dev/md1
Setting up swapspace version 1, size = 15200219 kB
no label, UUID=5d0b63bb-8541-48f6-a97e-fb3eb32404b8
* Create data partition with LVM ** Prepare the partition for use with lvm $ sudo pvcreate /dev/md2 Physical volume "/dev/md2" successfully created ** Create an LVM Volume Group $ sudo vgcreate vg00_data /dev/md2 Volume group "vg00_data" successfully create ** Display the LVM Volume Group $ sudo vgscan -v Wiping cache of LVM-capable devices Wiping internal VG cache Reading all physical volumes. This may take a while... Finding all volume groups Finding volume group "vg00_data" Found volume group "vg00_data" using metadata type lvm2 ** Create an LVM Logical Volume $ sudo lvcreate -L200G -nlv00_data vg00_data Logical volume "lv00_data" created ** Display the LVM Logical Volume $ sudo lvscan -v Finding all logical volumes ACTIVE '/dev/vg00_data/lv00_data' [200.00 GB] inherit ** Create filesystem
 $ sudo mkfs.ext3 /dev/vg00_data/lv00_data
 mke2fs 1.40-WIP (14-Nov-2006)
 Filesystem label=
 OS type: Linux
 Block size=4096 (log=2)
 Fragment size=4096 (log=2)
 26214400 inodes, 52428800 blocks
 2621440 blocks (5.00%) reserved for the super user
 First data block=0
 Maximum filesystem blocks=0
 1600 block groups
 32768 blocks per group, 32768 fragments per group
 16384 inodes per group
 Superblock backups stored on blocks:
         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
         4096000, 7962624, 11239424, 20480000, 23887872
 
 Writing inode tables: done
 Creating journal (32768 blocks): done
 Writing superblocks and filesystem accounting information: done
 
 This filesystem will be automatically checked every 28 mounts or
 180 days, whichever comes first.  Use tune2fs -c or -i to override.
* Copy data over from sdb to sda $ sudo telinit 1 mkdir /mnt/newroot mkdir /mnt/newboot mkdir /mnt/oldroot mount /dev/sdb1 /mnt/oldroot mount /dev/vg00_data/lv00_data /mnt/newroot cp -p -r /mnt/oldroot/boot/* /mnt/newboot/ cp -p -r /mnt/oldroot/* /mnt/newroot * Maintain /etc/fstab * Reboot ³3newauthor³31³3minor³30³2username³2Alan Pope³2host³2193.35.132.149³2revision³21³2tscreate³21240333140³2id³24767³1cache_diff_default_major³11³1cache_diff_default_minor³11c1,177 < Describe the new page here. --- > == Current status == > > 2x250GB SATA disks > > /dev/sda - blank > > /dev/sdb1 - / ext3 225G > /dev/sdb2 - extended > /dev/sdb5 - swap 6G > > == Target == > > /dev/sda1 - md0 - 200M Boot mirrored /dev/sdb1 > /dev/sda2 - md1 - 2G Swap mirrored /dev/sdb2 > /dev/sda3 - md2 ~ 200G Data mirrored /dev/sdb3 > > == High Level Process == > > Create necessary partitions on /dev/sda, copy data over, reboot, setup necessary partitions on /dev/sdb, sync mirror. > > == Detailed Process == > > * Install necessary stuff > apt-get install mdadm lvm2 > > * Insert the module to make the LVM tools work > modprobe dm-mod > > * Wipe /dev/sda > * Create partitions > ** Create /dev/sda1 of 200M for /boot > ** Create /dev/sda2 of 2G for /swap > ** Create /dev/sda3 of 200G for /data > > Device Boot Start End Blocks Id System > /dev/sda1 1 200 1606468+ 83 Linux > /dev/sda2 201 2048 14844060 83 Linux > /dev/sda3 2049 30515 228661177+ 83 Linux > > /dev/sda1 1 200 1606468+ fd Linux raid autodetect > /dev/sda2 201 2048 14844060 fd Linux raid autodetect > /dev/sda3 2049 30515 228661177+ fd Linux raid autodetect > > * Create RAID parts > ** Create md0 for /boot > $ sudo mdadm --create /dev/md0 --level 1 --raid-devices=2 /dev/sda1 missing > mdadm: /dev/sda1 appears to contain a reiserfs file system > size = 56862016K > Continue creating array? y > mdadm: array /dev/md0 started. > ** Create md1 for swap > $ sudo mdadm --create /dev/md1 --level 1 --raid-devices=2 /dev/sda2 missing > mdadm: array /dev/md1 started. > ** Create md2 for data > $ sudo mdadm --create /dev/md2 --level 1 --raid-devices=2 /dev/sda3 missing > mdadm: array /dev/md2 started. > > * Display disk setup >
 
>  $ cat /proc/mdstat
>  Personalities : [raid1]
>  md2 : active raid1 sda3[0]
>        228661056 blocks [2/1] [U_]
>  
>  md1 : active raid1 sda2[0]
>        14843968 blocks [2/1] [U_]
>  
>  md0 : active raid1 sda1[0]
>        1606400 blocks [2/1] [U_]
>  
>  unused devices: 
> 
> > * Create boot and swap without LVM > ** Create boot filesystem >
> $ sudo mkfs.ext3 /dev/md0
> mke2fs 1.40-WIP (14-Nov-2006)
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> 200928 inodes, 401600 blocks
> 20080 blocks (5.00%) reserved for the super user
> First data block=0
> Maximum filesystem blocks=415236096
> 13 block groups
> 32768 blocks per group, 32768 fragments per group
> 15456 inodes per group
> Superblock backups stored on blocks:
>         32768, 98304, 163840, 229376, 294912
> 
> Writing inode tables: done
> Creating journal (8192 blocks): done
> Writing superblocks and filesystem accounting information: done
> 
> This filesystem will be automatically checked every 29 mounts or
> 180 days, whichever comes first.  Use tune2fs -c or -i to override.
> 
> ** Create swap >
> $ sudo mkswap /dev/md1
> Setting up swapspace version 1, size = 15200219 kB
> no label, UUID=5d0b63bb-8541-48f6-a97e-fb3eb32404b8
> 
> > * Create data partition with LVM > > ** Prepare the partition for use with lvm > $ sudo pvcreate /dev/md2 > Physical volume "/dev/md2" successfully created > > > ** Create an LVM Volume Group > $ sudo vgcreate vg00_data /dev/md2 > Volume group "vg00_data" successfully create > > ** Display the LVM Volume Group > > $ sudo vgscan -v > Wiping cache of LVM-capable devices > Wiping internal VG cache > Reading all physical volumes. This may take a while... > Finding all volume groups > Finding volume group "vg00_data" > Found volume group "vg00_data" using metadata type lvm2 > > ** Create an LVM Logical Volume > $ sudo lvcreate -L200G -nlv00_data vg00_data > Logical volume "lv00_data" created > > ** Display the LVM Logical Volume > $ sudo lvscan -v > Finding all logical volumes > ACTIVE '/dev/vg00_data/lv00_data' [200.00 GB] inherit > > ** Create filesystem >
>  $ sudo mkfs.ext3 /dev/vg00_data/lv00_data
>  mke2fs 1.40-WIP (14-Nov-2006)
>  Filesystem label=
>  OS type: Linux
>  Block size=4096 (log=2)
>  Fragment size=4096 (log=2)
>  26214400 inodes, 52428800 blocks
>  2621440 blocks (5.00%) reserved for the super user
>  First data block=0
>  Maximum filesystem blocks=0
>  1600 block groups
>  32768 blocks per group, 32768 fragments per group
>  16384 inodes per group
>  Superblock backups stored on blocks:
>          32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
>          4096000, 7962624, 11239424, 20480000, 23887872
>  
>  Writing inode tables: done
>  Creating journal (32768 blocks): done
>  Writing superblocks and filesystem accounting information: done
>  
>  This filesystem will be automatically checked every 28 mounts or
>  180 days, whichever comes first.  Use tune2fs -c or -i to override.
> 
> > * Copy data over from sdb to sda > > $ sudo telinit 1 > mkdir /mnt/newroot > mkdir /mnt/newboot > mkdir /mnt/oldroot > mount /dev/sdb1 /mnt/oldroot > mount /dev/vg00_data/lv00_data /mnt/newroot > cp -p -r /mnt/oldroot/boot/* /mnt/newboot/ > cp -p -r /mnt/oldroot/* /mnt/newroot > > * Maintain /etc/fstab > > * Reboot