Apparently, though unproven, at 23:59 on Wednesday 17 November 2010, James did 
opine thusly:

> Hello,
> 
> I have a ~250 gig sata disk I want to migrate to a 2T
> Sata disk. This is simple, but, I have a few caveats.
> 
> old disk:
> 
> Disk /dev/sda: 320.1 GB, 320072933376 bytes
> 255 heads, 63 sectors/track, 38913 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: 0x000a1ff7
> 
>    Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *           1        6405    51448131    7  HPFS/NTFS
> /dev/sda2            6406        6431      208845   83  Linux
> /dev/sda3            6432       14080    61440592+  83  Linux
> /dev/sda4           14081       38913   199471072+   5  Extended
> /dev/sda5           14081       14861     6273351   82  Linux swap /
> Solaris /dev/sda6           14862       26335    92164873+  83  Linux
> /dev/sda7           26336       38913   101032753+  83  Linux
> 
> 
> /dev/sda2        /boot   reiserfs        defaults               1 2
> /dev/sda3        /       reiserfs        defaults               0 1
> /dev/sda5        none            swap            sw             0 0
> /dev/sda6        /usr/local      reiserfs        defaults       0 1
> /dev/sda7 /usr/local/video       reiserfs        defaults       0 1
> none        /proc       proc            defaults                0 0
> none        /dev/shm    tmpfs           defaults                0 0
> /dev/fd0 /mnt/floppy    vfat            noauto,user,umask=000   0 0
> #/dev/fd0 /mnt/floppy   auto            noauto,                 0 0
> /dev/cdrom  /mnt/cdrom  auto            noauto,rw,user          0 0
> #/dev/sda1   /mnt/windows ntfs-3g                               0 0
> 
> Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
> 255 heads, 63 sectors/track, 243201 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: 0x5f61c272
> 
>    Device Boot      Start         End      Blocks   Id  System
> 
> <needs formatting and file systems installed>
> 
> OK, so I format using fdisk <no big deal>

No you don't. You will partition it with fdisk and format the filesystems with 
mkfs*

> <new disk will just have /(200G), swap, boot(250M) and one
> bit fat /usr/local  (1.8T)
> 
> 
> Ok now I was going to use same reiserfs < no big deal>

I dropped my beloved reiserfs systems of many years in favour of ext4. I was 
seeing ext4 (and the much-hyped btrfs) racing forward into the distance with 
improvements, useful features and more, while reiser3 languished. The last 
straw was when I started getting fs errors for no good reason.

Let's face it, reiser was Hans. The team he left behind can do maintenance and 
bug-fixes, but how many features have you seen added in two years?

> unless I can use reiser4? good idea? <discuss-caveats>

Yuck. 
It's not in mainline and will never go in mainline.
It's not in the tree and will never go in the tree.

My understanding is it never actually got finished; and with all those plugins 
it is just not possible to write a *real* fsck. I would not touch it myself 
with your bargepole.

> 
> OK now I want the new fstab to use disklabels
> <old dog learning new trick here>
> 
> like this simple (few) partition scheme:
> /dev/sdb3              200G   52G   42G  55% /
> udev                   10M  224K  9.8M   3% /dev
> /dev/sdb1             250M   47M  189M  20% /boot
> /dev/sdb4             1800G  125G   12G  92% /usr/local
> 
> Current <non disklabel fstab>
> 
> /dev/sda1       /boot   reiserfs        defaults               1 2
> /dev/sda2       none    swap            sw                     0 0
> /dev/sda3       /       reiserfs        defaults               0 1
> /dev/sda4  /usr/local   reiserfs        defaults               0 1
> /dev/cdrom  /mnt/cdrom  auto            noauto,ro,user          0 0
> /dev/fd0    /mnt/floppy vfat            noauto,user,umask=000   0 0
> shm         /dev/shm    tmpfs           nodev,nosuid,noexec     0 0
> none        /proc       proc            defaults                0 0
> 
> so what does new fstab using disk labels look like?

First you need to mkfs the filesystem with -L <label>

fstab looks like this:

LABEL=MY_BIG_DISK    /       reiserfs        defaults               0 1

> Last, just dd it over like this?
> dd if=/dev/sda of=/dev/sdb bs=32768

Ahem no.

That will give you the *identical* filesystems on the new disk as were on the 
old disk. Which means you have 250G used on a 2T disk with 1.75T 
unpartitioned, plus the devil's own task of then getting it to be how you 
actually want

> What did I miss?

The bit where you use a LiveCD :-)

The rub is, that you will be copying files that are subject to being changed, 
especially /. It's a complete ball-ache trying to deal with this and it 
involves multiple rsync's and holding of thumbs. A LiveCD lets you do it once 
in complete confidence.

So install the new disk, fdisk it, mkfs it. Then boot off a LiveCD. If you 
picked a good one, it will mount your disks at /mnt/sda and /mnt/sdb.

Now just rsync everything in /mnt/sda* to the right place in /mnt/sdb

You do not have exactly the same mount layout on sdb, so some intelligence is 
needed to do it in the right order, such as in the case of /usr/local and 
/usr/local/video

Reboot. Share. Enjoy.


> 
> Discussion, corrections or caveats are most welcome.

-- 
alan dot mckinnon at gmail dot com

Reply via email to