LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-18-2019, 07:46 PM   #1
yelirt5
LQ Newbie
 
Registered: Jan 2019
Posts: 29

Rep: Reputation: Disabled
Resizing Imaged Hard drive


Thought someone here might be able to advise me if what I'd like to do is even feasible.

Would like to take a Clonezilla image of a Rhel 7.6 Server system built on a 140GB and put that image on a 500GB drive. I'm wondering what tools I can use to take advantage of the HD space gain. The drive is split up into LVMs based on DOD Stig (/, /boot/ home/ /var /var/log, /var/log/audit, /tmp, and /swp.

What I'd like to do is to either create another LVM from the additional space or at least add it to home.

Can someone tell me if this is even possible?

Thanking you in advance....
 
Old 12-18-2019, 08:01 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Piece of cake.
Most people want to restore onto a smaller target - that's a no-no. For you, just restore it and either resize the pv (if just one), or create a new pv and add it to the appropriate vg. Then start resizing your lv(s)/filesystem(s).
 
1 members found this post helpful.
Old 12-18-2019, 08:03 PM   #3
yelirt5
LQ Newbie
 
Registered: Jan 2019
Posts: 29

Original Poster
Rep: Reputation: Disabled
yes, definitely will have a backup.

Thanks for the response Happy Holidays!
 
Old 12-18-2019, 08:24 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
That's just my sigline. Your image is your backup. Do it.
 
Old 12-19-2019, 10:58 AM   #5
yelirt5
LQ Newbie
 
Registered: Jan 2019
Posts: 29

Original Poster
Rep: Reputation: Disabled
Well, tried what was suggested and the system won't boot. So I'm putting the clonezilla image back on the system in order to try again.

Does it matter that the system boots from the new 500GB drive?
 
Old 12-19-2019, 04:31 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Seeing as we cannot know what you did, or didn't, do - and whether it was correct, you'll have to do some basic diagnostics.
Restore the image onto the new disk. Does it boot ?. Does it boot if you remove the old disk ?.
Once you have a boot-able system, proceed in steps and reboot each time. Where does it break ?.
 
Old 12-19-2019, 05:01 PM   #7
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
Might be a silly question, but did you image the whole drive, or just the partition?
 
1 members found this post helpful.
Old 12-19-2019, 05:16 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
A few ways to go I'd think.

Either restore to the new drive and expand it all or restore to some other resource and then use a file by file method to move if you can't expand LVM. https://www.linuxtechi.com/extend-lvm-partitions/

Usually you have to use a similar level live media I'd think to access /boot. It could be that your data can be grown.
 
1 members found this post helpful.
Old 12-20-2019, 07:18 AM   #9
yelirt5
LQ Newbie
 
Registered: Jan 2019
Posts: 29

Original Poster
Rep: Reputation: Disabled
Yes I am imaging the whole drive. I have to, that's the way the image was originally created.
 
Old 12-20-2019, 11:03 AM   #10
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
Smaller drive to larger drive.
Ext4, 3 partitions example.

Stick larger drive in machine, clone sda to sdb. Depending on the drive size this could take a while. A 160GB drive takes about 25 min. Also depends on bus speed, drive speed blahblah..
Code:
dd if=/dev/sda of=/dev/sdb bs=1M
New drive. You can move the end of the last partition to the end of the drive.
Code:
(parted) resizepart 3 100%
Then resize the file system to the end of that partition on the new drive.
Code:
resize2fs /dev/sdb3 100%
You can't move the start of the partitions. You can move the last partition on the drive to take the free space of the larger drive.

So if you have sdb1 sdb2 sdb3...you can move the end of sdb3 to the end of the drive, or move it a little and make a sdb4, etc.
 
Old 12-20-2019, 01:04 PM   #11
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498

Rep: Reputation: Disabled
Maybe you could loop mount your imaged file, then create your new disk partitioning, then copy each partitions files to their new partitions(?).
 
Old 12-20-2019, 01:09 PM   #12
yelirt5
LQ Newbie
 
Registered: Jan 2019
Posts: 29

Original Poster
Rep: Reputation: Disabled
I apologize for my confusion. I'm not exactly new to Linux, but definitely new to doing something like this.

This is a system that has only 1 drive in it. Originally that was a 300GB drive although it was loaded from a CLonezilla live CD with an OS originally configured with a 140GB drive. . Now they want to put a 500GB drive in this system, image it with the same Clonezilla image that captured as before, but be able to gain the space. So I've put the 500GB drive in the system and loaded the Clonezilla image. Below are the results of the command "df -h". As you can see it thinks that it's only a 140GB drive (or so).


Mounted on: Size:
/dev/mapper/rhel-root / 15G
devtmpfs /dev 16G
tmpfs /dev/shm 16G
tmpfs /run 16G
tmpfs /sys/fs/cgroup 16G
tmpfs /tmp 9.8G
/dev/sda1 /boot 9.8G
/dev/mapper/rhel-var /var 9.8G
/dev/mapper/rhel-home /home 45G
/dev/mapper/rhel-log /var/log 9.8G
/dev/mapper/rhel-audit /var/log/audit 9.8G
tmpfs /run/user/210 3.2G

Output of command "pvdisplay"

/dev/sda2 (there's more output I'm not sure what's relevant)


If I enter "lvdisplay" it basically lists all the volumes as above: /, /home /swap /tmp /home /var /var/log/ and /var/log/audit

I'm just not sure what the first step is. Last time I tried pvresize, then lvextend. I'm sure I'm omitting steps or something is out of order here.
 
Old 12-20-2019, 03:36 PM   #13
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
Were you able to read post 10. I told you exactly how to resize it. Move the end of the last partition to wherever you want it, then extend the file system on it.

What is the output of
Code:
fdisk -l

or

parted -l
If you have sda1 sda2 and sda3, and you want to extend sda2 for example:

1. You'll need to backup sda3,

2. Then delete the partition sda3

3. Move the end of sda2 where you want it

4. Extent the FS on sda2

5. Make a new sda3 out of the free space that is left

6. Put a file system on sda3

7. Put your stuff back on it if it will fit.

Or if you just want to enlarge sda3, that's easy.

1. Move the end of the partition sda3 where you want it

2. Extend the file system on it.
 
Old 12-20-2019, 07:29 PM   #14
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
You could get a gparted live image to boot from and use a nice GUI to resize things.
https://gparted.org/index.php
 
Old 12-20-2019, 08:28 PM   #15
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
You have an LVM volume or more than one.
"
/dev/mapper/rhel-var /var 9.8G
/dev/mapper/rhel-home /home 45G
/dev/mapper/rhel-log /var/log 9.8G
/dev/mapper/rhel-audit /var/log/audit 9.8G"

Right?

The reference here is that the LVM sits on a drive. /dev/sda1 /boot 9.8G and that you seem to have a dedicated /boot outside of the LVM.

I believe that you could clone to the larger disk. Then expand the LVM using a live media. Leave /boot untouched.
 
  


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
Forgot how I imaged my hard drive, dd, ddrescue, ntfsclone??? antares4141 Linux - Software 3 01-24-2013 09:56 PM
recreate server on another server, not imaged qwertyjjj Linux - Server 4 08-25-2011 12:15 AM
Newly imaged PC won't boot ketchukf Linux - Newbie 2 09-05-2009 09:12 AM
Mount Imaged NTFS Drive quentusrex Linux - General 1 05-25-2005 05:05 PM
Linux Redhat Imaged / Cloned randybell Linux - Newbie 1 11-16-2004 07:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:31 PM.

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