/dev/sda or /dev/sda1 or /dev/md0 and other questions

Please ask questions here if you are not familiar with fsarchiver
Post Reply
c0mputerking
Posts: 2
Joined: Sat Nov 24, 2012 7:17 am

/dev/sda or /dev/sda1 or /dev/md0 and other questions

Post by c0mputerking » Sat Nov 24, 2012 11:26 pm

I have a bunch of questions about fsarchiver, but i am going to start small

Trying to copy a drive that is part of a degraded raid1 array (only one drive left) new drive is bigger
I have used fdisk on new drive which is bigger

Code: Select all

fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da6a0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         122      975872   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             122       14594   116243456   fd  Linux raid autodetect

Disk /dev/sdb: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcb59cf06

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         132     1060258+  fd  Linux raid autodetect
/dev/sdb2             133       30394   243079515   fd  Linux raid autodetect
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/md0: 999 MB, 999280640 bytes
2 heads, 4 sectors/track, 243965 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xffffffff

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 119.0 GB, 119032176640 bytes
2 heads, 4 sectors/track, 29060590 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/dm-0: 9999 MB, 9999220736 bytes
255 heads, 63 sectors/track, 1215 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 3997 MB, 3997171712 bytes
255 heads, 63 sectors/track, 485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 50.0 GB, 49996103680 bytes
255 heads, 63 sectors/track, 6078 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da6a0

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/dm-3: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a99d0

     Device Boot      Start         End      Blocks   Id  System
/dev/dm-3p1   *           1          45      358400+  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/dm-3p2              45         176     1048576   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/dm-3p3             176         306     1048576   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/dm-3p4             306        2611    18514943+   f  W95 Ext'd (LBA)
/dev/dm-3p5             306         952     5188607+  83  Linux
/dev/dm-3p6             952        1653     5631999+  83  Linux
/dev/dm-3p7            1653        2505     6838271+  83  Linux
/dev/dm-3p8            2505        2597      741375+  83  Linux
To explain in words
/dev/sdb1 my /boot and /dev/md0 raid drive
/dev/sdb2 my / and /dev/md1 and lvm that will house volume group vg0 and logical volumes root, swap, data

question which is better or more likely to work to copy drive

/dev/md0 to /dev/sdb
or
/dev/sda to /dev/sdb
or
/dev/sda1 to /dev/sdb1
/dev/sda2 to /dev/sdb2

GRUB STUFF
using debian squeeze so i have this avliable and have used it
dpkg-reconfigure grub-pc and added grub to /dev/sda and /dev/sdb. Should i also be adding it to /dev/md0? i think so but will it mess up mdadm?

Next question after hopefully rebooting to only the new drive in degrade mode.
Not being familar with fsachive in fact this is my first time about to use it so do what do i need to do to resize things
I was thinking
mdadm --grow /dev/md0 -z max incase the fdisk was not perfect
also
mdadm --grow /dev/md1 -z max to get extra size from new bigger disk

or should i be doing this in some other order or does fsarchive do this on its own.

PS putting a walk through together of this here so i remeber and to help others

http://computerking.ca/copy-pve-to-a-new-drive/

PSS think i could do all this online?? ie with the the OS booted?? then i would have to use snapshots of the lvms
Also i could umount the /boot partion as gentoo does this automagically after the system starts up.

c0mputerking
Posts: 2
Joined: Sat Nov 24, 2012 7:17 am

Re: /dev/sda or /dev/sda1 or /dev/md0 and other questions

Post by c0mputerking » Sun Nov 25, 2012 7:57 pm

c0mputerking wrote:I have a bunch of questions about fsarchiver, but i am going to start small

Trying to copy a drive that is part of a degraded raid1 array (only one drive left) new drive is bigger
I have used fdisk on new drive which is bigger

Code: Select all

fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da6a0

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         122      975872   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             122       14594   116243456   fd  Linux raid autodetect

Disk /dev/sdb: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcb59cf06

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         132     1060258+  fd  Linux raid autodetect
/dev/sdb2             133       30394   243079515   fd  Linux raid autodetect
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/md0: 999 MB, 999280640 bytes
2 heads, 4 sectors/track, 243965 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xffffffff

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 119.0 GB, 119032176640 bytes
2 heads, 4 sectors/track, 29060590 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/dm-0: 9999 MB, 9999220736 bytes
255 heads, 63 sectors/track, 1215 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 3997 MB, 3997171712 bytes
255 heads, 63 sectors/track, 485 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 50.0 GB, 49996103680 bytes
255 heads, 63 sectors/track, 6078 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da6a0

   Device Boot      Start         End      Blocks   Id  System

Disk /dev/dm-3: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a99d0

     Device Boot      Start         End      Blocks   Id  System
/dev/dm-3p1   *           1          45      358400+  83  Linux
Partition 1 does not end on cylinder boundary.
/dev/dm-3p2              45         176     1048576   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/dm-3p3             176         306     1048576   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/dm-3p4             306        2611    18514943+   f  W95 Ext'd (LBA)
/dev/dm-3p5             306         952     5188607+  83  Linux
/dev/dm-3p6             952        1653     5631999+  83  Linux
/dev/dm-3p7            1653        2505     6838271+  83  Linux
/dev/dm-3p8            2505        2597      741375+  83  Linux
To explain in words
/dev/sdb1 my /boot and /dev/md0 raid drive
/dev/sdb2 my / and /dev/md1 and lvm that will house volume group vg0 and logical volumes root, swap, data

question which is better or more likely to work to copy drive

/dev/md0 to /dev/sdb
or
/dev/sda to /dev/sdb
or
/dev/sda1 to /dev/sdb1
/dev/sda2 to /dev/sdb2


I managed to figure out grub on my own

GRUB STUFF
using debian squeeze so i have this avliable and have used it
dpkg-reconfigure grub-pc and added grub to /dev/sda and /dev/sdb. Should i also be adding it to /dev/md0? i think so but will it mess up mdadm?

Next question after hopefully rebooting to only the new drive in degrade mode.
Not being familar with fsachive in fact this is my first time about to use it so do what do i need to do to resize things
I was thinking
mdadm --grow /dev/md0 -z max incase the fdisk was not perfect
also

This does not work use lvm tools instead

mdadm --grow /dev/md1 -z max to get extra size from new bigger disk

or should i be doing this in some other order or does fsarchive do this on its own.

PS putting a walk through together of this here so i remeber and to help others

http://computerking.ca/copy-pve-to-a-new-drive/

PSS think i could do all this online?? ie with the the OS booted?? then i would have to use snapshots of the lvms
Also i could umount the /boot partion as gentoo does this automagically after the system starts up.

Post Reply