Moving opensuse from one hard disk to another

Hello everyone,

Recently I was working on something on my windows partition (on the same HD as opensuse), and all the sudden windows stopped working and I got some bad sectors on my HD.

Now, my opensuse installation is on the same HD as windows, but I need to get rid of that HD soon because it’s starting to get worse (and I think opensuse is randomly crashing because of it).

Is there any way to transfer my opensuse parititon/os to another hard drive?

you can create a partition with the same size on anoter harddisk an use ‘dd’ under Linux to copy it sector by sector.
Example : dd if=/dev/sda2 of=/dev/sdb2
Assuming your original Linux is on sda2 and you want to copy it on sdb2. But … Don’t do it the wrong way !!!
It can (and it probably will) take hours.
Or you can copy/archive all the files, provided you preserve their ownership and access rights.
You might have to edit /boot/grub/menu.lst on your second HD if you want to boot from that one as well as install grub in your second HD mbr.

Thanks for the advice please_try_again :slight_smile: As soon as I get GParted to work I’ll do that

You can also use Partedmagic

Meh, I ended up using the console to partition everything.

I had the worst luck though, about 2 hours into using ‘dd’ I had a power outage that lasted forever :\

Everything seemed right last time though, so I’m guessing it will work this time :slight_smile:

Alright! It finally worked :slight_smile: But now opensuse keeps mounting the old hard drive for its filesystem. I changed /etc/fstab but my computer still says the old hd is mounted to / :expressionless:

Anyone know how to fix that?

The system mounts at boot whatever it finds in /etc/fstab .

Did you adapt the /dev/disk/by-ids? Might be useful if you’d post the fstab.

Here’s my fstab:



/dev/disk/by-id/ata-ST3500410AS_6VM0A950-part1 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-ST3500410AS_6VM0A950-part2 /		     ext4       acl,user_xattr        1 1
/dev/disk/by-id/ata-ST3500320AS_9QM0JTS1-part2 /windows/C           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

/dev/disk/by-id/ata-ST3500320AS_9QM0JTS1-part1 (/dev/sdb1) was the old filesystem and I changed it to /dev/disk/by-id/ata-ST3500410AS_6VM0A950-part2 (/dev/sda2)

edit: Also, I tried mounting the old fs and when I tried umount it wouldn’t let me. So here’s some more info


#fuser /mnt/linux
/mnt/linux:              1rc     2rc     3rc     4rc     5rc     6rc     7rc     8rc     9rc    10rc    11rc    12rc    13rc    14rc    15rc    16rc    17rc    18rc    19rc    20rc    21rc    22rc    23rc    24rc    27rc    28rc    29rc    30rc    31rc    32rc    33rc    34rc    35rc    36rc    38rc    39rc   224rc   225rc   226rc   233rc   244rc   246rc   249rc   250rc   345rc   346rc   347rc   353rc   439rc   644rc   715rc   729rc   780rc  1225rc  1303rc  1654rc  1671rc  1724rc  1725rc  1727rc  1729rc  1794rc  1827r  1847r  1848r  1852rc  1860r  1905r  1961rc  1962rc  2643rc  2729r  3056rc  3057rc  3064r  3065r  3073r  3075r  3110rc  3117rc  3145r  3146r  3155r  3180r  3196r  3198r  3244r  3274r  3293r  3294r  3302r  3310r  3311r  3312r  3333rc  3809rc  3853rc  3860rc  3888rc  3910rc  3911rc  4034rc  4041rc  4044rc  4122rc  4259r  4462r  4597r  4633r  4637r  4642r  4650rc  4763rc  4764rc  4765rc  4766rc  4767rc  4768rc  4814r  4817r  4995r  5016r  5032r  5128r  8013r  8015r  8027rc  8030rc  8184r  8291r


#lsof /mnt/linux
/lib64/libkdecore.so.5.4.0
kio_thumb 8291      froid  mem    REG               8,17    149975 13762856 /lib64/ld-2.11.2.so
kio_thumb 8291      froid  mem    REG               8,17    378580 13631964 /var/cache/libx11/compose/l4_030_313cb605_00280cc0
kio_thumb 8291      froid  mem    REG               8,17    256324  7996678 /usr/lib/locale/en_US.utf8/LC_CTYPE
kio_thumb 8291      froid  mem    REG               8,17   1163682  7996682 /usr/lib/locale/en_US.utf8/LC_COLLATE
kio_thumb 8291      froid  mem    REG               8,17        54  7996751 /usr/lib/locale/en_US.utf8/LC_NUMERIC
kio_thumb 8291      froid  mem    REG               8,17      2454  8130303 /usr/lib/locale/en_US.utf8/LC_TIME
kio_thumb 8291      froid  mem    REG               8,17       286  8130302 /usr/lib/locale/en_US.utf8/LC_MONETARY
kio_thumb 8291      froid  mem    REG               8,17        57  7996886 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
kio_thumb 8291      froid  mem    REG               8,17        34  7996675 /usr/lib/locale/en_US.utf8/LC_PAPER
kio_thumb 8291      froid  mem    REG               8,17        77  7996707 /usr/lib/locale/en_US.utf8/LC_NAME
kio_thumb 8291      froid  mem    REG               8,17       155  8128150 /usr/lib/locale/en_US.utf8/LC_ADDRESS
kio_thumb 8291      froid  mem    REG               8,17        59  7996866 /usr/lib/locale/en_US.utf8/LC_TELEPHONE
kio_thumb 8291      froid  mem    REG               8,17        23  7996717 /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
kio_thumb 8291      froid  mem    REG               8,17     26050  9318051 /usr/lib64/gconv/gconv-modules.cache
kio_thumb 8291      froid  mem    REG               8,17       373  8130301 /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
kio_thumb 8291      froid    1w   REG               8,17     75992  1049064 /home/froid/.xsession-errors
kio_thumb 8291      froid    2w   REG               8,17     75992  1049064 /home/froid/.xsession-errors
kio_thumb 8291      froid   10r   REG               8,17   1886731 13632466 /var/tmp/kdecache-froid/ksycoca4
lsof      8296       root  cwd    DIR               8,17      4096        2 /mnt/linux
lsof      8296       root  rtd    DIR               8,17      4096        2 /
lsof      8296       root  txt    REG               8,17    139704  7865505 /usr/bin/lsof
lsof      8296       root  mem    REG               8,17     19114 13762616 /lib64/libdl-2.11.2.so
lsof      8296       root  mem    REG               8,17   1670469 13762716 /lib64/libc-2.11.2.so
lsof      8296       root  mem    REG               8,17    122160 13762615 /lib64/libselinux.so.1
lsof      8296       root  mem    REG               8,17    149975 13762856 /lib64/ld-2.11.2.so
lsof      8296       root  mem    REG               8,17    256324  7996678 /usr/lib/locale/en_US.utf8/LC_CTYPE
lsof      8296       root  mem    REG               8,17     26050  9318051 /usr/lib64/gconv/gconv-modules.cache
lsof      8297       root  cwd    DIR               8,17      4096        2 /mnt/linux
lsof      8297       root  rtd    DIR               8,17      4096        2 /
lsof      8297       root  txt    REG               8,17    139704  7865505 /usr/bin/lsof
lsof      8297       root  mem    REG               8,17     19114 13762616 /lib64/libdl-2.11.2.so
lsof      8297       root  mem    REG               8,17   1670469 13762716 /lib64/libc-2.11.2.so
lsof      8297       root  mem    REG               8,17    122160 13762615 /lib64/libselinux.so.1
lsof      8297       root  mem    REG               8,17    149975 13762856 /lib64/ld-2.11.2.so
lsof      8297       root  mem    REG               8,17    256324  7996678 /usr/lib/locale/en_US.utf8/LC_CTYPE
lsof      8297       root  mem    REG               8,17     26050  9318051 /usr/lib64/gconv/gconv-modules.cache

lsof had way too many things to put down though, there’s 100s of items like that

Okay, it won’t let me edit my last post again…but I got it to work by changing /boot/grub/menu.lst :slight_smile:

The only issue is that on my old HD opensuse took up 22.2GB’s (of 500GB), and on my new HD it’s taking up 186GB :S

OK lets see
fdisk -l that is a lower case L

But Suse only uses what you assign to it.

Here you go:


linux-630u:/home/froid # fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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: 0x90909090

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      204800   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2              26       60801   488179201   83  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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: 0xc7e5c7e5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       39163   314569552+  83  Linux
/dev/sdb2           39163       60802   173816856    7  HPFS/NTFS

Ok there is only one large Linux partition on sda A smaller partition is on sdb and is marked as boot.

type
mount

to see what is mounted where as what.

Yeah sdb is the corrupted HD, I’m gonna get rid of it after I transfer my data out of the NTFS partition.

here’s mount:



/dev/sda2 on / type ext4 (rw,acl,user_xattr)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
devtmpfs on /dev type devtmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,mode=1777)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/sdb2 on /windows/C type fuseblk (rw,noexec,nosuid,nodev,allow_other,blksize=4096,default_permissions)
securityfs on /sys/kernel/security type securityfs (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)

As I said before, I think everything is fine now except that my new filesystem is taking up way more space than its supposed to

So you must have specified this partitioning since OpenSuse defaults to having a root and a home partition. This makes up grades and reinstalls easier since you can format root without touching home where your personal data and setting live. If you want some other partition scheme reinstall and specify what you want at the install scheme window. Always double check to be sure that is what you want.

If you want a new NTFS partition you will need to use a Windows or other utility disk this should be done first since Windows hogs the boot.

I think I’m okay with how things are for now. I’m not gonna install windows again until I get a new HD for it since it always BSODs on me and does stuff like corrupt my hard drive :\

Thanks for the help gogalthorp :slight_smile:

On 2010-08-30 19:06, Froid wrote:
>
> Hello everyone,
>
> Recently I was working on something on my windows partition (on the
> same HD as opensuse), and all the sudden windows stopped working and I
> got some bad sectors on my HD.
>
> Now, my opensuse installation is on the same HD as windows, but I need
> to get rid of that HD soon because it’s starting to get worse (and I
> think opensuse is randomly crashing because of it).
>
> Is there any way to transfer my opensuse parititon/os to another hard
> drive?

The best thing, IMO, is to get hold of a big enough disk to hold it all, temporarily, then make an
image copy of the bad disk to the backup disk (dd or ddrescue⁽¹⁾), running from a live CD or a linux
on another disk. After, you can prepare the new installation disk at your leisure.

While you prepare for this, keep that disk powered off, don’t use it again.

I suggest this method because, assuming your disk is in imminent danger, you will have your data on
a safe place faster.

After the images are done, make partitions on the destination as needed, loop mount the images, and
copy over the files. Grub will need to be installed fresh, fstab edited. Destination partitions can
be bigger and or different if you want, no problem.

⁽¹⁾ image the partitions one by one if possible, to files on temporary destination data disk. If
partition table is broken, don’t waste time: image the disk in full, raw.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))