* [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
@ 2005-01-23 21:55 fromkth+lvm
2005-01-24 0:26 ` Robin Green
0 siblings, 1 reply; 7+ messages in thread
From: fromkth+lvm @ 2005-01-23 21:55 UTC (permalink / raw)
To: linux-lvm
Hi,
I am a newbie to linux and I have XP and FC3 on my 30GB HD.
I have searched through internet to find out how to reduce logical
Volume based on LVM2, but as my situation is quite different hence could
not find out any solution.
I have total 3 Primary partions and one extended partitions.
first 3 primary paritions are NTFS(XP),FAT32(data) and NTFS(data)
respectively.
Extended partition contains two partitions, linux boot and linux LVM.
Linux LVM contains one Group Volume which contains two Logical Volumes.
One Logical Volume has / root file System
and other Logical Volume has SWAP space.
Here is the ouput of fdisk -l and contents of /etc/fstab
fdisk -l
=======================================================================
Disk /dev/hda: 30.0 GB, 30005821440 bytes
255 heads, 63 sectors/track, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 637 5116671 7 HPFS/NTFS
/dev/hda2 638 1274 5116702+ c W95 FAT32 (LBA)
/dev/hda3 1275 2546 10217340 7 HPFS/NTFS
/dev/hda4 2547 3648 8851815 f W95 Ext'd (LBA)
/dev/hda5 2547 2559 104391 83 Linux
/dev/hda6 2560 3648 8747361 8e Linux LVM
=======================================================================
cat /etc/fstab
==========================================================================
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 defaults
1 1
LABEL=/boot /boot ext3 defaults
1 2
none /dev/pts devpts gid=5,mode=620
0 0
none /dev/shm tmpfs defaults
0 0
none /proc proc defaults
0 0
none /sys sysfs defaults
0 0
/dev/VolGroup00/LogVol01 swap swap defaults
0 0
/dev/hdb /media/cdrom auto
pamconsole,fscontext=system_u:object_r:removable_t,ro,exec,noauto,managed
0 0
/dev/fd0 /media/floppy auto
pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0
0
/dev/hda1 /mnt/win_ntfs_c ntfs ro,defaults,umask=0222 0 0
/dev/hda2 /mnt/win_fat32_d auto ro,defaults,umask=0222 0 0
/dev/hda3 /mnt/win_ntfs_e ntfs ro,defaults,umask=0222 0 0
================================================================================
Now I want to free some space from the linux LVM(hda6) and create a
FAT32 partition as hda7.
So how to reduce that LVM?
one more questions my /boot parition is /dev/hda5 but in fstab it shows
it as LABEL=/boot
so how is that?
Thanks.
-ajeet.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
2005-01-23 21:55 [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM fromkth+lvm
@ 2005-01-24 0:26 ` Robin Green
2005-01-24 0:38 ` Robin Green
2005-01-24 22:24 ` fromkth+lvm
0 siblings, 2 replies; 7+ messages in thread
From: Robin Green @ 2005-01-24 0:26 UTC (permalink / raw)
To: LVM general discussion and development
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
On Sun, Jan 23, 2005 at 01:55:55PM -0800, fromkth+lvm@fastmail.fm wrote:
> Now I want to free some space from the linux LVM(hda6) and create a
> FAT32 partition as hda7.
>
> So how to reduce that LVM?
I suggest you use qtparted. Basically you need to:
1. Resize /
2. Move the swap volume back so it is adjacent to / (as it is swap, you could just
run swapoff, delete the volume, and then recreate it.)
3. Reduce the physical volume size
I don't know if qtparted can do step 3 but it can do steps 1 and 2, I think.
> one more questions my /boot parition is /dev/hda5 but in fstab it shows
> it as LABEL=/boot
> so how is that?
/dev/hda5 contains a label called /boot. That means if you move /boot to a different
partition, you don't have to change your fstab, which is useful, but rarely.
However, if you ever insert another Linux-formatted hard drive in your system,
from a different computer, it can cause the OS to become very confused as it cannot
determine which "/boot"-labelled partition to use! That is the disadvantage of
partition labelling.
--
Robin
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
2005-01-24 0:26 ` Robin Green
@ 2005-01-24 0:38 ` Robin Green
2005-01-24 22:24 ` fromkth+lvm
1 sibling, 0 replies; 7+ messages in thread
From: Robin Green @ 2005-01-24 0:38 UTC (permalink / raw)
To: LVM general discussion and development
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
On Mon, Jan 24, 2005 at 12:26:32AM +0000, Robin Green wrote:
> On Sun, Jan 23, 2005 at 01:55:55PM -0800, fromkth+lvm@fastmail.fm wrote:
> > Now I want to free some space from the linux LVM(hda6) and create a
> > FAT32 partition as hda7.
> >
> > So how to reduce that LVM?
>
> I suggest you use qtparted. Basically you need to:
>
> 1. Resize /
Oh and of course, to do this, you must be running a separate copy of Linux
- like a live CD. Knoppix, for example, boots with usually no user intervention
required, and contains qtparted and everything it needs.
--
Robin
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
2005-01-24 0:26 ` Robin Green
2005-01-24 0:38 ` Robin Green
@ 2005-01-24 22:24 ` fromkth+lvm
2005-01-25 20:08 ` Sam Vilain
1 sibling, 1 reply; 7+ messages in thread
From: fromkth+lvm @ 2005-01-24 22:24 UTC (permalink / raw)
To: linux-lvm; +Cc: greenrd
Thanks for the suggestions, but qtparted does not help.
I ran Knoppix Live CD 3.7 which has qtparted 0.4.4 and it does not
recognizes the linux lvm partition and shows it as unknown
type/filesystem in the list, and it does not give any other information
or any other option(e.g resize) when i right click that partition.
so the question remains how to do it.
Thanks.
-ajeet.
On Mon, 24 Jan 2005 00:26:32 +0000, "Robin Green" <greenrd@greenrd.org>
said:
> On Sun, Jan 23, 2005 at 01:55:55PM -0800, fromkth+lvm@fastmail.fm wrote:
> > Now I want to free some space from the linux LVM(hda6) and create a
> > FAT32 partition as hda7.
> >
> > So how to reduce that LVM?
>
> I suggest you use qtparted. Basically you need to:
>
> 1. Resize /
> 2. Move the swap volume back so it is adjacent to / (as it is swap, you
> could just
> run swapoff, delete the volume, and then recreate it.)
> 3. Reduce the physical volume size
>
> I don't know if qtparted can do step 3 but it can do steps 1 and 2, I
> think.
>
> > one more questions my /boot parition is /dev/hda5 but in fstab it shows
> > it as LABEL=/boot
> > so how is that?
>
> /dev/hda5 contains a label called /boot. That means if you move /boot to
> a different
> partition, you don't have to change your fstab, which is useful, but
> rarely.
>
> However, if you ever insert another Linux-formatted hard drive in your
> system,
> from a different computer, it can cause the OS to become very confused as
> it cannot
> determine which "/boot"-labelled partition to use! That is the
> disadvantage of
> partition labelling.
>
> --
> Robin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
2005-01-24 22:24 ` fromkth+lvm
@ 2005-01-25 20:08 ` Sam Vilain
2005-01-31 0:38 ` fromkth+lvm
0 siblings, 1 reply; 7+ messages in thread
From: Sam Vilain @ 2005-01-25 20:08 UTC (permalink / raw)
To: greenrd; +Cc: LVM general discussion and development
fromkth+lvm@fastmail.fm wrote:
> I ran Knoppix Live CD 3.7 which has qtparted 0.4.4 and it does not
> recognizes the linux lvm partition and shows it as unknown
[...]
> so the question remains how to do it.
The knoppix CD also has the commandline lvm utilities and ext2resize
binaries. Have fun reading the manpages for vgscan, vgchange,
ext2resize, lvreduce, pvmove, vgreduce, pvremove, fdisk, pvcreate,
vgextend, and pvmove. Not necessarily in that order.
HTH.
--
Sam Vilain, sam /\T vilain |><>T net, PGP key ID: 0x05B52F13
(include my PGP key ID in personal replies to avoid spam filtering)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
2005-01-25 20:08 ` Sam Vilain
@ 2005-01-31 0:38 ` fromkth+lvm
2005-01-31 3:38 ` Sam Vilain
0 siblings, 1 reply; 7+ messages in thread
From: fromkth+lvm @ 2005-01-31 0:38 UTC (permalink / raw)
To: LVM general discussion and development
I am able to partialy solve my problem, so still needs help to complete
it. This may be help full for newbie like me, so i am writing the
steps here.
So first let me define again what i wanted to do.
fromkth+lvm@fastmail.fm wrote:
> Hi,
>
> I am a newbie to linux and I have XP and FC3 on my 30GB HD. I have
> searched through internet to find out how to reduce logical Volume
> based on LVM2, but as my situation is quite different hence could not
> find out any solution. I have total 3 Primary partitions and one
> extended partitions. first 3 primary partitions are
> NTFS(XP),FAT32(data) and NTFS(data) respectively. Extended partition
> contains two partitions, linux boot and linux LVM. Linux LVM contains
> one Group Volume which contains two Logical Volumes. One Logical
> Volume has / root file System and other Logical Volume has SWAP space.
>
>
> Here is the output of fdisk -l and contents of /etc/fstab
>
> fdisk -l
> =======================================================================
> Disk /dev/hda: 30.0 GB, 30005821440 bytes 255 heads, 63 sectors/track,
> 3648 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
>
> Device Boot Start End Blocks Id System
> /dev/hda1 * 1 637 5116671 7 HPFS/NTFS
> /dev/hda2 638 1274 5116702+ c W95 FAT32(LBA)
> /dev/hda3 1275 2546 10217340 7 HPFS/NTFS
> /dev/hda4 2547 3648 8851815 f W95 Ext'd(LBA)
> /dev/hda5 2547 2559 104391 83 Linux
> /dev/hda6 2560 3648 8747361 8e Linux LVM
> =======================================================================
>
>
> cat /etc/fstab
> ==========================================================================
> # This file is edited by fstab-sync - see 'man fstab-sync' for details
> /dev/VolGroup00/LogVol00 / ext3 defaults 1 1
> LABEL=/boot /boot ext3 defaults 1 2
> none /dev/pts devpts gid=5,mode=620
> none /dev/shm tmpfs defaults 0 none
> /proc proc defaults 0 none /sys
> sysfs defaults 0 /dev/VolGroup00/LogVol01 swap swap
> defaults 0
>
> /dev/hdb /media/cdrom auto pamconsole,fscon-
> text=system_u:object_r:removable_t,ro,exec,noauto,managed 0
>
> /dev/fd0 /media/floppy auto pamconsole, fscontext=system_u:object_r:r-
> removable_t,exec,noauto,managed 0 0
>
> /dev/hda1 /mnt/win_ntfs_c ntfs ro,defaults,umask=0222 0 0
> /dev/hda2 /mnt/win_fat32_d auto ro,defaults,umask=0222 0 0
> /dev/hda3 /mnt/win_ntfs_e ntfs ro,defaults,umask=0222 0 0
> ================================================================================
>
> Now I want to free some space from the linux LVM(hda6) and create a
> FAT32 partition as hda7.
>
> So how to reduce that LVM?
So Robin Suggested:
======================
I suggest you use qtparted. Basically you need to:
1. Resize /
2. Move the swap volume back so it is adjacent to / (as it is swap, you
could just run swapoff, delete the volume, and then recreate it.)
3. Reduce the physical volume size
I don't know if qtparted can do step 3 but it can do steps 1 and
2, I think.
Oh and of course, to do this, you must be running a separate copy of
Linux
- like a live CD. Knoppix, for example, boots with usually no user
intervention required, and contains qtparted and everything it needs.
My Reply
> fromkth+lvm@fastmail.fm wrote:
>
>> I ran Knoppix Live CD 3.7 which has qtparted 0.4.4 and it does not
>> recognizes the linux lvm partition and shows it as unknown
>
> [...]
>
>> so the question remains how to do it.
Sam Vilain wrote:
>
> The knoppix CD also has the commandline lvm utilities and ext2resize
> binaries. Have fun reading the manpages for vgscan, vgchange,
> ext2resize, lvreduce, pvmove, vgreduce, pvremove, fdisk, pvcreate,
> vgextend, and pvmove. Not necessarily in that order.
>
> HTH.
My Reply:
==============
Knoppix 3.7(whether you boot in 2.4 or 2.6 kernel) does not have lvm
utilities or ext2resize binaries, so i tried to install over from
internet but somehow i was not able to connect to default
ftp.de.debian.org through "apt-get update", and to change source one
must edit /etc/apt/source.list which i am not able to edit
it as the file is only read-only.
Anyway i booted the system in linux resuce mode with FC3 rescue CD. I
said not to mount any file system(not even read only) when asked
during booting. Now first you need to activate the Volume Group, so
you need to do.
# lvm vgchange -ay
then to reduce the file system(in my case it is root file system of ext3
type) in the activated volume group, first you need to run,
"e2fsck -v -f LogicalVolumeWithFullPath" in my case it was,
# e2fsck -v -f /dev/VolGroup00/LogVol00
then resize it with
# resize2fs -p /dev/VolGroup00/LogVol00 6G
Resizes the ext3 file system in LogVol00 to 6GB.
Now after that When i check Logical Volumes with
# lvm lvdisplay
i get
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID 6WyF9L-t4dJ-8HrR-NdTo-CoZh-NKvl-z6fidr
LV Write Access read/write
LV Status available
# open 1
LV Size 6.00 GB
Current LE 192
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID N3auhB-e9br-76Cw-Eqvw-c31w-mq3Y-T5QBp8
LV Write Access read/write
LV Status available
# open 1
LV Size 1.00 GB
Current LE 32
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1
So here i can see that LogVol00 is reduces to 6GB as i wanted. and
# lvm vgdisplay
shows,
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 12
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 8.31 GB
PE Size 32.00 MB
Total PE 266
Alloc PE / Size 224 / 7.00 GB
Free PE / Size 42 / 1.31 GB
VG UUID cdEPbO-5o71-hUIa-szPC-FAra-E79P-cdbuTS
But it still shows it as 8.31GB which is like before, but it shows that
42 PEs are free.
But now the problem is how to claim those 42 PEs from this Volume Group
as i want to use that free space of this Volume Group to make
hda7(fat32)
which i can use(read/write)both in linux as well as in windows.
Do i have to do as Robin Suggested that,
>2. Move the swap volume back so it is adjacent to / (as it is swap, you
> could just run swapoff, delete the volume, and then recreate it.)
Can some one guide me step by step how to do it either from running FC3
itself or from rescue CD of FC3 or from Knoppix 3.7
> 3. Reduce the physical volume size
is there any command in lvm2 to do this, i tried
# lvm pvresize
but it said command not implemented yet. so how to do it?
Waiting for answers.
-ajeet.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM
2005-01-31 0:38 ` fromkth+lvm
@ 2005-01-31 3:38 ` Sam Vilain
0 siblings, 0 replies; 7+ messages in thread
From: Sam Vilain @ 2005-01-31 3:38 UTC (permalink / raw)
To: fromkth+lvm; +Cc: LVM general discussion and development
fromkth+lvm@fastmail.fm wrote:
> But now the problem is how to claim those 42 PEs from this Volume Group
> as i want to use that free space of this Volume Group to make
> hda7(fat32)
> which i can use(read/write)both in linux as well as in windows.
You can't just shrink a PV like that AFAIK.
What you are asking is pretty much voodoo. Remember the solution that
works every time is to back everything up to a tape or another
harddrive, then setup the disk the way you want it and copy everything
back. Trying to attempt voodoo as a self-admitted newbie is a sure-fire
way to end up with complete loss of data on a system.
The LVM was designed to avoid these problems; however it is not designed
to play well with other operating systems on the same box. So, you are
stuck with native partitioning and all the problems that go along with
it.
It is possible to do a lot of things by making more physical volumes,
and using "pvmove" to move the logical volumes between disks. Once
`pvdisplay -v' on a volume shows no data there you can safely
repartition the space (and probably reboot each time), but from
the sounds of it, you should not experiment with this approach. It
is very easy to make a mistake and lose everything.
--
Sam Vilain, sam /\T vilain |><>T net, PGP key ID: 0x05B52F13
(include my PGP key ID in personal replies to avoid spam filtering)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-01-31 3:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-23 21:55 [linux-lvm] Reducing/Resizing LVM where "/" filesystem is included in the LVM fromkth+lvm
2005-01-24 0:26 ` Robin Green
2005-01-24 0:38 ` Robin Green
2005-01-24 22:24 ` fromkth+lvm
2005-01-25 20:08 ` Sam Vilain
2005-01-31 0:38 ` fromkth+lvm
2005-01-31 3:38 ` Sam Vilain
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.