How to reduce a LVM partition without any kind of data loss from the partition without taking any backup?
Clash Royale CLAN TAG#URR8PPP
up vote
-4
down vote
favorite
- A 10 GB partition contains 5 GB data.
- This partition should be reduced to 8 GB
- No backup
linux ubuntu centos rhel lvm
add a comment |Â
up vote
-4
down vote
favorite
- A 10 GB partition contains 5 GB data.
- This partition should be reduced to 8 GB
- No backup
linux ubuntu centos rhel lvm
1
absolutely no process that imply to move data between two disk sectors are safe. the easiest way is to have another disk with the right amount of disk on it and do a copy. Shrinking partition is usually no big deal, but if your disk is more than 80% full after shrink you take some risks
â Kiwy
Oct 1 at 7:53
3
fact is, if you don't take a backup, no matter what answers you receive that may/may not work, there's always a possibility of data corruption when resizing. Particularly so when shrinking. Strongly recommend you take a backup nonetheless.
â RobotJohnny
Oct 1 at 8:23
add a comment |Â
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
- A 10 GB partition contains 5 GB data.
- This partition should be reduced to 8 GB
- No backup
linux ubuntu centos rhel lvm
- A 10 GB partition contains 5 GB data.
- This partition should be reduced to 8 GB
- No backup
linux ubuntu centos rhel lvm
linux ubuntu centos rhel lvm
asked Oct 1 at 7:47
Jibin K Benny
12
12
1
absolutely no process that imply to move data between two disk sectors are safe. the easiest way is to have another disk with the right amount of disk on it and do a copy. Shrinking partition is usually no big deal, but if your disk is more than 80% full after shrink you take some risks
â Kiwy
Oct 1 at 7:53
3
fact is, if you don't take a backup, no matter what answers you receive that may/may not work, there's always a possibility of data corruption when resizing. Particularly so when shrinking. Strongly recommend you take a backup nonetheless.
â RobotJohnny
Oct 1 at 8:23
add a comment |Â
1
absolutely no process that imply to move data between two disk sectors are safe. the easiest way is to have another disk with the right amount of disk on it and do a copy. Shrinking partition is usually no big deal, but if your disk is more than 80% full after shrink you take some risks
â Kiwy
Oct 1 at 7:53
3
fact is, if you don't take a backup, no matter what answers you receive that may/may not work, there's always a possibility of data corruption when resizing. Particularly so when shrinking. Strongly recommend you take a backup nonetheless.
â RobotJohnny
Oct 1 at 8:23
1
1
absolutely no process that imply to move data between two disk sectors are safe. the easiest way is to have another disk with the right amount of disk on it and do a copy. Shrinking partition is usually no big deal, but if your disk is more than 80% full after shrink you take some risks
â Kiwy
Oct 1 at 7:53
absolutely no process that imply to move data between two disk sectors are safe. the easiest way is to have another disk with the right amount of disk on it and do a copy. Shrinking partition is usually no big deal, but if your disk is more than 80% full after shrink you take some risks
â Kiwy
Oct 1 at 7:53
3
3
fact is, if you don't take a backup, no matter what answers you receive that may/may not work, there's always a possibility of data corruption when resizing. Particularly so when shrinking. Strongly recommend you take a backup nonetheless.
â RobotJohnny
Oct 1 at 8:23
fact is, if you don't take a backup, no matter what answers you receive that may/may not work, there's always a possibility of data corruption when resizing. Particularly so when shrinking. Strongly recommend you take a backup nonetheless.
â RobotJohnny
Oct 1 at 8:23
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
The following is as safe as youâÂÂll get without backups (i.e. quite safe, barring bugs or power failures at the wrong time, and even the latter arenâÂÂt necessarily disastrous):
Unmount the volume.
Resize the logical volume along with the file system it contains:
lvresize -r -L8G /path/to/lv
The
-r
option ensures that the file system is correctly resized before the LV is shrunk, so that the dropped extents are really unused; if anything fails during the file system resize, the LV wonâÂÂt be resized.Cry if anything goes wrong and you lose data.
I highly recommend backups though, but not specifically for disk operations: any data you care about should be backed up (and restored, if only to verify that it can be restored).
don't you have to doresize2fs
after ?
â Kiwy
Oct 1 at 7:54
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
@Kiwy Actually you have to do that before. But the-r
flag already takes care of shrinking the filesystem.
â dr01
Oct 1 at 7:56
2
@Kiwy the-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking,-r
will resize the file system before shrinking the volume; when enlarging,-r
will resize the file system after enlarging the volume.
â Stephen Kitt
Oct 1 at 7:59
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
 |Â
show 5 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
The following is as safe as youâÂÂll get without backups (i.e. quite safe, barring bugs or power failures at the wrong time, and even the latter arenâÂÂt necessarily disastrous):
Unmount the volume.
Resize the logical volume along with the file system it contains:
lvresize -r -L8G /path/to/lv
The
-r
option ensures that the file system is correctly resized before the LV is shrunk, so that the dropped extents are really unused; if anything fails during the file system resize, the LV wonâÂÂt be resized.Cry if anything goes wrong and you lose data.
I highly recommend backups though, but not specifically for disk operations: any data you care about should be backed up (and restored, if only to verify that it can be restored).
don't you have to doresize2fs
after ?
â Kiwy
Oct 1 at 7:54
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
@Kiwy Actually you have to do that before. But the-r
flag already takes care of shrinking the filesystem.
â dr01
Oct 1 at 7:56
2
@Kiwy the-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking,-r
will resize the file system before shrinking the volume; when enlarging,-r
will resize the file system after enlarging the volume.
â Stephen Kitt
Oct 1 at 7:59
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
 |Â
show 5 more comments
up vote
4
down vote
The following is as safe as youâÂÂll get without backups (i.e. quite safe, barring bugs or power failures at the wrong time, and even the latter arenâÂÂt necessarily disastrous):
Unmount the volume.
Resize the logical volume along with the file system it contains:
lvresize -r -L8G /path/to/lv
The
-r
option ensures that the file system is correctly resized before the LV is shrunk, so that the dropped extents are really unused; if anything fails during the file system resize, the LV wonâÂÂt be resized.Cry if anything goes wrong and you lose data.
I highly recommend backups though, but not specifically for disk operations: any data you care about should be backed up (and restored, if only to verify that it can be restored).
don't you have to doresize2fs
after ?
â Kiwy
Oct 1 at 7:54
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
@Kiwy Actually you have to do that before. But the-r
flag already takes care of shrinking the filesystem.
â dr01
Oct 1 at 7:56
2
@Kiwy the-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking,-r
will resize the file system before shrinking the volume; when enlarging,-r
will resize the file system after enlarging the volume.
â Stephen Kitt
Oct 1 at 7:59
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
 |Â
show 5 more comments
up vote
4
down vote
up vote
4
down vote
The following is as safe as youâÂÂll get without backups (i.e. quite safe, barring bugs or power failures at the wrong time, and even the latter arenâÂÂt necessarily disastrous):
Unmount the volume.
Resize the logical volume along with the file system it contains:
lvresize -r -L8G /path/to/lv
The
-r
option ensures that the file system is correctly resized before the LV is shrunk, so that the dropped extents are really unused; if anything fails during the file system resize, the LV wonâÂÂt be resized.Cry if anything goes wrong and you lose data.
I highly recommend backups though, but not specifically for disk operations: any data you care about should be backed up (and restored, if only to verify that it can be restored).
The following is as safe as youâÂÂll get without backups (i.e. quite safe, barring bugs or power failures at the wrong time, and even the latter arenâÂÂt necessarily disastrous):
Unmount the volume.
Resize the logical volume along with the file system it contains:
lvresize -r -L8G /path/to/lv
The
-r
option ensures that the file system is correctly resized before the LV is shrunk, so that the dropped extents are really unused; if anything fails during the file system resize, the LV wonâÂÂt be resized.Cry if anything goes wrong and you lose data.
I highly recommend backups though, but not specifically for disk operations: any data you care about should be backed up (and restored, if only to verify that it can be restored).
edited Oct 1 at 9:48
answered Oct 1 at 7:50
Stephen Kitt
149k23329396
149k23329396
don't you have to doresize2fs
after ?
â Kiwy
Oct 1 at 7:54
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
@Kiwy Actually you have to do that before. But the-r
flag already takes care of shrinking the filesystem.
â dr01
Oct 1 at 7:56
2
@Kiwy the-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking,-r
will resize the file system before shrinking the volume; when enlarging,-r
will resize the file system after enlarging the volume.
â Stephen Kitt
Oct 1 at 7:59
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
 |Â
show 5 more comments
don't you have to doresize2fs
after ?
â Kiwy
Oct 1 at 7:54
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
@Kiwy Actually you have to do that before. But the-r
flag already takes care of shrinking the filesystem.
â dr01
Oct 1 at 7:56
2
@Kiwy the-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking,-r
will resize the file system before shrinking the volume; when enlarging,-r
will resize the file system after enlarging the volume.
â Stephen Kitt
Oct 1 at 7:59
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
don't you have to do
resize2fs
after ?â Kiwy
Oct 1 at 7:54
don't you have to do
resize2fs
after ?â Kiwy
Oct 1 at 7:54
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
:) :) :) ......Actually i need to know about any proper method for that...or let me know is it possible or not.
â Jibin K Benny
Oct 1 at 7:55
@Kiwy Actually you have to do that before. But the
-r
flag already takes care of shrinking the filesystem.â dr01
Oct 1 at 7:56
@Kiwy Actually you have to do that before. But the
-r
flag already takes care of shrinking the filesystem.â dr01
Oct 1 at 7:56
2
2
@Kiwy the
-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking, -r
will resize the file system before shrinking the volume; when enlarging, -r
will resize the file system after enlarging the volume.â Stephen Kitt
Oct 1 at 7:59
@Kiwy the
-r
flag takes care of that, as dr01 mentions above, and will stop the whole process if the file system resize fails (e.g. because thereâÂÂs too much data). When shrinking, -r
will resize the file system before shrinking the volume; when enlarging, -r
will resize the file system after enlarging the volume.â Stephen Kitt
Oct 1 at 7:59
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
Did the LVM arrange the allocated PE's before shrinking or they simply shrink it??
â Jibin K Benny
Oct 1 at 8:14
 |Â
show 5 more comments
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%2f472518%2fhow-to-reduce-a-lvm-partition-without-any-kind-of-data-loss-from-the-partition-w%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
1
absolutely no process that imply to move data between two disk sectors are safe. the easiest way is to have another disk with the right amount of disk on it and do a copy. Shrinking partition is usually no big deal, but if your disk is more than 80% full after shrink you take some risks
â Kiwy
Oct 1 at 7:53
3
fact is, if you don't take a backup, no matter what answers you receive that may/may not work, there's always a possibility of data corruption when resizing. Particularly so when shrinking. Strongly recommend you take a backup nonetheless.
â RobotJohnny
Oct 1 at 8:23