VectorLinux
July 31, 2014, 05:21:42 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Transferring VL installation to a new hard drive  (Read 4755 times)
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« on: May 27, 2007, 08:23:28 pm »

In a couple of days I'll be replacing a 200-gig PATA internal drive with a 500-gig PATA drive. My VectorLinux partition on that drive is about 11 gigs. On the new drive it will be 100 gigs. The old drive is fine, by the way. I just need more room. The Windows partitions on the drive hold just data, not the operating system. They are Drive H and Drive I in Windows.

The new drive will have 100 gigs for VL 5.8 Standard, about 500 megs for a swap partition, about 150 gigs in FAT32 for photos and music files shared with Windows, and the remaining space in NTFS for videos and video editing. I have the same arrangement now, but the partitions are smaller and the photo and music drive is NTFS.

My plan is to copy all the NTFS data to an external hard drive formatted with NTFS and using the Beryl LiveCD, copy the contents of /dev/hdd8 to an ext2 partition on an external hard drive. I'll then swap the old drive with the new one. I'll set up and format the FAT32 and NTFS partitions on the new drive with Partition Commander and copy the Windows data from the external hard drive to the new Windows partitions. Next I'll reboot with the 5.8 Beryl LiveCD, use cfdisk to create the Linux swap file and the VectorLinux partition (all on /, no separate /home) on the new drive, and format with mkfs.reiserfs.

I'll copy the data from the Linux external drive back to the new /dev/hdd8 and reboot.

Will this work? If I booted with the Live CD and highlighted all the directories in the mounted /dev/hdd8 in a file manager and copied them to /mnt/vl-hot/sdf/vol6 (the external drive), would file ownership and attributes be maintained? The target partition is ext2. I'm not good at command-line stuff, but in looking at man cp, I thought this command might do what I want:
cp -pr /mnt/hdd8 /mnt/vl-hot/sdf/vol6

I've already checked /mnt/hdd8 while I'm running the Beryl LiveCD and there is nothing in /mnt/hdd8's /mnt directory or in its /proc directory. I do want symlinks to be copied, but all symlinks on /dev/hdd8 point to files on /dev/hdd8.

Would
dd if=/dev/hdd8 of=/dev/whatever/mnt/vl-hot-/sdf/vol6is
be better? I forgot to see what /dev the external drive is recognized as, but can check that tomorrow. I have a vague memory of something to be aware of if the source and the destination partitions are different sizes. Am I confused?

I've read man pages for dd and cp and info dd, but it's WAY too techie for me and I can't make heads or tails of it.

What I want is an exact copy of everything in my 11-gig VL partition on /dev/hdd8 so it'll be restored exactly to the new 100-gig VL partition, ownership, permissions, dates, and symlinks intact. There'll be a lot more empty space, though, after the files are copied back.
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
uelsk8s
Administrator
Vectorian
*****
Posts: 2504



« Reply #1 on: May 27, 2007, 08:30:20 pm »

cp -ax /mnt/hdd8/* /mnt/vl-hot/sdf/vol6
is what I would use.
It has worked for me in the past.

Uelsk8s
Logged
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« Reply #2 on: May 27, 2007, 09:53:39 pm »

Thanks! That looks easy enough. Do I understand cp -ax correctly?
copy no-dereference, preserve links, preserve mode, ownership, time stamps, recursive, one-file-system

I am so excited at the prospect of having 100 gigs for VectorLinux!
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
Pita
Vectorian
****
Posts: 1308


« Reply #3 on: May 28, 2007, 01:47:21 am »

What I have been using for years is as a small script in ~/bin

#!/bin/sh
tar -C "$1" -cO . | tar -C "$2" -xpf -

$1=dir to move, $2 dir to move to

I name the file(script) tartar.

BTW it not my brain child.

Regards
Logged
uelsk8s
Administrator
Vectorian
*****
Posts: 2504



« Reply #4 on: May 28, 2007, 05:27:47 am »

Thanks! That looks easy enough. Do I understand cp -ax correctly?
copy no-dereference, preserve links, preserve mode, ownership, time stamps, recursive, one-file-system

I am so excited at the prospect of having 100 gigs for VectorLinux!
--GrannyGeek
Yep you understand it perfectly.
Logged
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« Reply #5 on: May 28, 2007, 07:37:02 am »

What I have been using for years is as a small script in ~/bin

#!/bin/sh
tar -C "$1" -cO . | tar -C "$2" -xpf -

$1=dir to move, $2 dir to move to

Thanks. I have copied the script sample to my Tuxcards Linux tips file. I'll  check man tar in hopes I can figure out what the script will actually do. Does it copy recursively? That is, if I put
tar -C "/mnt/hdd8/"
as the directory to copy, would it copy all the directories under / ?
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
Pita
Vectorian
****
Posts: 1308


« Reply #6 on: May 28, 2007, 06:44:37 pm »

Quote

Does it copy recursively? That is, if I put
tar -C "/mnt/hdd8/"
as the directory to copy, would it copy all the directories under / ?
--GrannyGeek

Yes it does. I just copied my entire /home partition to a new partion for more space; "tartar /home /mnt/hda7"
Logged
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« Reply #7 on: May 28, 2007, 06:47:23 pm »

Thanks for the confirmation on recursive copying.
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« Reply #8 on: May 31, 2007, 08:34:20 pm »

I've installed the new 500-gig drive and have successfully restored my VectorLinux installation. I used
dd if=/dev/hdd8 of=/dev/vl-hot/sdf/vol6/vl58
for copying the old partition and restored by reversing "if" and "of".

I have one problem that I hope is solvable. Although cfdisk reports my /dev/hdd8 partition (reiserfs) as almost 140 gigs, df -h reports the partition as 11 gigs, with 2.5 gigs free. When I try to boot with LILO, I get half a screen of 99 99 99 etc. 11 gigs was the size of my old partition, but it is now almost 140 gigs. I suspect there is information in vmlinuz or system.map in the /boot directory that is held over from the old partition.

Is there a way I can change something so the partition size shows correctly? I suspect this would fix LILO, too. Right now I have to boot with the CD (linux root=/dev/hdd8 ro).
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
Triarius Fidelis
Vecteloper
Vectorian
****
Posts: 2399


Domine, exaudi vocem meam


WWW
« Reply #9 on: May 31, 2007, 11:38:11 pm »

I'm not sure dd is the correct tool for the task at hand, because the partition sizes aren't the same. dd, as I've used it, is generally for copying a unit of data into another unit of data the same size. Because you want to claim the whole partition, you'll need to format it and copy everything over.
Logged

"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months
stoichyu
Packager
Vectorite
****
Posts: 369



« Reply #10 on: June 01, 2007, 12:41:43 am »

I think dd copied over the ext2 file table (if there is something like that) so it thinks there is only 11 gigs of space in the partition. Maybe e2fsck or parted can do something to fix it. Although, I wouldn't recommend doing it without a backup. I once wiped my whole hard drive with parted.
Logged

There's no place like ~.
VL 5.8 PentiumD 2.8Ghz Registered Linux User #432836
Triarius Fidelis
Vecteloper
Vectorian
****
Posts: 2399


Domine, exaudi vocem meam


WWW
« Reply #11 on: June 01, 2007, 12:48:07 am »

I think dd copied over the ext2 file table (if there is something like that) so it thinks there is only 11 gigs of space in the partition. Maybe e2fsck or parted can do something to fix it. Although, I wouldn't recommend doing it without a backup. I once wiped my whole hard drive with parted.

Always good to write down your partition table on paper before you do anything to it.

In any case, a full-fledged formatting of the partition seems the best idea.
Logged

"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months
GrannyGeek
Packager
Vectorian
****
Posts: 2567


« Reply #12 on: June 01, 2007, 10:15:50 am »

Thanks for the suggestions. I'm happy to report that everything is now as it should be and I'm able to boot into VL from the NT boot loader, as I did before I changed from a 200-gig hard drive to a 500-gig drive.

What I did was boot from the Vector Beryl LiveCD, use gparted to delete the /dev/hdd8 partition, make a new /dev/hdd8 partition, and format it as reiserfs. Then I rebooted with the Beryl CD and as root copied the partition's files from my backup external drive on /mnt/vl-hot/sdf/vol6 to /mnt/hdd8 with this command:
cp -ax /mnt/vl-hot/sdf/vol6/* /mnt/hdd8

as suggested by Uelsk8s earlier in this topic (I used the same command to copy the files originally from hdd8 to the external drive). The partition on the external drive is formatted with a Linux file system, by the way--I can't remember if it's ext2 or reiserfs. If you don't copy to a Linux file system your ownerships and permissions will get messed up big time unless you tar the files.

I had to use my VL Standard CD to boot into the newly copied installation. I had to redo LILO in order to make a bootsect.lnx file that would work from the NT loader on my XP partition (which is on a different hard drive, by the way). Once I did that and copied the bootsect.lnx file into C:\ on my XP partition, I was able to boot into Linux without using the CD. df -h is now showing a nice 135 gig partition for VL. Sweet!

I guess dd would be good for making an image of your Linux partition for backup purposes. As long as you restored to the same partition (or one of equal size) everything should be okay. Do note my "belt and suspenders" approach.<g> I both copied the files in a way that would maintain ownership and permissions AND make an image with dd. I figured that if one didn't work, the other would.

A couple of things I discovered that may help out others who want to do the same thing:
*  If you boot with the LiveCD in order to copy the partition's files to another drive (external hard drive here), you must first delete the vl user and then add a user account under the same name you use for your "real" Linux partition. If you don't add your user name to the accounts (I used VASM), the ownership of files that belong to your user account on the partition you're copying will be changed to vl. NOT what you want to happen. Obviously (or not, depending on how familiar you are with Linux), you should not be copying a currently active partition, that is, you shouldn't boot into your usual Linux on the hard drive and try to copy it to an external drive with the intent of restoring it later. Hence the LiveCD. You do the copying as root but you need a user account on the LiveCD with the same name and user ID as your "real" user account (I'm guessing about the user ID part, but why take a chance?).

*  Once the files are all in place on the new partition and you boot into that partition, you need to make a new LILO. I used VASM for that. You can boot from a normal VectorLinux installation CD.

*  I believe it's necessary to mark your partition as bootable even if you're booting from a boot loader that chains to LILO on your Linux partition. I did this with cfdisk. /dev/hdd8 is on a second hard drive that is all one extended partition, but the logical partition /dev/hdd8 is marked as bootable.

If anyone's knowledge or experience contradicts those points, please do correct what I said.

Anyway, all is well and I'm *really* looking forward to having over 130 gigs of space for Linux (plus 160 gigs of FAT32 space on which I share photos and music files with Windows).

Thanks to all for your help!
--GrannyGeek
Logged

Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!