remove partaion

Tod Merley todbot88 at gmail.com
Sat Sep 2 19:18:58 UTC 2006


On 9/2/06, yogesh at banasdairy.coop <yogesh at banasdairy.coop> wrote:
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/hda2             7.7G  5.0G  2.4G  68% /
> /dev/hda5              15G  331M   14G   3% /backup
> /dev/hda1             388M   13M  355M   4% /boot
> /dev/hda6              14G   11G  2.3G  83% /data
> none                  121M     0  121M   0% /dev/shm
>
>
> hi to all
>  i have a partation type as discueed above
> i want to delete/remove
>
> /dev/hda5              15G  331M   14G   3% /backup
>  this partation and want to install windows 2000 on that partation
> so can u give me help how can i remove the partation so it wiill not effct
> the linux and it run as it is
>
>
>
> tahnks
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>

Hi yogesh!

First of all, this is major surgery using very sharp tools.  Knives in
the kitchen are used by cooks to chop food but trying to chop as much
food as they usually do would result in a lot of cut hands of the
non-cooks.  Take some time to know what you are doing!

Matthew Saltzman pointed out, for instance, that 2000 and Fedora will
need primary partitions.  You will need to move some partitions to
make this work and may not use hda5.

The most interesting hurdle will be what the Master Boot Record(MBR)
ends up with.  2000 during the install will probably overwrite it and
thus kill GRUB (the FC5 boot loader).  So you will need to be ready to
re-establish GRUB using a Live-CD.

The following I wrote to a guy intending an XP FC5 dual boot.  You may
do well to research (Google) your intended FC5/2K boot.  I hope it is
helpful:

I would copy your MBR and first 63 sectors (see the MBR Copy Appendix
below), of the XP disk and of the new FC5 disk. Keep these on a CD or
flash drive or other reliable place (e-mail?). As others have pointed
out machine management SW and antivirus SW tend to take any changes to
these as hostile and "repair" without asking.  Yes you will need to
shut off whatever caused this later but restoring the MBR is easier
with copy saved outside the system and helpful to restore one if the
MBR is damaged (like maybe by a virus).

I think it would be good to have some Live CDs on hand.  They are
wonderful for working with this kind of thing and tend to save your
neck if something goes wrong.  I like Puppy Linux because it comes up
fast and has usable versions of the basic tools available (although it
is often the busybox version which is limited).  I like KNOPPIX since
it is fairly comprehensive in both tools and very good at finding good
hardware configurations.

Following are some reference materials from others I have written:

Basic Thought:

 Write down on a sheet of paper exactly what you want to do (large
outline) then fill in the outline with specific steps with the exact
GUI or command line commands to accomplish that.  If there is info on
the disk you need, transfer it elsewhere before you start!

Dual Boot How-To(s):

http://www.crhc.uiuc.edu/~mjmille2/howtos/dual-boot-linux-and-windows/

http://users.bigpond.net.au/hermanzone/p3.htm

http://www.linuxdevcenter.com/pub/a/linux/2006/05/08/dual-boot-laptop.html

GRUB:

http://www.gnu.org/software/grub/manual/

SEE GRUB APPENDIX BELOW

MBR:

http://en.wikipedia.org/wiki/Master_boot_record

http://www.geocities.com/thestarman3/asm/mbr/MBR_in_detail.htm

http://www-128.ibm.com/developerworks/linux/library/l-linuxboot/

http://linuxgazette.net/issue63/okopnik.html

SEE MBR COPY APPENDIX BELOW

Partitioning:

(Note: requires "find in document" "partition")
http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/pdf/

Re-size NTFS:

1. During the XP install process you can delete all of your partitions
(you will need to fix the MBR to do so - see previous post - or do a
"XP fix mbr" in Google and realize that if your system is simple (a C:
drive only for XP) then just the "fixmbr" command will work).

2. Reduce the size of the XP partition - see below ("find on page" "ntfs"):

http://www.linuxmigration.com/quickref/install/disk.html#ntfs

http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html

GRUB Appendix:

Shows techniques to find out how GRUB "sees" the drives attached (was
written to an Ubuntu user doing dual boot with XP);

First I run grub with no flash drive attached (note the comments about
"TAB" in the grub splash text):

------------------------

  GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

     [ Minimal BASH-like line editing is supported.   For
       the   first   word,  TAB  lists  possible  command
       completions.  Anywhere else TAB lists the possible
       completions of a device/filename. ]

grub> root (hd0,
 Possible partitions are:
 Partition num: 0,  Filesystem type is ext2fs, partition type 0x83
 Partition num: 4,  Filesystem type unknown, partition type 0x82

grub> root (hd0,

------------------------

Note that at the first prompt I typed "root (" and THEN hit tab once.
The command turned into "grub> root (hd0".  I THEN hit the tab key
again and it popped up the rest that we see.

I then exited grub with "quit" (yes, you MUST do this to see
changes!!!).  Plugged in my new 1G drive and entered grub again:

-----------------------

  GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

     [ Minimal BASH-like line editing is supported.   For
       the   first   word,  TAB  lists  possible  command
       completions.  Anywhere else TAB lists the possible
       completions of a device/filename. ]

grub> root (hd
 Possible disks are:  hd0 hd1

grub> root (hd1,0)

-----------------------

Note that this time grub found a second "hd1" and that when I had
entered "hd1" the next tab yielded "," and the next tab "0)".

Grub apparently finds bootable devices and simply lables them
incrementally.  If I want to make grub form a Master Boot Record for
my flash drive then as I use it "right now" (with the drive plugged in
this session" I will need to address the writing of that MBR to "hd1".

IT WOULD BE USEFUL TO SEE YOUR RESULTS OF DOING THE ABOVE (without the
flash drive of course).

Grub also sees the partitions "one less (-1) from everybody else.
Check it out!:

---------------------

root at tod-desktop:~# df -a -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1              74G   50G   21G  72% /
proc                     0     0     0   -  /proc
/sys                     0     0     0   -  /sys
varrun                221M   80K  221M   1% /var/run
varlock               221M  4.0K  221M   1% /var/lock
procbususb               0     0     0   -  /proc/bus/usb
udev                  221M  136K  221M   1% /dev
devpts                   0     0     0   -  /dev/pts
devshm                221M     0  221M   0% /dev/shm
lrm                   221M   19M  202M   9% /lib/modules/2.6.15-26-386/volatile
/dev/hdc              650M  650M     0 100% /media/cdrom0
/dev/hdd              338M  338M     0 100% /media/cdrecorder
/dev/sda1             961M     0  961M   0% /media/usbdisk

root at tod-desktop:~# fdisk -l

Disk /dev/hda: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

 Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        9800    78718468+  83  Linux
/dev/hda2            9801        9964     1317330    5  Extended
/dev/hda5            9801        9964     1317298+  82  Linux swap / Solaris

Disk /dev/sda: 1007 MB, 1007681536 bytes
16 heads, 32 sectors/track, 3844 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3844      984048    e  W95 FAT16 (LBA)

root at tod-desktop:~# parted

GNU Parted 1.6.25.1
Copyright (C) 1998 - 2005 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Using /dev/hda

(parted) print
Disk geometry for /dev/hda: 0kB - 82GB
Disk label type: msdos
Number  Start   End     Size    Type      File system  Flags
1       32kB    81GB    81GB    primary   ext3         boot
2       81GB    82GB    1349MB  extended
5       81GB    82GB    1349MB  logical   linux-swap

(parted) select /dev/sda

Using /dev/sda
(parted) print
Disk geometry for /dev/sda: 0kB - 1008MB
Disk label type: msdos
Number  Start   End     Size    Type      File system  Flags
1       16kB    1008MB  1008MB  primary   fat16        boot, lba
(parted)

-------------------------

Now I show you the current /boot/grub/menu.lst (note: reduced in the
hopes of getting this long e-mail through the "length filter"):

-------------------------

root at tod-desktop:/boot/grub# cat menu.lst     # Note: in FC5 this will
be grub.conf

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default         0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout         3

## ## End Default Options ##

title           Ubuntu, kernel 2.6.15-26-386
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.15-26-386 root=/dev/hda1 ro quiet splash
initrd          /boot/initrd.img-2.6.15-26-386
savedefault
boot

title           Ubuntu, kernel 2.6.15-26-386 (recovery mode)
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.15-26-386 root=/dev/hda1 ro single
initrd          /boot/initrd.img-2.6.15-26-386
boot

title           Ubuntu, memtest86+
root            (hd0,0)
kernel          /boot/memtest86+.bin
boot

### END DEBIAN AUTOMAGIC KERNELS LIST
root at tod-desktop:/boot/grub#

-------------------------


MBR Copy Appendix:

As promised, an itty bitty how-to on making a copy of your Master Boot
Record and the first portion (often containing partition and content
info) of the boot disk.

In this case I was fascinated by the "boot" flag set looking at my new
flash drive so I wanted to take a look at it's MBR.  The command I
usually use to do this is:

dd if=/dev/hda of=mbr.bin bs=512 count=1

and the command to take a "snapshot" of the first sectors:

dd if=/dev/hda of=mbr63s.bin bs=512 count=63

To read the flash drive I modify the command to:

root at tod-desktop:/boot/grub# cd /home/tod
root at tod-desktop:~# pwd
/home/tod
root at tod-desktop:~# dd if=/dev/sda1 of=pnymbr.bin bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000423 seconds, 1.2 MB/s

This yeilds "pnymbr.bin" in my /home/tod directory.  This is a copy of
my Master Boot Record.

root at tod-desktop:~# dd if=/dev/sda1 of=pny63s.bin bs=512 count=63
63+0 records in
63+0 records out
32256 bytes (32 kB) copied, 0.01087 seconds, 3.0 MB/s
root at tod-desktop:~#

Which yields "pny63s.bin which is a copy of the first 63 sectors.

Likely this will loose formatting but here is a hexdump of the PNY
flash drive MBR:

root at tod-desktop:~# hexdump -C pnymbr.bin

00000000  eb 3c 90 44 4f 4b 30 31  2e 30 32 00 02 20 01 00  |.<.DOK01.02.. ..|
00000010  02 00 02 00 00 f8 f1 00  20 00 10 00 20 00 00 00  |........ ... ...|
00000020  e0 07 1e 00 80 00 29 c5  4b f6 f0 00 00 00 00 00  |......).K.......|
00000030  00 00 00 00 00 00 46 41  54 31 36 20 20 20 33 c9  |......FAT16   3.|
00000040  8e d1 bc fc 7b 16 07 bd  78 00 c5 76 00 1e 56 16  |....{...x..v..V.|
00000050  55 bf 22 05 89 7e 00 89  4e 02 b1 0b fc f3 a4 06  |U."..~..N.......|
00000060  1f bd 00 7c c6 45 fe 0f  38 4e 24 7d 20 8b c1 99  |...|.E..8N$} ...|
00000070  e8 7e 01 83 eb 3a 66 a1  1c 7c 66 3b 07 8a 57 fc  |.~...:f..|f;..W.|
00000080  75 06 80 ca 02 88 56 02  80 c3 10 73 ed 33 c9 fe  |u.....V....s.3..|
00000090  06 d8 7d 8a 46 10 98 f7  66 16 03 46 1c 13 56 1e  |..}.F...f..F..V.|
000000a0  03 46 0e 13 d1 8b 76 11  60 89 46 fc 89 56 fe b8  |.F....v.`.F..V..|
000000b0  20 00 f7 e6 8b 5e 0b 03  c3 48 f7 f3 01 46 fc 11  | ....^...H...F..|
000000c0  4e fe 61 bf 00 07 e8 28  01 72 3e 38 2d 74 17 60  |N.a....(.r>8-t.`|
000000d0  b1 0b be d8 7d f3 a6 61  74 3d 4e 74 09 83 c7 20  |....}..at=Nt... |
000000e0  3b fb 72 e7 eb dd fe 0e  d8 7d 7b a7 be 7f 7d ac  |;.r......}{...}.|
000000f0  98 03 f0 ac 98 40 74 0c  48 74 13 b4 0e bb 07 00  |..... at t.Ht......|
00000100  cd 10 eb ef be 82 7d eb  e6 be 80 7d eb e1 cd 16  |......}....}....|
00000110  5e 1f 66 8f 04 cd 19 be  81 7d 8b 7d 1a 8d 45 fe  |^.f......}.}..E.|
00000120  8a 4e 0d f7 e1 03 46 fc  13 56 fe b1 04 e8 c2 00  |.N....F..V......|
00000130  72 d7 ea 00 02 70 00 52  50 06 53 6a 01 6a 10 91  |r....p.RP.Sj.j..|
00000140  8b 46 18 a2 26 05 96 92  33 d2 f7 f6 91 f7 f6 42  |.F..&...3......B|
00000150  87 ca f7 76 1a 8a f2 8a  e8 c0 cc 02 0a cc b8 01  |...v............|
00000160  02 80 7e 02 0e 75 04 b4  42 8b f4 8a 56 24 cd 13  |..~..u..B...V$..|
00000170  61 61 72 0a 40 75 01 42  03 5e 0b 49 75 77 c3 03  |aar. at u.B.^.Iuw..|
00000180  18 01 27 0d 0a 49 6e 76  61 6c 69 64 20 73 79 73  |..'..Invalid sys|
00000190  74 65 6d 20 64 69 73 6b  ff 0d 0a 44 69 73 6b 20  |tem disk...Disk |
000001a0  49 2f 4f 20 65 72 72 6f  72 ff 0d 0a 52 65 70 6c  |I/O error...Repl|
000001b0  61 63 65 20 74 68 65 20  64 69 73 6b 2c 20 61 6e  |ace the disk, an|
000001c0  64 20 74 68 65 6e 20 70  72 65 73 73 20 61 6e 79  |d then press any|
000001d0  20 6b 65 79 0d 0a 00 00  49 4f 20 20 20 20 20 20  | key....IO      |
000001e0  53 59 53 4d 53 44 4f 53  20 20 20 53 59 53 7f 01  |SYSMSDOS   SYS..|
000001f0  00 41 bb 00 07 60 66 6a  00 e9 3b ff 00 00 55 aa  |.A...`fj..;...U.|
00000200

It does have the "AA55" magic number at the end and probably a jump
command at the beginning doing a read of the error message seen.

Have fun!

Tod




More information about the fedora-list mailing list