LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   How To Move Linux Partitions To A Single Partition (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/how-to-move-linux-partitions-to-a-single-partition-4175526548/)

njdevils9 11-26-2014 03:05 AM

How To Move Linux Partitions To A Single Partition
 
Hey everyone I had a question about paritioning with Linux... I am using a Acer Aspire V5-122P-0889 laptop. I currently have it dual-booted with Windows 8.1 and Arch Linux. I am getting tired of logging into Windows 8.1 and running Kali Linux (kind of laggy) through VirtualBox so I was wanting to Triple-boot my machine.. I tried to create a New Volume in Windows Disk Management tool but it says that I have too many partitions on my HDD and can not create another Volume. When I installed Arch I created 3 partitions; one for '/', one for '/home' and the other was my for swap. I was wanting to see if I could move the /home and/or swap partitions to the '/' partition so that I can install Kali on my machine via my USB stick (no CD drive)... My '/' partition is set to /dev/sda3 , /home partition is set to /dev/sda6 , swap partition is set to /dev/sda5 and for some reason I have an extended partition on /dev/sda4 that I am currently not sure what is being stored there. Anyways, I'd appreciate any help I could get as to how I can put my Arch Linux partitions into 1 big partition or maybe even 2 partitions if needed but the least partitions the better so that I can attempt to install Kali on a newly created partition.

EDDY1 11-26-2014 03:09 AM

Post output of
Quote:

fdisk -l

syg00 11-26-2014 03:11 AM

Don't use Windows to create Linux partitions. Leave the space unallocated, and Kali should create whatever partitions it needs during install.
From an Arch terminal enter this (as root/sudo) and post all the output
Code:

parted /dev/sda "print free"

njdevils9 11-26-2014 03:19 AM

1 Attachment(s)
Quote:

Originally Posted by EDDY1 (Post 5275242)
Post output of

***UPDATED***

I didn't know how much of a difference it would make but I removed the 30GB of unallocated space that I created from my C:\ right before this thread was started just in case.. It shouldn't make much of a difference but here is the updated screenshot of how it originally was.

njdevils9 11-26-2014 03:27 AM

1 Attachment(s)
Quote:

Originally Posted by syg00 (Post 5275244)
Don't use Windows to create Linux partitions. Leave the space unallocated, and Kali should create whatever partitions it needs during install.
From an Arch terminal enter this (as root/sudo) and post all the output
Code:

parted /dev/sda "print free"

***UPDATED***

I didn't know how much of a difference it would make but I removed the 30GB of unallocated space that I created from my C:\ right before this thread was started just in case.. It shouldn't make much of a difference but here is the updated screenshot of how it originally was.

Sorry for the hassel everyone..

EDDY1 11-26-2014 03:27 AM

I would resize sda2 if it's not full
It looks like you have some free space between sda2 & sda3
I would also boot to gpated-live cd/usb
Move sda3 to the left
Grow sda4 to the left
Move sda5 to the left
Move sda6 to the left
Use unallocated space for new install

EDDY1 11-26-2014 03:32 AM

You have 32.4G free space between sda2 & sda3 move it to the other side of sda6

Teufel 11-26-2014 03:40 AM

Do not touch extended partition! It will remove your swap and home partitions!
Extended patition was created when you installed Arch.

EDDY1 11-26-2014 03:43 AM

Quote:

Originally Posted by Teufel (Post 5275261)
Do not touch extended partition! It will remove your swap and home partitions!
Extended patition was created when you installed Arch.

The OP can move the partition & if they wanted to can delete but would have to edit fstab to reflect the change.
Which would make sda6 sda5

Teufel 11-26-2014 03:55 AM

Yes, he can move extended partition. When I wrote "do not touch" I meant "do not delete" it, because OP wrote:
Quote:

...I can remove it if need be...
Removing extended partition will remove sda5 & sda6 and you can't restore them simply by editing fstab.

EDDY1 11-26-2014 04:02 AM

Quote:

Originally Posted by Teufel (Post 5275268)
Yes, he can move extended partition. When I wrote "do not touch" I meant "do not delete" it, because OP wrote:

Removing extended partition will remove sda5 & sda6 and you can't restore them by editing fstab.

My apologies I misread your post or should I say didn't read into it enough & made a statement too hastily.

fatmac 11-26-2014 06:00 AM

Quote:

When I installed Arch I created 3 partitions; one for '/', one for '/home' and the other was my for swap. I was wanting to see if I could move the /home and/or swap partitions to the '/' partition so that I can install Kali on my machine via my USB stick (no CD drive)... My '/' partition is set to /dev/sda3 , /home partition is set to /dev/sda6 , swap partition is set to /dev/sda5 and for some reason I have an extended partition on /dev/sda4 that I am currently not sure what is being stored there. Anyways, I'd appreciate any help I could get as to how I can put my Arch Linux partitions into 1 big partition or maybe even 2 partitions if needed but the least partitions the better so that I can attempt to install Kali on a newly created partition.
After you have copied, as root, your whole /home/<username>, [all your data, including .(dot) files], from your present /home directory into your (sda3) / as something like /tmp-home, alter your /etc/fstab on /dev/sda3 so that it no longer points to /dev/sda6, copy all of /tmp-home to your /home directory, rename it /home/<username>, run chown -R <user>:<group> /home/<username>, then reboot. Everything should be working as normal.

You can now use sda6 to install to, (your present swap partition will be used by your new installation as well as your original distro).

Your sda4 partition holds the info about your extended partitions.

yancek 11-26-2014 07:49 AM

If you move sda3 to the left, your location for boot files will also be moved so the Grub code in the mbr will not be able to find its files, they won't be in the specified location so I expect you will need to chroot into Arch and reinstall Grub.

Is there any reason why you did not use GPT partitioning with this system? If you had, you could simply have shrunk sda2 and created another primary partition there for your install.

Teufel 11-26-2014 08:04 AM

Patitioning schema was messed from the very beginning so it isn't a good idea to keep things like they exists now. Yes home content migth be moved to root partition, but there might be no enough free space to fit home files.
I noticed the OP removed free space before sda3 (but where this free space gone?) and I think partitions completely messed. And now its a good reason to bring everything in order
I would suggest the following:
1. Backup Arch root & home filesystems
2. Remove all the partitions except sda1 and sda2
3. Create extended partition for all the rest free space
4. Create 3 partitions inside the extended one so they would be populated with two linux systems plus swap. Do not separate home from root.
5. Move Arch backup to his partition and restore bootloader to get Arch bootable. I would rather reinstall Arch at all.
6. Install Kali at his partition and add it to boot menu.

And do not use Windows for any partitioning/deleting/moving operations. Do it from Linux liveCD/USB

njdevils9 11-26-2014 11:09 PM

3 Attachment(s)
Quote:

Originally Posted by EDDY1 (Post 5275253)
I would resize sda2 if it's not full
It looks like you have some free space between sda2 & sda3
I would also boot to gpated-live cd/usb
Move sda3 to the left
Grow sda4 to the left
Move sda5 to the left
Move sda6 to the left
Use unallocated space for new install

When you say move each sda (3-6) to the left what do you mean? How do you go about doing that? The only programs I see installed that have anything to do with viewing and possibly configuring my partitions is either the program called Disks, Disk Usage Analyzer or KDisks free.. I'm terrible with working with partitions especially on Linux..

Soapm 11-27-2014 12:22 AM

See if you have gparted installed. It should be self explanatory if you're using a gui version of that program. Or you can download the live cd of gparted and it will do the job.

Sorry I didn't read the entire thread.

njdevils9 11-27-2014 12:51 AM

1 Attachment(s)
Quote:

Originally Posted by EDDY1 (Post 5275272)
My apologies I misread your post or should I say didn't read into it enough & made a statement too hastily.

A view of my HDD and its partitions via GParted..

Teufel 11-27-2014 03:47 AM

As it shown at picture, if you don't want to repartition your drive, the only way to get a space for Kali is moving /home content to sda3. After that you can re-format sda6 and install Kali there.

EDDY1 11-27-2014 04:10 AM

You need to run it from live-cd you can't do it from a running system. Also take note of the yellow flag on /dev/sda2, you need to run Chkdsk on it from windows

njdevils9 11-27-2014 11:53 PM

Can I just move /sda4 to my /sda3 since /sda4 is like a main directory
and my swap and home partitions (/sda5 and /sda6) are subdirectories.
Then I would have the ability to create one more partition and use
that to install Kali on it.. If so can I use the steps in this
website???
http://www.maketecheasier.com/move-home-folder-ubuntu/

Sorry, I am more of a visual person and need to see how to do
something or else I'll screw everything up unless I am given specific
detailed instructions..

Also, I ran chkdsk and "repaired" the errors and the yellow flag is still there..

EDDY1 11-28-2014 12:01 AM

That's not necessary. If you follow the instrctions I posted earlier you will be able to install within the Extended partitions. But use gparted-live-cd/usb to do the job.

yancek 11-28-2014 08:29 AM

Quote:

Can I just move /sda4 to my /sda3 since /sda4 is like a main directory
No. sda4 is a primary partition being used as an Extended partition which shows in your GParted image. Extended partitions do not contain data but contain logical partitions, in your case sda5 and sda6. You can move the data in your /home partition (sda6) to the / partition (sda3) then use the sda6 partition to install a new OS. This was suggested above and would probably be the simplest. There are other options but part of the problem is that shrinking sda2 won't help as you already have four primary partitions and to expand a partition, the unallocated space needs to be contiguous and your Extended partition has the / partition (sda3) between it (sda4) and the enormous windows partition (sda2).

EDDY1 11-28-2014 10:48 AM

The unallocated space between sda2 & sda3 can be incorporated into the Extended partition it just takes a little manipulatinon to get it done.

yancek 11-28-2014 12:44 PM

Quote:

The unallocated space between sda2 & sda3 can be incorporated into the Extended partition it just takes a little manipulatinon to get it done.
Don't see how since partitions need to be contiguous and the / filesystem is between the Extended and windows partition. Also, at present that is only 1MB which won't help. Your suggestion in post #6 above would work but the other suggestion someone posted earlier to just copy the data from his home partition to the / partition would seem a lot easier, particularly for someone without much experience. This would still leave the OP with about 10GB of free space on the partition and the former home partition on which to install the new system.

EDDY1 11-28-2014 03:08 PM

Read my instructions in post #6

yancek 11-28-2014 04:22 PM

Quote:

Read my instructions in post #6
I did and said in my previous post that I thought that would work. Mistakenly indicated post #3 instead of post #6. It would still be much simpler to copy the files to sda3 from the home partition, especially for someone who has apparently little experience as it would involve moving not just the partitions but the data and the / partition and its boot files would be moved and I indicated in an earlier post, would then require chrooting to modify the boot files as the sector on which the Grub files are would obviously be moved.

EDDY1 11-28-2014 04:49 PM

Quote:

It would still be much simpler to copy the files to sda3 from the home partition, especially for someone who has apparently little experience as it would involve moving not just the partitions but the data and the / partition and its boot files would be moved and I indicated in an earlier post, would then require chrooting to modify the boot files as the sector on which the Grub files are would obviously be moved.
Actually I had a problem with systemd & my /usr partition. Systemd doesn't like seperate /usr. So I had to move /usr to /. Just copying the data to / doesnt work, it ignores certain directories
Here's a link to my post which I forgot to mark solved & explain what I did.
http://www.linuxquestions.org/questi...en-4175517426/
Anyway I had to mount my partitions from live-cd
mkdir /usr2
cp /usr /usr2
rename usr2 to /usr
edit fstab
reboot
Even tho it's easy now to do it, that is a lot harder than using gparted-live
select a partition
select move/resize
put mouse in center of the partition & drag it left.
The only partition you can't drag is the extended, which you just grab the left side of the partition & expand it to the left.
The uuid for / doesn't change so no rescue necessary.

Also I just want to say that I know that you know what you're doing when it comes to computers & all of your information is great, so anything I have said in this thread is not a personal attack. In most cases, I only offer advice for things which have worked for me.
So please accept my apologies.

Teufel 11-28-2014 05:19 PM

Quote:

Originally Posted by EDDY1 (Post 5276486)
Actually I had a problem with systemd & my /usr partition. Systemd doesn't like seperate /usr. So I had to move /usr to /.

Sorry for offtop, it might be interesting for you:
http://forums.gentoo.org/viewtopic-t-901206.html

EDDY1 11-28-2014 08:12 PM

Quote:

Originally Posted by Teufel (Post 5276495)
Sorry for offtop, it might be interesting for you:
http://forums.gentoo.org/viewtopic-t-901206.html

No I fix my Problem by moving it to/

yancek 11-28-2014 09:18 PM

Quote:

anything I have said in this thread is not a personal attack.
No problem, I didn't take anything as personal so no apology necessary. I don't know why copying the /home directory from its partition to the / partition would not work or why you had a problem with your /usr partition. I copied the entire / filesystem to a new partition on a different drive and it booted after modifying Grub. The only problem I wonder about in the situation described by the OP is resizing and moving data to the left thus changing the sector location where Grub looks for its boot files. This is referenced at the GParted site at the link below, the image under number 5 in the resizing tutorial. I'm not inclined to test this on my machines so we'll wait for the OP to return and see what happened.

http://gparted.org/display-doc.php?n...een-partitions


All times are GMT -5. The time now is 12:15 AM.