You are not logged in.

#1 2012-06-21 21:31:48

OakRaider4Life
Member
Registered: 2012-02-08
Posts: 98

Hard Drive Migration w/Boot Partition

I am currently running an Arch media box/server from which I am planning to move all home server functionality onto a new piece of hardware. It currently has two hard drives setup in it (/dev/sda & /dev/sdb) which are setup with lvm. I am planning to move the bigger of the two hard drives (/dev/sdb) into the new server box. Since I'm using lvm, and the install is currently small enough to fit entirely on /dev/sda, this is mostly non-problematic. However, the caveat is that my boot partition is installed on /dev/sdb on a regular ext2 partition whith the bootloader installed to the MBR of /dev/sdb. Does anyone know of a good way I could setup /dev/sda for booting the system?

Also, if anyone knows of a way to setup /boot on an lvm partition so I could avoid this problem again in the future, that would be welcome additional information smile

Thank you in advance for any replies!

Offline

#2 2012-06-23 07:40:22

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: Hard Drive Migration w/Boot Partition

You can transfer (backup) your system even while it's running:

$ sudo mount /dev/sda /mnt/somefolder
$ sudo rsync -avx /* /mnt/somefolder --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}

It will complain at the end that some files/attributes weren't transferred, but that's because of ~/.gvfs. It's nothing to worry about.


GRUB Legacy doesn't work with LVM. I'm not sure about Syslinux, but GRUB 2 definitely works from LVM.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#3 2012-06-23 17:59:11

OakRaider4Life
Member
Registered: 2012-02-08
Posts: 98

Re: Hard Drive Migration w/Boot Partition

Thanks! I'll give it a shot and report back on my results

Offline

#4 2012-06-25 11:38:09

rnarch
Member
Registered: 2012-03-17
Posts: 292

Re: Hard Drive Migration w/Boot Partition

DSpider wrote:

You can transfer (backup) your system even while it's running:
$ sudo rsync -avx /* /mnt/somefolder --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}

Are you able to boot arch from the backup directly using this method (if backed up to / of another partition) ?

Last edited by rnarch (2012-06-25 11:38:55)

Offline

#5 2012-06-25 12:04:39

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: Hard Drive Migration w/Boot Partition

No. Not "directly", no.

If you have a separate /boot partition, only the bootloader's config file and /etc/fstab will have to be adjusted.

But if you don't have a separate /boot partition you will need to reinstall the bootloader -- which is really not that difficult. Each bootloader has their own wiki page.


For example:

Syslinux:

$ sudo extlinux --install /boot/syslinux
$ sudo dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sdb

GRUB Legacy:

$ sudo grub-install /dev/sdb

GRUB 2 (I have only tested this from a chroot, and using a "live" Linux distribution):

# grub-install --directory=/usr/lib/grub/i386-pc --target=i386-pc --boot-directory=/boot --recheck --debug /dev/sdb
# grub-mkconfig -o /boot/grub/grub.cfg

"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#6 2012-06-25 16:46:44

rnarch
Member
Registered: 2012-03-17
Posts: 292

Re: Hard Drive Migration w/Boot Partition

Thanks. I will try it and give you the feedback.
Edit: Yes, it worked!

Last edited by rnarch (2012-07-22 05:10:01)

Offline

Board footer

Powered by FluxBB