LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-05-2017, 12:10 AM   #1
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Rep: Reputation: 38
Adding a partition to a hard drive?


Using Hydrogen1 (Bunsenlabs), derived from Debian Jessie.
Have my hard drive partitioned: / /home swap
Want to add another partition to add another operating system to it. I would rather not have to reinstall. Would use my home directory to repartition and copy back the files with rsync. Is this going to mess up things like fstab or boot loader?

I might have to install a windows partition. If I do that then will I need to install windows in the 1st partition? If so can I rearrange the order of the partitiions?

Joe
 
Old 03-05-2017, 12:16 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,137

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
It's not just the number of partitions - we need to know type, order, free space, ...
Code:
sudo parted /dev/sda "print free"
 
Old 03-06-2017, 03:43 PM   #3
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by syg00 View Post
It's not just the number of partitions - we need to know type, order, free space, ...
Code:
sudo parted /dev/sda "print free"
joe@BunsenLabs:~$ sudo parted /dev/sda "print free"
Model: ATA ST3500418AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 43.0GB 43.0GB primary ext4 boot
2 43.0GB 493GB 450GB primary ext4
3 493GB 500GB 7107MB primary linux-swap(v1)
500GB 500GB 1073kB Free Space
 
Old 03-07-2017, 11:07 PM   #4
itsgregman
Member
 
Registered: Jan 2008
Location: North Carolina
Distribution: Slackware 14.1
Posts: 211

Rep: Reputation: 77
Assuming partition 2 is home why not simply shrink it down to a smaller size rather than attempt to move home?
You could make home 100 gigs and still have 350 left to play with.

edit

Sorry I didn't see that you were trying to make room for a windows partition, that does complicate it somewhat.

If I were trying to do what you are I would boot into a live gparted session, I would then move the beginning of my /home partition forward until it was 100g in size (assuming there is less than 100g of data on that partition) then finalize that action. then move the end of my / partition forward to the beginning of my /home partition then finalize that action. I would then move the beginning of / forward until it was the size I wanted it to be then finalize that action. This should leave you with around 350 gigs at the beginning of your disk for windows if you left / about the same size as it currently is.
The only issue you are likely to have is your partition numbering is likely to change so your bootloader will need to be rerun and you may have to edit /etc/fstab. But as you are installing Windows your MBR will be overwritten by Windows anyway.

Last edited by itsgregman; 03-07-2017 at 11:40 PM.
 
Old 03-12-2017, 05:37 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,137

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
Sorry, missed that OP had responded. Has this been resolved ?.

I tend to mess around with things as little as possible, so whilst the reply above is perfectly feasible, I would simply resize /dev/sda2 - Windoze doesn't need to be the first partition, but it does need to be a primary. And it might even demand 2 partitions - the second of which can be a logical partition. It also needs (or used to last I checked) to have the boot flag set, so you'd have to remove it from /dev/sda1 - that can be done in advance as Linux loaders ignore the presence of the flag.
If you merely do as I suggest, there will be no need to mung fstab or grub, although as mentioned Windoze will over-write the grub code in the MBR - can be fixed easily enough from a liveCD.
 
Old 03-12-2017, 06:47 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
seeing how you got a split system. If you can login ROOT then do so that will put you on the root side. Unmount /home resize it then take what you took away and use that for whatever you want. Gparted - I do this all of the time, or have done this many times before.

remember you only get 4 primary if more partitions then the 4th needs to be used for the place holder for the logical partitions.


Therefore I do not think Gparted can do logical if not then use GParted to resize then cfdisk to create you two other partitions


Windows like that other said, but my windows 10 took three partitions. fyi
Code:
├─sda1        8:1    0   500M  0 part 
├─sda2        8:2    0  97.2G  0 part /media/win10
├─sda3        8:3    0   450M  0 part

Last edited by BW-userx; 03-12-2017 at 06:55 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying a partition from one hard drive to the same partition on another hard drive pylagan Linux - General 1 03-23-2010 12:02 PM
Adding a partition to a USB hard drive Robhogg Solaris / OpenSolaris 6 11-13-2009 07:12 AM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
adding space to existing partition using new hard drive jcai Linux - Hardware 3 06-06-2006 07:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:18 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