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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
12-18-2019, 07:46 PM
|
#1
|
LQ Newbie
Registered: Jan 2019
Posts: 29
Rep: 
|
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....
|
|
|
12-18-2019, 08:01 PM
|
#2
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,359
|
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.
|
12-18-2019, 08:03 PM
|
#3
|
LQ Newbie
Registered: Jan 2019
Posts: 29
Original Poster
Rep: 
|
yes, definitely will have a backup.
Thanks for the response Happy Holidays!
|
|
|
12-18-2019, 08:24 PM
|
#4
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,359
|
That's just my sigline. Your image is your backup. Do it.
|
|
|
12-19-2019, 10:58 AM
|
#5
|
LQ Newbie
Registered: Jan 2019
Posts: 29
Original Poster
Rep: 
|
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?
|
|
|
12-19-2019, 04:31 PM
|
#6
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,359
|
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 ?.
|
|
|
12-19-2019, 05:01 PM
|
#7
|
Senior Member
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: KDE Neon
Posts: 1,259
|
Might be a silly question, but did you image the whole drive, or just the partition?
|
|
1 members found this post helpful.
|
12-19-2019, 05:16 PM
|
#8
|
Moderator
Registered: Mar 2008
Posts: 22,350
|
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.
|
12-20-2019, 07:18 AM
|
#9
|
LQ Newbie
Registered: Jan 2019
Posts: 29
Original Poster
Rep: 
|
Yes I am imaging the whole drive. I have to, that's the way the image was originally created.
|
|
|
12-20-2019, 11:03 AM
|
#10
|
LQ Guru
Registered: Oct 2004
Distribution: Arch
Posts: 5,385
|
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.
|
|
|
12-20-2019, 01:04 PM
|
#11
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,823
Rep: 
|
Maybe you could loop mount your imaged file, then create your new disk partitioning, then copy each partitions files to their new partitions(?).
|
|
|
12-20-2019, 01:09 PM
|
#12
|
LQ Newbie
Registered: Jan 2019
Posts: 29
Original Poster
Rep: 
|
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.
|
|
|
12-20-2019, 03:36 PM
|
#13
|
LQ Guru
Registered: Oct 2004
Distribution: Arch
Posts: 5,385
|
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.
|
|
|
12-20-2019, 07:29 PM
|
#14
|
Senior Member
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: KDE Neon
Posts: 1,259
|
You could get a gparted live image to boot from and use a nice GUI to resize things.
https://gparted.org/index.php
|
|
|
12-20-2019, 08:28 PM
|
#15
|
Moderator
Registered: Mar 2008
Posts: 22,350
|
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.
|
|
|
All times are GMT -5. The time now is 07:25 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|