Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Yedidyah Bar-David
On Sun, Feb 19, 2012 at 04:03:05AM +0200, Omer Zak wrote:
 My PC has a 500GB hard disk, and I want to migrate it to a 2TB hard
 disk.
 The new hard disk has been formatted to have two physical partitions,
 one serves as /boot and the other is an encrypted LVM volume, which has
 its own division into logical partitions.
 
 I rsync'ed the old hard disk's contents into the new one (excluding
 - /lib/init/rw/***
 - /dev/shm/***
 - /proc
 - /sys
 - /tmp/***
 - /var/lock/***
 - /var/tmp/***
 - /cdrom/***
 - /media/***
 - /etc/fstab
 ).
 
 I edited /etc/fstab in the new hard disk to specify the correct
 partitions.
 
 Then I ran grub-install on the new hard disk using:
   chroot /tmp/new_2T grub-install /dev/sdb
 where the new hard disk's /boot and logical partitions are mounted on
 subdirectories of /tmp/new_2T, and the new hard disk itself is /dev/sdb.
 
 However the logical volume paths in the old hard disk and the new one
 differ.
 It turns out that the kernel and initrd images in the old hard disk have
 the old logical volume paths hardwired in them.

Are you certain about that? I do not have cryptfs (and the cryptroot
script below) installed, but I think very little is hardwired into
Debian's mkinitramfs-generated initrd images.

 So when trying to reboot the PC from the new hard disk, it doesn't find
 the root filesystem.  The failing script is /scripts/local-top/cryptroot
 (/scripts/local-top template can be found in /etc/initramfs).

Can you try passing (adding or changing) root=THENEWROOT from your
bootloader?

If that works, you'll need to change your boot loader's configuration.
In a default squeeze install, that's in /etc/default/grub and
/etc/grub.d . Then run 'update-grub'.

 
 So it seems that I need somehow to recreate the initrd.img's contents.
 
 I may have missed also other things.
 
 Questions:
 1. How to recreate initrd.img's appropriate for the new hard disk?

Not sure how to do this from the old disk, but once you manage to boot
to the new disk (e.g. using some rescue CD or whatever), you should be
able to use mkinitramfs without special options - hopefully it will
detect the changes etc by itself.

Note that I have no experience with cryptfs and related stuff.

 2. Is there any guide about migrating a Debian Squeeze system inside an
 encrypted LVM partition from one hard disk to another hard disk?

No idea.

 
 In conclusion: I am dismayed at the fact that migrating Linux systems,
 which used to be a simple affair (like MS-DOS), is now complicated (like
 versions of MS-Windows after Windows 95).

That's not a fair comparison - you decided to do some non-trivial changes
to your disk layout, and that's not mere migrating. That said, I agree
that in the process of making the boot process more robust, distributions
(Debian included) made it also more complex. One thing I noticed, which
might or might not be relevant here, is that in certain cases the boot
loader identifies filesystems with their UUID, which is not copied by
most people when copying a disk. So now if something changes your
/dev/sda2 to /dev/hda2 or vice versa, you'll still boot, unlike in the
past, but copying root elsewhere will also require updating the boot
loader unless you made sure you also copied the UUID.
-- 
Didi


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Amos Shapira
On Feb 19, 2012 4:37 PM, Daniel Shahaf d...@daniel.shahaf.name wrote:

 Omer Zak wrote on Sun, Feb 19, 2012 at 04:03:05 +0200:
  My PC has a 500GB hard disk, and I want to migrate it to a 2TB hard
  disk.
  The new hard disk has been formatted to have two physical partitions,
  one serves as /boot and the other is an encrypted LVM volume, which has
  its own division into logical partitions.
 
  I rsync'ed the old hard disk's contents into the new one (excluding
 ...
  2. Is there any guide about migrating a Debian Squeeze system inside an
  encrypted LVM partition from one hard disk to another hard disk?

 One thing that jumps to mind: given that the old disk uses LVM too, you
 could transition the LV's from the old disk to the new one by using LVM
 tools.

 I don't recall the exact commands, but I suppose it's along the lines of
 convert the LV to a mirror (with one PV on the small disk and one PV on
 the new one), then tell LVM to retire the old disk's PV's.

No need for that. Vgmove then remove the old PV from the VG before
disconnecting it.


 HTH.  I'm not sure how this interacts with the boot parts of the
 equation or with encrypted partitions.

 ___
 Linux-il mailing list
 Linux-il@cs.huji.ac.il
 http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Omer Zak
Thanks, Daniel and Amos, for your suggestions.
However they address the wrong part of my problem.
All my regular files were already copied to the new hard disk and it was
properly set up.
The only problem is to boot from it.

I successfully set up grub2 to boot from the new disk's boot partition
(a physical partition, not under LVM control).  For this purpose, I
modified grub.cfg.
I need to rebuild initrd.img files for all kernels that I have.

Yedidiah, you questioned my finding that logical volume paths are
hardwired in the initrd images.  They are.
The relevant files are:
  /scripts/local-top/cryptroot and /conf/param.conf
in the initrd image.

According to man mkinitramfs, the file which configures the above
is /etc/initramfs-tools/initramfs.conf and in practice I see files also
in /etc/initramfs-tools/conf.d

I created files which set
RESUME=/path/to/swap/volume
ROOT=/path/to/root/volume

However even after doing so, the boot loader doesn't find them.
So I must have been doing something wrong.
Any other suggestions?

--- Omer


On Sun, 2012-02-19 at 23:23 +1100, Amos Shapira wrote:
 
 On Feb 19, 2012 4:37 PM, Daniel Shahaf d...@daniel.shahaf.name
 wrote:
 
  Omer Zak wrote on Sun, Feb 19, 2012 at 04:03:05 +0200:
   My PC has a 500GB hard disk, and I want to migrate it to a 2TB
 hard
   disk.
   The new hard disk has been formatted to have two physical
 partitions,
   one serves as /boot and the other is an encrypted LVM volume,
 which has
   its own division into logical partitions.
  
   I rsync'ed the old hard disk's contents into the new one
 (excluding
  ...
   2. Is there any guide about migrating a Debian Squeeze system
 inside an
   encrypted LVM partition from one hard disk to another hard disk?
 
  One thing that jumps to mind: given that the old disk uses LVM too,
 you
  could transition the LV's from the old disk to the new one by using
 LVM
  tools.
 
  I don't recall the exact commands, but I suppose it's along the
 lines of
  convert the LV to a mirror (with one PV on the small disk and one
 PV on
  the new one), then tell LVM to retire the old disk's PV's.
 
 No need for that. Vgmove then remove the old PV from the VG before
 disconnecting it.
 
 
  HTH.  I'm not sure how this interacts with the boot parts of the
  equation or with encrypted partitions.
-- 
Jara Cimrman - one of the unsung geniuses of the world - scientist, engineer,
inventor and literary critic.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Yedidyah Bar-David
On Sun, Feb 19, 2012 at 03:47:32PM +0200, Omer Zak wrote:
 Thanks, Daniel and Amos, for your suggestions.
 However they address the wrong part of my problem.
 All my regular files were already copied to the new hard disk and it was
 properly set up.
 The only problem is to boot from it.
 
 I successfully set up grub2 to boot from the new disk's boot partition
 (a physical partition, not under LVM control).  For this purpose, I
 modified grub.cfg.
 I need to rebuild initrd.img files for all kernels that I have.

need or needed?

For testing, building for one is enough, BTW.

 
 Yedidiah, you questioned my finding that logical volume paths are
 hardwired in the initrd images.  They are.
 The relevant files are:
   /scripts/local-top/cryptroot and /conf/param.conf
 in the initrd image.
 
 According to man mkinitramfs, the file which configures the above
 is /etc/initramfs-tools/initramfs.conf and in practice I see files also
 in /etc/initramfs-tools/conf.d
 
 I created files which set
 RESUME=/path/to/swap/volume
 ROOT=/path/to/root/volume
 
 However even after doing so, the boot loader doesn't find them.

You mean after doing so and building another initrd image?

 So I must have been doing something wrong.
 Any other suggestions?

Did you try passing 'root=DEV'?

Where does the boot process get stuck? What are the last few lines?

Can you try 'break=premount' and debug a bit from there - e.g. see
if you can manually mount the new root, etc.?

You might also try dracut, BTW, and even yaird (which isn't in squeeze) -
I have no experience with either of them.

You can also try booting using some kind of rescue system (Debian's
bootable media or something else) and then mkinitrd again.
-- 
Didi


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Tzafrir Cohen
On Sun, Feb 19, 2012 at 03:47:32PM +0200, Omer Zak wrote:
 Thanks, Daniel and Amos, for your suggestions.
 However they address the wrong part of my problem.
 All my regular files were already copied to the new hard disk and it was
 properly set up.
 The only problem is to boot from it.
 
 I successfully set up grub2 to boot from the new disk's boot partition
 (a physical partition, not under LVM control).  For this purpose, I
 modified grub.cfg.
 I need to rebuild initrd.img files for all kernels that I have.

update-initramfs -u

 
 Yedidiah, you questioned my finding that logical volume paths are
 hardwired in the initrd images.  They are.
 The relevant files are:
   /scripts/local-top/cryptroot and /conf/param.conf
 in the initrd image.
 
 According to man mkinitramfs, the file which configures the above
 is /etc/initramfs-tools/initramfs.conf and in practice I see files also
 in /etc/initramfs-tools/conf.d

If things don't work, chances are that lookingg there is not the right
place. Debian's defalt initrd is a bit largish, but tends to Just
Works[tm].

I recently needed to do a similar migration (also moving the LVM to
reside on top of a RAID-1) in a Debian Squeeze system. It turned out that:

* I left out some room for a physical /boot partition. It turned out
  there was no need for it.

* It took me a while to figure out why the system won't boot even though
  I regenerated the initramfs. After much digging in the scripts, in the
  extracted initrd (gunzip it and extract the cpio with cpio -id), I
  realized that if I really want to boot from a RAID I better install
  mdadm (and regenerate initramfs).

* Still one of those two disks crashed this morning :-( .

-- 
Tzafrir Cohen | tzaf...@jabber.org | VIM is
http://tzafrir.org.il || a Mutt's
tzaf...@cohens.org.il ||  best
tzaf...@debian.org|| friend

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Omer Zak
Hello Tzafrir,
Thanks for your war story.

On Sun, 2012-02-19 at 18:34 +, Tzafrir Cohen wrote:
 update-initramfs -u

The twist is that I need to boot some kernel to run it.
What I did was:
1. Leave both disks connected to the PC.
2. Boot from the old (500GB) disk.
3. Mount the partitions of the new (2TB) disk on a directory tree
originating in /tmp/new_2T, so that the to-be-root partition is mounted
on it and other partitions are mounted on subdirectories of the
to-be-root.
4. chroot /tmp/new_2T/ update-initramfs -u -k all -v
5. Reboot - this time into the new (2TB) disk.
6. Get stuck because it doesn't find the root and swap partitions.

How did you boot your PC to run update-initramfs?

--- Omer


-- 
QA People of Curse.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html


___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Migrating a Linux (Debian Squeeze) system from one HD to another HD

2012-02-19 Thread Tzafrir Cohen
On Sun, Feb 19, 2012 at 09:22:37PM +0200, Omer Zak wrote:
 Hello Tzafrir,
 Thanks for your war story.
 
 On Sun, 2012-02-19 at 18:34 +, Tzafrir Cohen wrote:
  update-initramfs -u
 
 The twist is that I need to boot some kernel to run it.
 What I did was:
 1. Leave both disks connected to the PC.
 2. Boot from the old (500GB) disk.
 3. Mount the partitions of the new (2TB) disk on a directory tree
 originating in /tmp/new_2T, so that the to-be-root partition is mounted
 on it and other partitions are mounted on subdirectories of the
 to-be-root.
 4. chroot /tmp/new_2T/ update-initramfs -u -k all -v

You make need to bind-mount /dev and mount /proc and/or /sys inside the
chroot.

 5. Reboot - this time into the new (2TB) disk.
 6. Get stuck because it doesn't find the root and swap partitions.
 
 How did you boot your PC to run update-initramfs?

Rescue system. I could use both old and new.

-- 
Tzafrir Cohen | tzaf...@jabber.org | VIM is
http://tzafrir.org.il || a Mutt's
tzaf...@cohens.org.il ||  best
tzaf...@debian.org|| friend

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Preparing to convince to shift to non-propriety documents formats

2012-02-19 Thread Dotan Cohen
On Sat, Feb 18, 2012 at 20:22, Oron Peled o...@actcom.co.il wrote:
 So either supporting a public documented ISO standard isn't harder
 than supporting many variants of proprietary and undocumented file
 file format, or... draw your own conclusion.


Undocumented? Which file format is that? All the .doc and .docx
formats are documented, even the older binary formats.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il