LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-25-2011, 06:50 AM   #1
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Rep: Reputation: Disabled
4K sector disk, need help cloning


Dear all,

I am a newbie with Linux but I have to clone a disk. I'm using Ubuntu 10.04.

The system is 4 years old and was using a 80gb disk with 512B sectors, and I would like to clone it before it's dead with a new disk, that has unfortunately 4K/sectors... I'm stuck there.
Do you know if there is a possibility to clone a 512b/sector disk with a 4K/sector disk?

Thank you!
 
Old 11-25-2011, 07:06 AM   #2
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 8
here is a good article on the 512->4096 sector evolution.
In particular, you want to take note that the OS provides a 512b emulation so the applications don't see the 4096
The underlying differences between the two physical disks should be hidden.

You could use plain old dd, but writing many 512b chunks would be inefficient so you should specify a block size of 4k (or multiples thereof).

I suggest you use ddrescue, which will copy/clone a disk and uses a default 65536b soft block size while copying. It has many additional features and can be more aggressive attempting to read/recover from a failing disk.

Good luck
 
1 members found this post helpful.
Old 11-25-2011, 08:42 AM   #3
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for your quick reply, I’m looking further for DDrescue.
But as I can’t even create a partition or a filesystem on the new disk because of the 4k sectors, I don’t see how it would help (using parted). I dont know how to deal with this.
 
Old 11-25-2011, 09:44 AM   #4
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
ok I am now cloning from the old 512B/sector disk to the new 4K/sector disk using ddrescue -n

but i still dont see how it will manage the partition table. I will come back to report when it’s finished.
thanks
 
Old 11-25-2011, 10:15 AM   #5
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 8
It (ddrescue) will copy the partition table block by block.

You'll have to fix the table afterwards.

I would take a look at gdisk rather than gnu parted, I've had better success with gdisk (since I prefer GPT partitions).
In the expert menu you can change sizes (carefully).

If this fails, and you have backup space, fsarchiver can archive entire filesystems into a file.
Then you create a new MBR or GPT, partition as you see fit and then restore from the fsarchived file.
eg
Code:
fsarchive savefs /path2storeage/backup-2011-11-25.gpt /dev/sda1 /dev/sda2
install new disk, make new partions
Code:
fsarchive restfs /path2storeage/backup-2011-11-25.gpt id=0,dest=/dev/sda1,mkfs=ext3 id=1,dest=/dev/sda2,mkfs=btrfs
Code:
fsarchive -h
shows lots of examples of its usage
 
Old 11-28-2011, 03:55 AM   #6
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
So i did a ddrescue of the 80gb 512b/sector to a 250gb 4k/sector disk.
Then if i check it I have :

Command (? for help): i
Using 1
Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Linux/Windows data)
Partition unique GUID: BE9C9B24-3F2F-2874-8B96-348890A5EA06
First sector: 63 (at 252.0 KiB)
Last sector: 32129999 (at 122.6 GiB)
Partition size: 32129937 sectors (122.6 GiB)
Attribute flags: 0000000000000000
Partition name: Linux/Windows data

One partition of 122gb? But the source disk is 80gb...

Also when I start gdisk it says :
GPT fdisk (gdisk) version 0.5.1

WARNING! Sector size is not 512 bytes! This program is likely to misbehave!
Proceed at your own risk!

Partition table scan:
WARNING! Sector size is not 512 bytes! This program is likely to misbehave!
Proceed at your own risk!
 
Old 11-28-2011, 04:02 AM   #7
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
So I think I will try your second option and start backing up to a file.
The problem is still I don't know how to create a partition table on this 4K/sector disk...

About fsarchiver, the disk has an extended partition sda2, which has inside sda5 as the swap and sda6 ext3. Should I archiver sda1 and sda2 or sda1 and sda6 ?

Thanks a lot for your help.

Last edited by pantronic; 11-28-2011 at 04:28 AM.
 
Old 11-28-2011, 06:29 AM   #8
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 8
could you please post
Code:
fdisk -l /dev/sda
along with distro you're using
your level of comfort with a chroot style repair
Is this machine dual booted with windows?

Last edited by _bsd; 11-28-2011 at 06:31 AM.
 
Old 11-28-2011, 06:46 AM   #9
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 8
I ask because you no longer need to use extended partitions.
If you use gdisk or gnu parted you can create GPT style partions and have up to 128 primary partitions, HOWEVER to change from one style partition table to the other is medium level linux. All the partitions will get new GUID and you'll need to boot from a livecd or sysrescuecd (good to learn). You'll have to fix grub, and /etc/fstab at a minimum. I do it regularly, cloning disks, etc but you can just as easily ruin an installation if you don't have the skills. There are many online tutorials, but it's not an entry level task. Don't let that scare you, it's worth the effort.

I previously suggested ddrescue because you indicated the primary disk was failing. In that case it's more important to copy the data to a good disk, then work with the good disk to restore the OS. It depends on how many spare disks you have lying around.

Read up on fsarchiver
and if you're interested GPT partitions
general backup/restore
 
Old 11-28-2011, 09:23 AM   #10
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
I am using a laptop with Ubuntu 10.04LTS, no dual boot.
My goal is to clone a hard-drive 80gb that comes with a system I bought 5 years ago, but not supported anymore as the company's closed. So I have the old disk and the new one connected with USB adapters to my laptop.

Old disk :

Disque /dev/sdb: 80.0 Go, 80026361856 octets
255 têtes, 63 secteurs/piste, 9729 cylindres
Unités = cylindres de 16065 * 512 = 8225280 octets
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identifiant de disque : 0x00000000

Périphérique Amorce Début Fin Blocs Id Système
/dev/sdb1 * 1 2000 16064968+ 83 Linux
/dev/sdb2 2001 9729 62083192+ 5 Etendue
/dev/sdb5 2001 2128 1028128+ 82 Linux swap / Solaris
/dev/sdb6 2129 9729 61055001 83 Linux

New disk :

Note: taille de secteur 4096 (et non pas 512)

Disque /dev/sdc: 250.1 Go, 250059350016 octets
255 têtes, 63 secteurs/piste, 3800 cylindres
Unités = cylindres de 16065 * 4096 = 65802240 octets
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Identifiant de disque : 0x000af53d

Périphérique Amorce Début Fin Blocs Id Système


I am just a basic user, but I can follow a tutorial... It's just this 4K sector disk that annoys me.
So I backed up the old disk with fsarchiver. Now I'm going to read your links to learn how to work with a 4K/sector disk. Usually I use the DiskTool from Ubuntu, but it doesnt work with this disk since it's 4K.
 
Old 11-28-2011, 09:31 AM   #11
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
I have to tell you that I don't have root access to that old system, this is also why I need to clone it before the disk is completely dead.
I already tried with Clonezilla, but it fails to restore the backupb because it fails to create a partition table on the new 4K/sector disk... I could try with SystemRescueCD also.
 
Old 11-28-2011, 09:56 AM   #12
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 8
you claim to not have root access, so, yes use sysrescuecd and fsarchiver, archive all partitions individually.

This will ensure you have your data from the old disk, partition by partition, and stored to a safe place.

I would recreate partitions using gdisk, follow a tutorial that includes the necessary chroot and editing of /etc/fstab

(feel free to email me off the thread if you need to)
 
Old 11-29-2011, 04:02 AM   #13
pantronic
LQ Newbie
 
Registered: Nov 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thx a lot for your help ! Following the links you gave me, I anderstood that I needed to update my distribution cause my partition tools were too old to manage the 4k/sectors disk...
So it means Clonezilla is outdated as it doenst manage such disks. I am wondering if RescueDisc is outdated too.

With parted updated I am now able to create the partition table and I am confident I will be able to restore everything easily

Thanks a lot for your help!
 
Old 11-29-2011, 06:14 AM   #14
_bsd
Member
 
Registered: Jan 2010
Location: Velveeta, USA
Distribution: Xen, Gentoo,Ubuntu,openSUSE,Debian,pfSense
Posts: 98

Rep: Reputation: 8
SysRescueCD is not outdated, it's updated regularly and a very useful linux recovery tool to have in your arsenal.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk cloning Diggy Linux - Software 12 01-28-2009 04:44 PM
disk/system cloning Sharaz Linux - General 2 12-28-2005 04:11 PM
Disk cloning question valnar Linux - Software 4 06-07-2005 03:41 PM
cloning disk using cp - no special devices for target disk vulture99 Linux - General 6 05-08-2005 06:36 PM
Disk Cloning sts_cat Linux - General 1 03-25-2003 12:30 AM


All times are GMT -5. The time now is 02:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration