How to reduce a LVM partition without any kind of data loss from the partition without taking any backup?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-4
down vote

favorite












  1. A 10 GB partition contains 5 GB data.

  2. This partition should be reduced to 8 GB

  3. No backup









share|improve this question

















  • 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














up vote
-4
down vote

favorite












  1. A 10 GB partition contains 5 GB data.

  2. This partition should be reduced to 8 GB

  3. No backup









share|improve this question

















  • 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












up vote
-4
down vote

favorite









up vote
-4
down vote

favorite











  1. A 10 GB partition contains 5 GB data.

  2. This partition should be reduced to 8 GB

  3. No backup









share|improve this question













  1. A 10 GB partition contains 5 GB data.

  2. This partition should be reduced to 8 GB

  3. No backup






linux ubuntu centos rhel lvm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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












  • 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










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):



  1. Unmount the volume.



  2. 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.



  3. 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).






share|improve this answer






















  • 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










  • @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










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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):



  1. Unmount the volume.



  2. 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.



  3. 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).






share|improve this answer






















  • 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










  • @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














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):



  1. Unmount the volume.



  2. 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.



  3. 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).






share|improve this answer






















  • 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










  • @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












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):



  1. Unmount the volume.



  2. 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.



  3. 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).






share|improve this answer














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):



  1. Unmount the volume.



  2. 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.



  3. 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).







share|improve this answer














share|improve this answer



share|improve this answer








edited Oct 1 at 9:48

























answered Oct 1 at 7:50









Stephen Kitt

149k23329396




149k23329396











  • 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










  • @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










  • :) :) :) ......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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay