You are not logged in.

#1 2009-10-19 15:53:58

Vladman
Member
Registered: 2009-01-28
Posts: 118

dd to a smaller drive

Not sure if this belongs in this forum, (mods, feel free to move).

I just did a dd of my current arch install from 250 gig drive to 150 gig and when I boot I get an error, something about super block being a diffrent size.
I tried googling the answer but no luck.

Can some one explain what I need to do to fix it?
Appreciate your help.

Offline

#2 2009-10-19 16:00:14

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: dd to a smaller drive

AFAICT your move by dd to smaller drive is not allowed.  The drive you transfer to with DD has to be the same size as the source drive (and maybe larger).


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#3 2009-10-19 16:21:33

Vladman
Member
Registered: 2009-01-28
Posts: 118

Re: dd to a smaller drive

Thanks, is there another way to do the same with maybe another program?

Offline

#4 2009-10-19 16:29:19

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: dd to a smaller drive

dd does only what you tell it to. It copies raw data from one file to another, be it a device node representing a complete drive (e.g. /dev/sda) or a partition (e,g, /dev/sda4), until that fails. It doesn't know anything about the data it copies, and it doesn't care. So it can't shrink or grow your filesystem or keep it consistent since it simply doesn't work that way. You effectively just cut off the last 100G of your hardrive. It's like cutting your laptop in two and throwing away one part to get a netbook wink

Use dd only to copy from/to partitions (or whole drives) that have the same size. you *can* copy to a larger partition/drive, but then you'd end up with unused space. It's been called the "data-destroyer" for a reason.

Use Gparted to shrink your source partition first, then create a partition on the smaller drive of the exact same size, and then you can use dd to copy from the source to the target partition. Be sure you know the difference between device nodes and partition nodes (e.g. /dev/sda vs /dev/sda1) before doing so.

Offline

#5 2009-10-19 16:30:19

grey
Member
From: Europe
Registered: 2007-08-23
Posts: 679

Re: dd to a smaller drive

Take a look at fsarchiver. You have to set up the partition table of the target device before restoring, but other than that it should just work.


Good ideas do not need lots of lies told about them in order to gain public acceptance.

Offline

#6 2009-10-19 18:11:27

Vladman
Member
Registered: 2009-01-28
Posts: 118

Re: dd to a smaller drive

Thanks for your replyes guys, I appreciate it.
I'm going to take a look at fsarchaver.

Offline

#7 2009-10-19 19:52:34

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

Re: dd to a smaller drive

I've moved arch root partitions loads of times, usually I boot an Arch install USB img and jiggle my partitions from there.

Is there a particular reason you can't just create the new file system on the smaller disk/partition, mount the current and new partitions, and cp -a?

Offline

#8 2009-10-19 23:31:36

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: dd to a smaller drive

You can gzip it.  It can be cut down by a good bit with large open spaces and the drive not being very full:

dd if=/dev/sda | gzip -9 > /mnt/disk2/backup.gz

Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#9 2009-10-20 16:43:32

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: dd to a smaller drive

What about opening your image in gparted?

gparted /path/to/image.img

Offline

Board footer

Powered by FluxBB