LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-03-2020, 04:16 PM   #1
vermio
LQ Newbie
 
Registered: Jan 2016
Posts: 3

Rep: Reputation: Disabled
Smile Reduce size of /dev/sdb2


Hello,

I'd like to reduce the size of my linux partition.
Is that possible?

My partition info is this:
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 234440703 116170752 8e Linux LVM

After the resize I may have a new /dev/sdb3 partition.

I user Centos 7.

Thank you,
Nikos
 
Old 12-03-2020, 04:55 PM   #2
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,173

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
Yes, you can resize the partitions. First step is to make sure you files are backed up, because things could go wrong.
The easiest way is with a bootable system like gparted, https://gparted.org/liveusb.php. It is nice graphical system to resize partitions.
 
Old 12-03-2020, 06:03 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,717

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
It depends. What are you trying to accomplish?

I assume you selected default partitioning which uses xfs filesystems and no free space exists with in the PV. Unfortunately, xfs filesystems can not be resized smaller.

/dev/sdb2 which is a LVM contains the volume group and logical volumes which are your /root, /home and swap filesystems. The only way to "shrink" xfs is to backup your system, delete the LVs, create new LVs/filesystems and restore.
 
Old 12-03-2020, 08:13 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
https://www.rootusers.com/lvm-resize...lvm-partition/
 
Old 12-05-2020, 03:39 AM   #5
vermio
LQ Newbie
 
Registered: Jan 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
What I initially wanted to do is to clone my linux disk to a new one that had exactly the same size.
I tried from windows first using Acronis Director.
That was not possible because although the size was identical there was an error before the copying that the size is not enough.
And I couldn't select to copy part of the disk neither resize.

So, I thought resizing from Centos.
After your advises, I chose Gparted.
I created a livecd and when it loaded I get disappointed because it could not copy the partition: there was a message that something from lvm2 needs to install.
Nevertheless, I managed to shrink /dev/sdb2 for 4Mb. That was all I was allowed to do from Gparted.
And yes, those 4mb were enough for Acronis (Windows again) to permit me to clone the disk (no error for not enough space now).

I copied both of the partitions (I set active the boot partition). No errors.
Now, when I try to boot from the newly created disk, I have two errors:
MBR Error 3
MBR Error 1

I followed the instructions https://cstan.io/?p=8878&lang=en here to restore the MBR but when I booted, same errors.

Any ideas?
 
Old 12-05-2020, 06:16 AM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,523

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
In your last post, you first say "And yes, those 4mb were enough for Acronis (Windows again) to permit me to clone the disk (no error for not enough space now)." Then you say you copied both of the partitions. You need to copy/clone the entire drive to include the MBR. The link below explains those errors and has suggestons on fixing the problem.



https://recoverit.wondershare.com/co...ror-1-2-3.html
 
Old 12-05-2020, 02:11 PM   #7
vermio
LQ Newbie
 
Registered: Jan 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
I copied the entire disk using Acronis and this time it worked!

Thank you all and especially thanks to yancek for his last advice
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Slackware14.2 on sda, Slackware -current on sdb: LILO in mbr(sda) and sdb2. How to remove lilo from sdb2 san2ban Slackware 11 07-04-2020 12:30 PM
[SOLVED] Boot Problem, kernel try to mount /dev/sdb2 on /mnt slack 14.1 on usb gamamtz Slackware 5 03-16-2015 05:32 PM
Error mounting /dev/sdb2, wrong fs type, bad option, bad superblock on /dev/sdb2 ashangel Linux - Kernel 3 08-06-2012 03:41 AM
/dev/sdb2 already mounted or /mnt/other busy klmaustin Linux - Hardware 5 12-12-2009 09:25 AM
Software RAID1 problems, won't take /dev/sdb2 ? michaelsanford Linux - General 4 01-08-2006 07:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration