LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   migrating from 18GB HD to a 72GB HD w/RH3.0 (https://www.linuxquestions.org/questions/linux-newbie-8/migrating-from-18gb-hd-to-a-72gb-hd-w-rh3-0-a-602151/)

phahn 11-24-2007 06:03 PM

migrating from 18GB HD to a 72GB HD w/RH3.0
 
Hi,

My main drive (18GB) is /dev/sda and I want to transfer everything over to a new 72GB drive /dev/sdc. The current partitions are:

[root@dell root]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 16GB 9.3GB 5.7GB 63% /
/dev/sda1 105MB 25MB 80MB 24% /boot/efi
none 11GB 0 11GB 0% /dev/shm
/dev/sdb1 18GB 13GB 4.7GB 73% /mnt/disk2

I want /dev/sdc to have the identical /boot/efi partition and a 22GB swap partition.

By the way, this is on a Dell PE 7150 Itanium machine, running RH Enterprise 3.0.

It was easy for me to do something similar on a Sun machine by formatting the new HD with the format command followed by mkfile on each partition. All the steps were logical. But, when I tried to set up partitions using fdisk, I became confused. Nothing on the Internet helped.

Once /dev/sdc is partitioned and file systems installed, I need to copy everything from /dev/sda to /dev/sdc. How should that be done?

One big question: How come the 11GB swap area on /dev/sda does not show up as /dev/sd3?

Phahn

Simon Bridge 11-24-2007 06:45 PM

Quote:

How come the 11GB swap area on /dev/sda does not show up as /dev/sd3?
Because df treats swap partitions special. Try

fdisk -l

Note: the df -H list doesn't actually show the filesystem type either.

Quote:

I tried to set up partitions using fdisk, I became confused
At which point did you become confused?

Unlike the Sun systems you are used to, fdisk does it all by itself.

Get to know the device.
fdisk -l (note which one is the target drive - I'll call it sdc for now)

Unmount all partitions.
umount /dev/sdc1 (repeat for sdc2 sdc3 etc)

Now to start:
fdisk /dev/sdc

Get rid of existing partitions (accounts for mistakes etc)
p (show table)
d (delete table)
p (check all partitions gone)
d (repeat until all partitions gone)

Create /boot/efi partition:
n (new partition)
1 (make it the first one)
<enter> (accept default first cylinder)
+105M (set partition size)
a (make active)
1 (select partition)
t (change filesystem note: consistent with -t, the mount option to specify fs)
# (number of the filesystem you want, fat16 is number 6, I forget the others)

Create swap partition:
n > 2 > enter > +20480M > 1 > t > # for swap.
(you could specify that this is partition 3 and set the first cylinder to the end and the size as -20480M, if you want.)

Create root partition
n > 3 > enter > enter > a > 1 > t > # for fs you want.

Make these changes permanent:
w (the write command)

OR - leave off the create file-system steps if this confuses you. Instead use mkfs.ext3 for ext3 partitions and mkswap for the swap partition.

Claro?

phahn 11-24-2007 07:52 PM

I tried the advice from Guru, can't mount new HD
 
Hi,

I followed instructions to the best of my ability. Here is the result:

[root@dell root]# fdisk -l

Disk /dev/sda: 18.2 GB, 18210036736 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 2214 17783238+ ee EFI GPT

Disk /dev/sdb: 18.2 GB, 18210036736 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 2214 17783238+ ee EFI GPT

Disk /dev/sdc: 73.4 GB, 73407820800 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 14 112423+ ee EFI GPT
/dev/sdc2 15 2505 20008957+ 82 Linux swap
/dev/sdc3 2506 8924 51560617+ ee EFI GPT

Disk /dev/sdd: 18.2 GB, 18210036736 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 2214 17783238+ ee EFI GPT

Did I do something wrong?

Recall that /dev/sda is the current main drive. /dev/sdc is the drive I just partitioned. I tried to mount /dev/sdc and was not able to. Here is one of the attempts:

[root@dell root]# mount /dev/sdc1 /mnt/disk3
mount: you must specify the filesystem type
[root@dell root]# mount -t EFI /dev/sdc1 /mnt/disk3
mount: fs type EFI not supported by kernel

Simon Bridge 11-24-2007 11:49 PM

Disk /dev/sdc: 73.4 GB, 73407820800 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 14 112423+ ee EFI GPT
/dev/sdc2 15 2505 20008957+ 82 Linux swap
/dev/sdc3 2506 8924 51560617+ ee EFI GPT

This looks right -

[root@dell root]# mount /dev/sdc1 /mnt/disk3
mount: you must specify the filesystem type
[root@dell root]# mount -t EFI /dev/sdc1 /mnt/disk3
mount: fs type EFI not supported by kernel

The mount command is wrong - EFI is a variation on fat32, try:

mount -t vfat /dev/sdc1 /mnt/disk3

Is this an intel/mac setup?

phahn 11-25-2007 08:29 AM

Hi Simon,

I forgot to thank you for your help. I learned a lot and am very appreciative. I tried your suggestion:

[root@dell root]# mount -t vfat /dev/sdc1 /mnt/disk3
mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
or too many mounted file systems

It can't be too many mounted file systems. Bigger question. How come /dev/sda appears to have only one partition (see prev message), when a df -k gives:

[root@dell root]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 15387444 9067568 5538236 63% /
/dev/sda1 102182 24338 77844 24% /boot/efi
none 10399184 0 10399184 0% /dev/shm

??
Peter

phahn 11-25-2007 08:33 AM

OOOPS! I forgot to answer Guru's question. This is a six year old Dell PE 7150 Itanium server. It is a personal machine and no longer has any technical support.

Simon Bridge 11-26-2007 07:55 AM

Supported filesystems (from manpage):
Code:

The file system types which are  currently  supported
              include:  adfs,  affs,  autofs,  cifs,  coda,  coherent, cramfs,
              debugfs, devpts, efs,  ext,  ext2,  ext3,  hfs,  hfsplus,  hpfs,
              iso9660,  jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4,
              ramfs, reiserfs, romfs, smbfs, sysv, tmpfs,  udf,  ufs,  umsdos,
              usbfs,  vfat,  xenix,  xfs, xiafs.

... so which file system did you select again? ee? Which command did you use to mount the old one? Aren't you supposed to make a filesystem to the GPT partition?

Why use GPT anyway? None of your fs are going to be bigger that 2TB.

Quote:

How come /dev/sda appears to have only one partition (see prev message)
... you got me.

phahn 11-26-2007 09:26 AM

I can explain why I was confused.
 
Hi Simon,

Take a look at:

http://kbase.redhat.com/faq/FAQ_80_3531.shtm

It seems that fdisk -l gives me misleading information, because my machine is an Itanium-64. I was trying to make the new /dev/sdc have the same type file systems as I observed from fdisk -l.

Regarding your questions:

Quote:

... so which file system did you select again? ee?
Yes, I chose ee.

Quote:

Which command did you use to mount the old one? Aren't you supposed to make a filesystem to the GPT partition?
The old system is mounted via fstab during the boot process:

[root@dell root]# more /etc/fstab
LABEL=/ / ext3 defaults 1 1
/dev/sda1 /boot/efi vfat defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/hda /mnt/ls120.0 auto noauto,owner,kudzu 0 0

Furthermore, I never have to specify type of file system when I mount any of the extra HDs.

Quote:

Why use GPT anyway? None of your fs are going to be bigger that 2TB.
I just am trying to set things up so they will work. Thus, I tried to mimic what I saw on /dev/sda.

Thanks

Peter

phahn 11-26-2007 12:50 PM

Situation improving considerably
 
Hi,

Using GNU's parted command gave me the details I needed from /dev/sda:

Quote:

[root@dell root]# parted /dev/sda print
Disk geometry for /dev/sda: 0.000-17366.444 megabytes
Disk label type: gpt
Minor Start End Filesystem Name Flags
1 0.017 100.016 fat16 boot
2 100.017 15366.428 ext3
3 15366.428 17366.428 linux-swap
I tried to use parted on /dev/sdc, but it didn't like the disk label. So, I used fdisk and was able to partition easily using the earlier lessons from Grub.

I followed this up with the following commands:

mkfs.ext3 /dev/sdc1 (When I tried mkfs -t fat16, I got an error message.)
mkfs.ext3 /dev/sdc2
mkswap /dev//sdc3

Then parted gave me the following encouraging result:

Quote:

[root@dell root]# parted /dev/sdc print
Disk geometry for /dev/sdc: 0.000-70007.153 megabytes
Disk label type: msdos
Minor Start End Type Filesystem Flags
1 0.031 109.819 primary ext3 boot
2 109.819 49018.645 primary ext3
3 49018.645 70001.982 primary linux-swap
Well, so far so good. I am now able to mount either /dev/sdc1 or /dev/sdc2.

Does it matter that /boot is and ext3 filesystem?

Can I go ahead an copy /dev/sda info to /dev/sdc?

Peter

linuxonbute 11-26-2007 01:10 PM

I hope you don't mind me butting in but just before you go any further I think I should point out that swap space should probably be at most about twice the size of memory up to about 512 Meg not Gigabytes.
Otherwise you are just wasting disc space.

If you are leaving all the discs in then you can just have one small swap space.
Also just copying the files over will not be enough. You will need to edit some files.
If you delete what is on sda then it will not boot unless you do other things.

Why do you want to transfer everything over?

If you are leaving all discs there then you can simply create a new Data/Home etc partition on the new drive, copy the needed files across, edit /etc/fstab and you will have much more space with a lot less hastle.

phahn 11-26-2007 01:33 PM

Why I need 22GB of swap
 
Hi,

Thanks for asking.

Quote:

I think I should point out that swap space should probably be at most about twice the size of memory up to about 512 Meg not Gigabytes.
Otherwise you are just wasting disc space.
You are 100 percent correct. It happens that my PE7150 has 20 GB of RAM. And, I need every bit of swap space I can get for the calculations I am making.

Quote:

Also just copying the files over will not be enough. You will need to edit some files.
If you delete what is on sda then it will not boot unless you do other things.

Why do you want to transfer everything over?
I should have said "copy everything over" not "transfer everything over". /dev/sda is an 18GB disk and /dev/sdc is a 72GB disk. My plan is to make /dev/sdc into a bootable drive with all my data and experiments on it. /dev/sda would then become an unused archive. The disks are easily switched around, so I thought I could slide disk3 into position of disk1 and thus be able to boot from it (without too much trouble). Any advice would be appreciated.


Peter

linuxonbute 11-26-2007 04:37 PM

Quote:

Originally Posted by phahn (Post 2971394)
Hi,

Thanks for asking.



You are 100 percent correct. It happens that my PE7150 has 20 GB of RAM. And, I need every bit of swap space I can get for the calculations I am making.

Well your machine can handle up to 64Gig of Ram
If your calculations are that complex bear in mind that Ram is, I believe. about 100 times as fast as virtual Ram ( i.e your swap ) so you would do better to add extra Ram

Quote:

I should have said "copy everything over" not "transfer everything over". /dev/sda is an 18GB disk and /dev/sdc is a 72GB disk. My plan is to make /dev/sdc into a bootable drive with all my data and experiments on it. /dev/sda would then become an unused archive. The disks are easily switched around, so I thought I could slide disk3 into position of disk1 and thus be able to boot from it (without too much trouble). Any advice would be appreciated.


Peter
Probably so but you would still need to update the MBR on the disc that becomes sda because it would not boot from it.

I can't remember the exact code off the top of my head but don't forget you would need to use dd to copy the first sector of what is at present sda to the first sector of what is presently sdc BEFORE you swap them over otherwise it would not boot.
best wishes,
Norman

phahn 11-26-2007 06:01 PM

Still keeping fingers crossed that this will work
 
Hi Norman:

Quote:

If your calculations are that complex bear in mind that Ram is, I believe. about 100 times as fast as virtual Ram ( i.e your swap ) so you would do better to add extra Ram
My calculations sure are complex. These are optimization experiments. Runtime is not only valuable, but it is the measure of performance. So, I work hard to keep the memory requirement less than the available RAM. The reason for the large swap space is so that during a surge, the program does not crash. These experiments can take months. Even though I do checkpoints, time between checkpoints can be a week or more. I would hate to lose a week because the program crashed. Do you think I could get along with less than the recommended 22GB?

Quote:

I can't remember the exact code off the top of my head but don't forget you would need to use dd to copy the first sector of what is at present sda to the first sector of what is presently sdc BEFORE you swap them over otherwise it would not boot.
That is what I planned to do. I'm nervous about this because Linux is alien to me. I recently did a similar procedure on my Sun SB1000. But, I have been administering my personal Sun's for over 15 years. Though I have had the PE 7150 for six years, I have never really learned it.

How does this sequence of commands look?

# shutdown now (go to single user)(sda is mounted, sdc is not)
# dd if=/dev/sda1 of=/dev/sdc1 bs=128k
# fsck /dev/sdc1
# dd if=/dev/sda2 of=/dev/sdc2 bs=128k
# fsck /dev/sdc2
# shutdown -h now

switch drives and boot. Or, is it possible to use dump (which worked for me on Sun):

# shutdown now (go to single user)
# mount /dev/sdc1 /mnt
# ufsdump 0uf - /dev/sda1 | (cd /mnt;ufsrestore rvf -)
# umount /mnt
# fsck /dev/sdc1
# mount /dev/sdc2 /mnt
# ufsdump 0uf - /dev/sda2 | (cd /mnt;ufsrestore rvf -)
# umount /mnt
# fsck /dev/sdc2
# shutdown -h now

Will either of these take care of the master boot record? Or, will I have to do something in addition?

Best wishes,
Peter

Simon Bridge 11-26-2007 06:03 PM

Quote:

Originally Posted by linuxonbute
If your calculations are that complex bear in mind that Ram is, I believe. about 100 times as fast as virtual Ram ( i.e your swap ) so you would do better to add extra Ram

The calculation would be faster but much more expensive ... I've been in this position myself. "Better" is contingent.... I'll leave OP to explain in detail.

Quote:

Probably so but you would still need to update the MBR on the disc that becomes sda because it would not boot from it.
Part of the point of EFI/GPT is that you do not normally need to modify the MBR. The server may not follow the usual boot process. However - if it does use the normal process, you are correct.

Quote:

Does it matter that /boot is and ext3 filesystem?
Can I go ahead an copy /dev/sda info to /dev/sdc?
I doubt that it matters and you can copy files, sure. Don't erase the old drive until the new one is tested.

Quote:

/dev/sda1 /boot/efi vfat defaults 0 0
... note the "vfat" fs specified here? This means that the old efi partition was type "ef" in fdisk. You used "ee" for the new one. The ee type needs to be formatted, ef type gets fat32... this also tells you why explicitly formatting fat32 didn't work.

Your main issue copying the files will be that ext3 has permission-based access control, and fat32 dosn't. You may want to specify the uid and gid for the copied files, explicitly.

Note: you could have just added the drive to the existing one... you can also add extra partitions to your overall swap space or use swap files instead.

You may want to consider this post-migration - repartition the old drive for swap, and leave it in place. You get faster performance for processes that access swap and root a great deal (i.e. maths) as the heads don't have as far to move.

I've been in your position before, and I found it worked well to put /boot and swap on the small drive and use the big one for root. Of course, for me, that was 4gig and 8gig with RH9.

Quote:

It seems that fdisk -l gives me misleading information, because my machine is an Itanium-64.
Well done - shows what you can do.

Simon Bridge 11-26-2007 06:12 PM

Quote:

Do you think I could get along with less than the recommended 22GB?
Been there, done that - mine was QED - Optics and Solid State. What Norman suggests, though, is that if you can afford more RAM, add more RAM. The kernel's "swappiness" will handle much swap space is used. If you are using anything like the 11gig of original swap, you need a lot of swap. But with 11gig or RAM you won't need any you see?

You need to do a test run and keep a log of the useage statistics to be sure - find out how much the RAM and swap actually get used. Adjust accordingly. At the moment, your risc assessment/response seems reasonable for the equipment you have. But, if you double your RAM, you will be surprised at the performance boost.

BTW: you are planning to copy the MBR over directly? Why not just install the bootloader to the MBR? (dd is the usual method)


All times are GMT -5. The time now is 02:04 PM.