How to resize logical volume in Red Hat Linux
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Please guide that how to do following tasks with executing command.
- 1.Create a new physical volume, create a new volume group in the name of
dataconresize
, vg extent is 16.00MB. - 2.Create a new logical volume in the name of
datacopyresize
with the size of 50 extents and file system mustext4
- 3.Then mount it under
/dataresize
- 4.Resize the logical volume,
logical-data
and it filesystem to 400MB. - 5.Resize the logical volume,
logical-data
and it filesystem to 600MB. Make sure that the filesystem contents remain intact.
Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.
I tried first three steps as follows.
fdisk /dev/vdb
----- > Create the Partition and set it's type 8e (which is LVM type)
partprobe /dev/vdb
-----> get the partition
pvcreate /dev/vdb1
vgcreate -s 16M dataconresize /dev/vdb1
vgdisplay
-----> Check the vg extent size, its should be this (PE Size 16.00 MiB)
lvcreate -l 50 -n datacopyresize dataconresize
lvdisplay
-----> Check the size of extents
mkfs.ext4 /dev/dataconresize/datacopyresize
-----> Make a filesystem on it
mkdir -p /dataresize
-----> Create Directory to mount on it
blkid /dev/dataconresize/datacopyresize
-----> Get the UUID of /dev/datacontainer/datacopy
vim /etc/fstab
-----> Create the mount point inside the fstab
UUID=C553-2BF5 /dataresize ext4 defaults 0 0
mount -a
df -hT
-----> get the mount point of it
But I am stuck with task 4 and task 5.
rhel partition lvm resize2fs lvreduce
add a comment |Â
up vote
1
down vote
favorite
Please guide that how to do following tasks with executing command.
- 1.Create a new physical volume, create a new volume group in the name of
dataconresize
, vg extent is 16.00MB. - 2.Create a new logical volume in the name of
datacopyresize
with the size of 50 extents and file system mustext4
- 3.Then mount it under
/dataresize
- 4.Resize the logical volume,
logical-data
and it filesystem to 400MB. - 5.Resize the logical volume,
logical-data
and it filesystem to 600MB. Make sure that the filesystem contents remain intact.
Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.
I tried first three steps as follows.
fdisk /dev/vdb
----- > Create the Partition and set it's type 8e (which is LVM type)
partprobe /dev/vdb
-----> get the partition
pvcreate /dev/vdb1
vgcreate -s 16M dataconresize /dev/vdb1
vgdisplay
-----> Check the vg extent size, its should be this (PE Size 16.00 MiB)
lvcreate -l 50 -n datacopyresize dataconresize
lvdisplay
-----> Check the size of extents
mkfs.ext4 /dev/dataconresize/datacopyresize
-----> Make a filesystem on it
mkdir -p /dataresize
-----> Create Directory to mount on it
blkid /dev/dataconresize/datacopyresize
-----> Get the UUID of /dev/datacontainer/datacopy
vim /etc/fstab
-----> Create the mount point inside the fstab
UUID=C553-2BF5 /dataresize ext4 defaults 0 0
mount -a
df -hT
-----> get the mount point of it
But I am stuck with task 4 and task 5.
rhel partition lvm resize2fs lvreduce
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Please guide that how to do following tasks with executing command.
- 1.Create a new physical volume, create a new volume group in the name of
dataconresize
, vg extent is 16.00MB. - 2.Create a new logical volume in the name of
datacopyresize
with the size of 50 extents and file system mustext4
- 3.Then mount it under
/dataresize
- 4.Resize the logical volume,
logical-data
and it filesystem to 400MB. - 5.Resize the logical volume,
logical-data
and it filesystem to 600MB. Make sure that the filesystem contents remain intact.
Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.
I tried first three steps as follows.
fdisk /dev/vdb
----- > Create the Partition and set it's type 8e (which is LVM type)
partprobe /dev/vdb
-----> get the partition
pvcreate /dev/vdb1
vgcreate -s 16M dataconresize /dev/vdb1
vgdisplay
-----> Check the vg extent size, its should be this (PE Size 16.00 MiB)
lvcreate -l 50 -n datacopyresize dataconresize
lvdisplay
-----> Check the size of extents
mkfs.ext4 /dev/dataconresize/datacopyresize
-----> Make a filesystem on it
mkdir -p /dataresize
-----> Create Directory to mount on it
blkid /dev/dataconresize/datacopyresize
-----> Get the UUID of /dev/datacontainer/datacopy
vim /etc/fstab
-----> Create the mount point inside the fstab
UUID=C553-2BF5 /dataresize ext4 defaults 0 0
mount -a
df -hT
-----> get the mount point of it
But I am stuck with task 4 and task 5.
rhel partition lvm resize2fs lvreduce
Please guide that how to do following tasks with executing command.
- 1.Create a new physical volume, create a new volume group in the name of
dataconresize
, vg extent is 16.00MB. - 2.Create a new logical volume in the name of
datacopyresize
with the size of 50 extents and file system mustext4
- 3.Then mount it under
/dataresize
- 4.Resize the logical volume,
logical-data
and it filesystem to 400MB. - 5.Resize the logical volume,
logical-data
and it filesystem to 600MB. Make sure that the filesystem contents remain intact.
Note: partitions are seldom exactly the size requested,so any thing within the range of 370MB to 430MB is acceptable.
I tried first three steps as follows.
fdisk /dev/vdb
----- > Create the Partition and set it's type 8e (which is LVM type)
partprobe /dev/vdb
-----> get the partition
pvcreate /dev/vdb1
vgcreate -s 16M dataconresize /dev/vdb1
vgdisplay
-----> Check the vg extent size, its should be this (PE Size 16.00 MiB)
lvcreate -l 50 -n datacopyresize dataconresize
lvdisplay
-----> Check the size of extents
mkfs.ext4 /dev/dataconresize/datacopyresize
-----> Make a filesystem on it
mkdir -p /dataresize
-----> Create Directory to mount on it
blkid /dev/dataconresize/datacopyresize
-----> Get the UUID of /dev/datacontainer/datacopy
vim /etc/fstab
-----> Create the mount point inside the fstab
UUID=C553-2BF5 /dataresize ext4 defaults 0 0
mount -a
df -hT
-----> get the mount point of it
But I am stuck with task 4 and task 5.
rhel partition lvm resize2fs lvreduce
edited Apr 10 at 8:38
Kiwy
5,31243350
5,31243350
asked Apr 10 at 7:56
Eranda Peiris
307113
307113
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.
To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):
resize2fs /dev/dataconresize/datacopyresize 400M
lvresize -L 400M /dev/dataconresize/datacopyresize
Then to extend it to 600 Mb, you first resize the LV and then the filesystem:
lvresize -L 600M /dev/dataconresize/datacopyresize
resize2fs /dev/dataconresize/datacopyresize 600M
Note: you could use instead lvreduce
to shrink the LV and lvextend
to extend it; the advantage of lvresize
is that it offers an unique command for both operations.
Also, you could pass the --resizefs
argument to lvresize
to automatically resize the fs along with the LV, instead of using resize2fs
; I suggest you try my method, which uses two separate commands, to better understand what you're doing.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.
To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):
resize2fs /dev/dataconresize/datacopyresize 400M
lvresize -L 400M /dev/dataconresize/datacopyresize
Then to extend it to 600 Mb, you first resize the LV and then the filesystem:
lvresize -L 600M /dev/dataconresize/datacopyresize
resize2fs /dev/dataconresize/datacopyresize 600M
Note: you could use instead lvreduce
to shrink the LV and lvextend
to extend it; the advantage of lvresize
is that it offers an unique command for both operations.
Also, you could pass the --resizefs
argument to lvresize
to automatically resize the fs along with the LV, instead of using resize2fs
; I suggest you try my method, which uses two separate commands, to better understand what you're doing.
add a comment |Â
up vote
1
down vote
You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.
To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):
resize2fs /dev/dataconresize/datacopyresize 400M
lvresize -L 400M /dev/dataconresize/datacopyresize
Then to extend it to 600 Mb, you first resize the LV and then the filesystem:
lvresize -L 600M /dev/dataconresize/datacopyresize
resize2fs /dev/dataconresize/datacopyresize 600M
Note: you could use instead lvreduce
to shrink the LV and lvextend
to extend it; the advantage of lvresize
is that it offers an unique command for both operations.
Also, you could pass the --resizefs
argument to lvresize
to automatically resize the fs along with the LV, instead of using resize2fs
; I suggest you try my method, which uses two separate commands, to better understand what you're doing.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.
To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):
resize2fs /dev/dataconresize/datacopyresize 400M
lvresize -L 400M /dev/dataconresize/datacopyresize
Then to extend it to 600 Mb, you first resize the LV and then the filesystem:
lvresize -L 600M /dev/dataconresize/datacopyresize
resize2fs /dev/dataconresize/datacopyresize 600M
Note: you could use instead lvreduce
to shrink the LV and lvextend
to extend it; the advantage of lvresize
is that it offers an unique command for both operations.
Also, you could pass the --resizefs
argument to lvresize
to automatically resize the fs along with the LV, instead of using resize2fs
; I suggest you try my method, which uses two separate commands, to better understand what you're doing.
You have a LV called "datacopyresize" of size PE_size x 50 = 800 Mb.
To shrink it to 400 Mb you will need to resize first the filesystem, then the LV (otherwise you'll lose data):
resize2fs /dev/dataconresize/datacopyresize 400M
lvresize -L 400M /dev/dataconresize/datacopyresize
Then to extend it to 600 Mb, you first resize the LV and then the filesystem:
lvresize -L 600M /dev/dataconresize/datacopyresize
resize2fs /dev/dataconresize/datacopyresize 600M
Note: you could use instead lvreduce
to shrink the LV and lvextend
to extend it; the advantage of lvresize
is that it offers an unique command for both operations.
Also, you could pass the --resizefs
argument to lvresize
to automatically resize the fs along with the LV, instead of using resize2fs
; I suggest you try my method, which uses two separate commands, to better understand what you're doing.
edited Apr 10 at 8:32
answered Apr 10 at 8:20
dr01
15.3k114768
15.3k114768
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436710%2fhow-to-resize-logical-volume-in-red-hat-linux%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password