LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Resizing partitions to install xp (https://www.linuxquestions.org/questions/fedora-35/resizing-partitions-to-install-xp-352466/)

linuxmandrake 08-12-2005 05:33 AM

Resizing partitions to install xp
 
My LVM for FC3 takes up too much space hence I dont have any space left to install windows xp. How do I resize it?

Ephracis 08-12-2005 05:44 AM

QTParted will do the work, it is a nice partitioner with a GUI. You may also boot with some distro CD and just do the parition part, but not every partitioner will support resizing w/o losing the data.

linuxmandrake 08-12-2005 06:01 AM

I have tried qtparted, FC3 installation program, partiton commander. They all wont let me rezise the stupid LVM. They all display it as an unrecognised partition

Ephracis 08-12-2005 09:19 AM

Oh, sorry I missed that you were talking about LVM. I tried that a month ago myself but did not find anything. And since I was not in the mood to find anything I just erased everything and skipped LVM :P

btw, I found this link after doing a little Googling: http://linux.msede.com/ext2/
If you don't find anything useful I suggest that you subscribe to the lvm mailing list. Those people over there should be abe to help you or point you in the right direction.

Good luck!

WhatsHisName 08-12-2005 10:15 AM

It’s easy to resize the logical volume(s), but it may not be possible to resize the physical volume (i.e., the partition(s)) at this time, since the LVM command pvresize has not been implemented yet.

If I were going to do what you need to do on one of my systems, I would (1) copy everything in the logical volumes(s) to another drive (e.g., an external USB drive) or to a different partition on the current drive, (2) remove and recreate the LVM and then (3) copy everything back to the recreated LVM.

But before I removed the LVM, I would try reducing the logical volume(s) size(s) and then attempt to resize the partition by deleting it in fdisk and repartitioning it at a smaller size (but larger than the logical volume(s), just as a safety precaution). I don’t know whether the LVM physical volume assignment will survive the repartitioning.

For more information about resizing a logical volume, look at the LVM HowTo in chapter 11 “Common Tasks”, subsection 11.10 “Reducing a logical volume” ( http://www.ibiblio.org/pub/Linux/doc....html#reducelv ) in the ext2-LVM2 description. It’s a little cryptic, but the man pages explain the commands in detail.

Remember, you need to reduce the size of the ext3 filesystem before you reduce the size of the logical volume. I usually make the ext3 filesystem a little smaller than the desired logical volume size and then resize/grow it to fill the resized logical volume.


Is today the day you order the external USB drive that you have been thinking about buying?

linuxmandrake 08-12-2005 01:42 PM

Ok i get you but could u tell me what commands i need to use because am a ameteur. I dont have a clue

WhatsHisName 08-12-2005 02:36 PM

Hey, I’m a linux amateur, too. There’s certainly a lot more that I don’t know about linux than I do know about it. The ratio is probably around 20:1::Don’t:Do, if not worse than that.

Let’s start with the backup. Where do you plan to copy the contents of current logical volume to and is it already formatted with enough space to hold your stuff?

The “where” options could be another partition on the same drive, another local PATA/SATA drive, an external drive like a USB 2.0 drive (but not on a USB 1.1 connection) or a network drive on your LAN, provided you have at least a 100Mbps LAN.

linuxmandrake 08-12-2005 03:58 PM

Well I have got myself a new SATA so I could use windows while am sorting out my LVM stuff. Copying it to that would be logical and ideal since you're not suppsoed to keep orginal data and backups on the same hard drive.

Any help would be greatly appriciated. Am very close to pulling my hair out. :p

WhatsHisName 08-12-2005 06:02 PM

Everything you will be doing will be from FC3 Rescue mode (i.e., boot: linux rescue). When you reach the “search for FC installations” question, answer No, since the current partition really should be unmounted when you copy it. Normally, I suggest Knoppix for doing “rescue” things, but it is not currently LVM aware. What a pain!

If anyone sees an error below or has a better way to do something, be sure to say something. I won’t be offended. Also, if something isn’t clear, you can always look at the man pages (e.g. man lvscan) for more details.

1) Using fdisk in rescue mode, create a partition on the new SATA drive that is big enough to hold your stuff by running:

fdisk /dev/sdb

assuming that the new drive will be the second SATA drive. If you have other SATA drives, adjust the sdx to the correct letter.

Create a new primary partition (“n”) starting at the beginning. There is a menu (“m”) that lists the commands in fdisk. When it ask for the ending cylinder, it will display how to enter a size in MB, so follow the suggestion and enter the number of MB you want. Remember, 1024MB=1GB. When you are done, write (“w”) the setup to exit. If you enter “q”, it will exit and discard your modifications.

2) Create a simple ext3 filesystem by running:

mke2fs -j /dev/sdb1

assuming that the new partition will be sdb1.

3) Create some simple mountpoints for the old and new partitions by running:

mkdir /mnt/in
mkdir /mnt/out

Not very creative, but you won’t forget what they are for.

4) You need to activate the LVM by running this series of commands:

lvm vgscan
lvm lvscan
lvm vgchange -a y
lvm lvscan

The last one should show your logical volume as an active logical volume. In theory, you should only need to run the vgchange part, but sometimes the first two lines are essential.

5) Mount the partitions, where I will assume that your logical volume is named “/dev/VolGroup00/LogVol00" (the last lvscan will print out the actual name):

mount /dev/VolGroup00/LogVol00 /mnt/in
mount /dev/sdb1 /mnt/out

6) Make an archival copy from one drive to the other:

cp -a /mnt/in/* /mnt/out

It will take a while. I usually do this with rsync, but it isn’t available in rescue mode. When it’s done copying, /mnt/out should look just like /mnt/in. If for some reason you stop the copy and want to restart it, use:

cp -af /mnt/in/* /mnt/out

Otherwise, you will have to confirm each overwrite of anything already written to the filesystem.

7) Unmount the partitions:

cd /
umount /mnt/in
umount /mnt/out

8) Remove the old logical volume, the volume group and the physical volume, which you will recreate later:

lvm lvremove /dev/VolGroup00/LogVol00
lvm vgremove VolGroup00
lvm pvremove /dev/sda.......

lvm lvscan
lvm vgscan
lvm pvscan

where you need to provide the correct partition # in the pvremove step. The ..scan steps are just to confirm that they are gone.

9) Delete the old partition and make a new, smaller one:

fdisk /dev/sda

assuming the old disk is /dev/sda. Print (“p”) the partitions and write down the partition number, starting cylinder and ending cylinder for the old physical volume. Then delete it and create a new partition with the same partition number and starting at the original cylinder, but with an end point in MB that is the size you want. Now change the partition type (“t”) to 8e, which is “Linux LVM”. When you are done, write (“w”) the setup to exit fdisk.

10) Recreate the LVM:

lvm pvcreate /dev/sda...
lvm vgcreate -s 32M VolGroup00 /dev/sda...
lvm lvcreate -L 10G -n LogVol00 VolGroup00
lvm lvscan

where you need to use the correct partition in the first step. Be sure to reuse the same volume group and logical volume names. Otherwise, you will need to modify grub.conf and fstab to get the system to boot.

What you have done is to make /dev/sda... a physical volume, created a volume group named VolGroup00 with 32MB physical extents on the physical volume and created a 10GB logical volume named LogVol00 in the volume group.

The 10GB size is just for demonstration purposes, so use the actual size you want. I would suggest leaving about 10% of the volume group as space free, so that you could us something called a logical volume snapshot in the future, which is very helpful when making backups.

11) Format the new logical volume as ext3:

mke2fs -j /dev/VolGroup00/LogVol00

12) Mount the partitions:

mount /dev/sdb1 /mnt/in
mount /dev/VolGroup00/LogVol00 /mnt/out

13) Restore the contents by making an archival copy of the backup:

cp -a /mnt/in/* /mnt/out

Look familiar? When it’s done, look around /mnt/out and see if it looks correct.

14) Close up shop and try it out:

cd /
umount /mnt/in
umount /mnt/out
exit

Keep giving “exit” until it finally shuts down.

Now boot it up and see what happens.


All times are GMT -5. The time now is 10:01 AM.