[lfs-support] help, i hosed my windows partition

akhiezer lfs65 at cruziero.com
Sun Mar 10 04:15:58 PDT 2013

> Date: Sun, 10 Mar 2013 09:33:39 +0000
> From: tilmanbregler <tilmanbregler at gmail.com>
> To: lfs-support at linuxfromscratch.org
> Subject: [lfs-support] help, i hosed my windows partition
> so this is a bit emberassing, and I appreciate if you say this is
> nothing to do with you. I have this dual boot Ubuntu 12.04/Windows 7
> setup. And to make room for th LFS partitions i decided to shrink the
> Windows 7 partition.
> 206848. Any ideas how i can do that, or get back my windows partition,
> otherwise?
> Thanks in advance,
> Tilman

The following is just about the first step - making a backup - and not about 
the subsequent recovery steps.

In situations like this, it's a good idea to, as a zeroeth step: stop, do 
nothing to/with/for/on the disk for the time being, and think things through; 
don't take 'lunges' at it, or you run a quickly-escalating risk of being drawn 
(further) into the quicksand.

Ideally, and before any further other operations on the disk, get a clone of it 
and verify that the clone is an accurate copy: that way, you have a 
backup/snapshot of your present state, that you can fall back on if necessary 
(at which stage you'd make a clone of the clone before proceeding, and so on).

For making the clone, you will ideally need a spare additional disk that is 
empty and/or that you are OK to overwrite, and whose capacity is larger than 
the Ubuntu/'Win' disk.

Ideally, take the present Ubuntu/'Win' disk and the 'spare additional disk', 
attach each as a dumb disk to another machine, and use dd to make the clone: 
but be very careful and clear about source and target disks, and dd usage - 
especially those common usages that will **WIPE** out your target disk - , and 
so on through the usual list of caveats, including that you want the 
'another machine' to treat the Ubuntu/'Win' disk as a dumb disk, and not try to 
do anything fancy or 'automated' to the disk. 

If that's really not possible then can you attach the 'spare additional disk' 
to the original machine, boot into Ubuntu from the Ubuntu/'Win' disk, and use 
dd from there. Again, the same list of warnings &c apply here as above. NB that 
this is a less-ideal situation than the one above, as here the Ubuntu/'Win' is 
not playing an 'inert'/'passive' role, because here you're booting from it.

Once you have done the clone, test it (the clone) by trying to boot Ubuntu from 
it: ideally connect it to the original machine in place of the original 
Ubuntu/'Win' disk (temporarily, for the purposes of the test), connected in 
exactly the same way (same ports, etc). If/when you get to the login prompt, 
just login and do a graceful shutdown of the machine. You might also want to 
verify similarly that it will boot in another machine - or at least can be 
mounted and find/cat/ls works ok in another machine. But don't do anything 
beyond that - you don't want to be changing the clone (other than perhaps the 
login and command-history being recorded).

If you don't have a 'spare additional disk' at all, then perhaps if possible 
consider obtaining one: it should be larger than the Ubuntu/'Win' disk, else 
you'd have to juggle a lot, with the risk of confusion and 

If you do have a 'spare additional disk' but can't afford to wipe it, then be 
aware that dd can write its output to an ordinary file. You'd still need to 
have enough spare space to write the clone-image file: else you're back to the 
stage of obtaining a suitable disk that has got enough space for making the 
clone. But you really must be careful, in this scenario, to not wipe the disk: 
you're, in this scenario, writing dd's output to an ordinary file in the 
filesystem of the 'spare additional disk'. And you've got some juggling and 
extra steps to do in verifying - or later using - the clone.

Best, overall, to have a 'spare additional disk' that you can wipe and that is 
larger than the original Ubuntu/'Win' disk.

Proceed with caution and deliberation. Keep a clear picture of what disks are 
where, what is on them at each stage, etc. Keep a clear picture of what you're 
doing: else back off for a bit until you do; again, don't take lunges at 
situations like this.




More information about the lfs-support mailing list