How to change out a drive

My current system:

Dual boot openSuse 13.1 and openSuse 12.3

sda SSD
sda1 300 MB - FAT - no label - mounted as /boot/efi
sda2 55 GB - ext4 - suse131-root - mounted as /
sda3 55 GB - ext4 - suse123-root - not mounted now

sdb mechanical
sdb1 31 GB - swap - swap - mounted as swap
sbd2 31 GB - ext4 - suse131-tmp - mounted as /tmp
sdb3 31 GB - ext4 - suse131-var - mounted as /var
sbd4 850 GB - ext4 - suse131-home - mounted as /home
sbd5 32 GB - ext4 - suse123-tmp -
sbd6 32 GB - ext4 - suse123-var -
sbd7 855 GB - ext4 - suse123-home -

fstab is using /dev/disk/by-path/pci-0000:00:11.0-scsi-X:0:0:0:0-partX. I would be careful to create the first 4 matching partitions in the same order.

Reason for my thread: sdb4 has come up with 2 corrupted files. I no longer trust it.

What I want to do: (obviously) replace sdb with a new drive.

Specifics: sdb is currently a Seagate Barracuda 2 TB drive, relatively new, but as I said showing file corruption. I have purchased a Western Digital VelociRaptor 1 TB drive which is rated as a continuous duty, 10,000 rpm long life drive.

Related information: I no longer need the copy of openSuse 12.3 and not interested in preserving it during this operation.

My question: Can (should) I use dd to copy the files from the wanted partitions on the old drive to the matching partitions on the new drive? What if the partitions on the new drive end up slightly smaller than the partitions on the old drive? The man page for dd is… ah… complex. I’m concerned about making a wrong choice.

or

Should I boot a live copy, mount the two drives, partition the new one, and simply copy the contents from the old to the new?

When I’m done, I intend to simply delete the files in sda3, and run grub2-install to correct the boot menu.

Opinion solicited: Is there a better way to set up my system to allow this sort of change to be made?

I know I could, and maybe should, just try different ways to do this. I might even learn something. But, with 140 GB of “stuff” on my system, hours and hours of configuration to get things just the way I want, the desire to have my system up and running, and 55 to 60 hours a week devoted to my job, I’m taking the quick way out and asking for help.

Bart

Hi
How much system RAM? I use 8GB with an ssd and have yet to use swap…

If it were me, I would use the 1TB drive as a /data type gpt partition, then delete sda3 and expand sda2 to use it all including a /home

I wouldn’t even worry about /tmp etc it doesn’t write that much. This is a busy machine and on average I write 6.5GB of data to the ssd per day and it’s rated at 20GB per day and a 5 year warranty.

Wipe the old 2TB drive and use that for a backup device…

I recommend the openSUSE 13.1 rescue cd to boot from and use gparted to prepare/modify the partitions.

io scheduling with the two drives probably needs to be investigated as well.

On 2014-03-29 02:46, montana suse user wrote:

> Reason for my thread: sdb4 has come up with 2 corrupted files. I no
> longer trust it.

What say SMART? Did you run the long test?

> Should I boot a live copy, mount the two drives, partition the new one,
> and simply copy the contents from the old to the new?

As the partitions of that disk are data only, I would do a file by copy,
yes.

I did this recently. I use rsync with checksum verification, using the
normal system at the same time I use it. Twice (the second run is for
verification).


> PARAMETROS="--archive --sparse --one-file-system --acls --xattrs --hard-links --stats --human-readable --checksum"
> time rsync $PARAMETROS  /SOURCE/DIR_1/ /DEST/MGR/DIR_1

Then I boot the live system, and run rsync a third time, but this time
without checksum, and with --del.


> PARAMETROS="--archive --sparse --one-file-system --acls --xattrs --hard-links --stats --human-readable --del"
> time rsync $PARAMETROS  /SOURCE/DIR_1/ /DEST/MGR/DIR_1

This third time is to copy only the last files that changed while I was
usint the computer and doing the main copy. Without checksum it runs
fast, and deletes the files that were deleted on the source.

Be careful with “–del”, if you mistake the paths it can delete
everything on the target.

> When I’m done, I intend to simply delete the files in sda3, and run
> grub2-install to correct the boot menu.

There are no changes to grub, I understand. Only sda is affected.

You only need mkinitrd, after changing fstab.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

32GB Why so much? I just don’t like empty slots. They get full of dust! :slight_smile:
So I can just not create / use a swap partition?

If it were me, I would use the 1TB drive as a /data type gpt partition, then delete sda3 and expand sda2 to use it all including a /home

You say “a home”. From /home/bart on this machine, I have 140 GB of data. My home wouldn’t fit on the SSD.
Then again, I “may” want to add another OS in the future. I can add another mechanical drive and use sad3 for it. I’m curious about Magia (sp?)

I wouldn’t even worry about /tmp etc it doesn’t write that much. This is a busy machine and on average I write 6.5GB of data to the ssd per day and it’s rated at 20GB per day and a 5 year warranty.

That’s kind of what I thought. I just set it up on the mechanical drive because I had plenty of room and just tried to limit, as much as possible, writing to the SSD. It gets enough with the security fixes and all.

Wipe the old 2TB drive and use that for a backup device…

I may just put it in an old machine and stress test it. It may just be a one time thing, it may have been something else that corrupted that file, it may be a bad drive. If it turns out a good drive, I’ll give it away. I no longer feel comfortable with it around even if tests prove it good. Just one of my “things” I guess.

I recommend the openSUSE 13.1 rescue cd to boot from and use gparted to prepare/modify the partitions.

I’ll follow those recommendations!

io scheduling with the two drives probably needs to be investigated as well.

???

Thanks for your time!

On 2014-03-29 03:06, malcolmlewis wrote:
> Hi
> How much system RAM? I use 8GB with an ssd and have yet to use
> swap…


> cer@Telcontar:~> free -h
>              total       used       free     shared    buffers     cached
> Mem:          7,8G       7,6G       243M       116M        73M       5,4G
> -/+ buffers/cache:       2,1G       5,7G
> Swap:          20G       2,1G        18G
> cer@Telcontar:~>

As you see, I have 8 GiB and I do use swap.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Now, That is an elegant and secure way of doing it! Regarding the paths, would your example /SOURCE/DIR_1/ be
“/home” (which is the partition mount point) or “sdb4” which is the partition?

When this is all done, the old drive removed and the new one in, the drive should match the entries in fstab. That is, the partitions will be created on the new drive in the same order as the old drive and so should be recognized as not changed. At least that was my intention when creating fstab. The grub2-install was to eliminate the openSuse 12.3 choice in the boot menu.

Hi
My /home hardly gets used, for example multimedia, videos etc are on /data with softlinks to Music Videos Pictures etc Most of my files sit on a flle server (1TB RAID 10 setup), just stuff I use in common go on /data it helps if your wanting to multiboot so you can share common files.

On the file server empty slots have covers on the ram, pci and pci-e slots :wink:

Because you have an SSD and a rotating drive you can setup the i/o scheduling on the individual devices since I have just an SSD the elevator is set to noop.

Short test says no errors. Didn’t run long test. Perhaps I will after the change. I can just plug this drive in and run the test on the drive assigned without mounting it, right?

On 2014-03-29 03:56, montana suse user wrote:

> Now, That is an elegant and secure way of doing it! Regarding the
> paths, would your example /SOURCE/DIR_1/ be
> “/home” (which is the partition mount point) or “sdb4” which is the
> partition?

The mount point.

> When this is all done, the old drive removed and the new one in, the
> drive should match the entries in fstab. That is, the partitions will
> be created on the new drive in the same order as the old drive and so
> should be recognized as not changed. At least that was my intention
> when creating fstab.

Well, in my case, it does not matter at all, because I mount using labels.

Correction: it does not matter in any case, as long as you create the
correct entries in fstab. The system does not see partitions, it sees
mounted filesystems. It does not matter where they are on the disk, or
disks.

As a matter of fact, my destination drive has more partitions, and I
split some of my source paths over different destination partitions.

> The grub2-install was to eliminate the openSuse
> 12.3 choice in the boot menu.

Ah, well… I split dangerous operations. First one, check, then the
other. :wink:


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Then I would mount the new drive partition and use that point as the destination?

> When this is all done, the old drive removed and the new one in, the
> drive should match the entries in fstab. That is, the partitions will
> be created on the new drive in the same order as the old drive and so
> should be recognized as not changed. At least that was my intention
> when creating fstab.

Well, in my case, it does not matter at all, because I mount using labels.

Correction: it does not matter in any case, as long as you create the
correct entries in fstab. The system does not see partitions, it sees
mounted filesystems. It does not matter where they are on the disk, or
disks.

As a matter of fact, my destination drive has more partitions, and I
split some of my source paths over different destination partitions.

Would you post a sample line from your fstab? I would like to use labels as I think it would be easier for changes and even clearer as to what is what.

> The grub2-install was to eliminate the openSuse
> 12.3 choice in the boot menu.

Ah, well… I split dangerous operations. First one, check, then the
other. :wink:


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Ah yes! Although I didn’t say so, that is what I had in mind.

Bart

I am up and running with the new drive!

Robin, you method worked extremely well! Thank you! It’s the first time I’ve seen all eight cores working at 50%! It was quite impressive!

Malcom, I’m taking your suggestions into consideration. This is a home system, and my wife doesn’t want another computer running constantly, so I hooked an SSD to my router’s USB port and am using it as a file server. It works for what we need to transfer between her system and mine.

Thanks to you both! This thread, although probably not sticky worthy, is one that I think others will find useful. I have printed it and will keep it in my “Reference Notebook”

This was a good night!

Bart

On 2014-03-29 04:16, montana suse user wrote:

> Short test says no errors. Didn’t run long test. Perhaps I will after
> the change. I can just plug this drive in and run the test on the drive
> assigned without mounting it, right?

Right.

I always run a long test on new disks before formatting them. Sometimes
I also do a write test on them, filling them completely with zeroes,
then running the smart long test.

Paranoid? No… I have been bitten more than once.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Do you know how does badblocks stand vs. long test?

badblocks scans the whole disc, is very thorough, but it doesn’t cause the head to jump from track to track in arbitrary manner. Hence, the hard drive is in an easier working mode while under badblocks’ check, in my opinion.

On 2014-03-29 08:26, montana suse user wrote:
>
> I am up and running with the new drive!
>
> Robin, you method worked extremely well! Thank you! It’s the first
> time I’ve seen all eight cores working at 50%! It was quite impressive!

:slight_smile:

Then you did not need answers for the other questions. I was sleeping at
the time :slight_smile:

Say, that I want to replicate /home, /var, /tmp. So the sources are
/home, /var, /tmp. I mount the destination drive, with three partitions
in /dest/home, /dest/var, /dest/tmp

Then I can launch three rsync runs in succession. I do a script, so that
the three runs go without waiting for me.

And I prepare another script to do it all in the live system, including
the mount commands. In that case, I mount the two drive as:

/JOB/src/home, /JOB/src/var, /JOB/src/tmp

and

/JOB/dest/home, /JOB/dest/var, /JOB/dest/tmp

everything neat :slight_smile:

You could trigger rsync jobs in parallel. But if you see the hard disks
working at near 100 MB/s, it is no use. Even with much less, seeking for
individual files is taxing. Rsync is slower than a dd or dump.

An fstab entry using labels:


LABEL=a_main  /  ext4  acl,user_xattr,relatime   1 1

You can also use the “UUID=…” syntax. See man fstab. I see two new
additions, PARTUUID and PARTLABEL, new additions of the GPT partition
table. But “ID” does not exist.

> Malcom, I’m taking your suggestions into consideration. This is a home
> system, and my wife doesn’t want another computer running constantly, so
> I hooked an SSD to my router’s USB port and am using it as a file
> server. It works for what we need to transfer between her system and
> mine.

He, routers are getting new uses these days. Mine has that capability, too.

I use an old laptop for low cpu tasks that need running 24 hours, with
an external drive via usb. Cheap.

>
> Thanks to you both! This thread, although probably not sticky worthy,
> is one that I think others will find useful. I have printed it and will
> keep it in my “Reference Notebook”
>
> This was a good night!

Welcome!


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

On 2014-03-29 13:26, ZStefan wrote:
>
> robin_listas;2633770 Wrote:
>>
>> I always run a long test on new disks before formatting them. Sometimes
>> I also do a write test on them, filling them completely with zeroes,
>> then running the smart long test.
>>
>
> Do you know how does badblocks stand vs. long test?
>
> badblocks scans the whole disc, is very thorough, but it doesn’t cause
> the head to jump from track to track in arbitrary manner. Hence, the
> hard drive is in an easier working mode while under badblocks’ check, in
> my opinion.

But badblocks doesn’t see the whole picture. It can say there are no bad
blocks, when there are many.

Remember that bad blocks are mapped out by the hard disk firmware,
replaced (on write) with new blocks from a pool set aside by the
manufacturer. This is transparent to the computer, so that the computer
doesn’t see the bad blocks at all, the disk appears completely healthy
to the bad block test.

Only when you query the SMART log, you see how many such blocks were
remapped.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)