LinuxQuestions.org
Review your favorite Linux distribution.
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 01-05-2015, 04:26 AM   #16
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172

Quote:
Originally Posted by schneidz View Post
didnt know you could change a primary partition to an extended without data loss.
Always assume that there is potential for data loss, especially when editing partitions.

Assuming that you have an external hdd available with enough free space, you can easily backup entire partitions using dd. The process is time consuming and great care must be taken to ensure that you have the correct destination path or you will end up over-writing valuable data.

If your external drive is mounted on /media/backup/ for example, your command would look something like this;
Code:
dd if=/dev/sda1 of=/media/backup/partition1.img bs=1M
/dev/sda1 would be /dev/sdb1 or /dev/sdc1 etc. if you've connected that drive to another PC to work on it. (or booted from a different hdd)
partition1.img can be any file name you choose, but make certain you include a file name or dd will simply over-write the directory.
bs=1M can be bs=1G or bs=3G etc. as long as you have enough free ram to support it.

Note that this can take several hours to complete in some cases and the larger the partition is, the longer it will take.

P.S: it is also not a good idea to try copying a mounted partition as any access to that partition can corrupt the image file you're creating. If you must mount the partition, mount it as read-only.
 
Old 01-05-2015, 06:12 AM   #17
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by yancek View Post
it will using GPT
As I have already mentioned, the disk is an MBR type -- look at the output of `fdisk`:
Quote:
Code:
Disklabel type: dos
 
Old 01-05-2015, 09:46 AM   #18
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,111
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Quote:
Could you be so kind to instruct me, how do I rename sdc3 from primary to extended and create inside it a couple of logical partitions without losing my "foo" file?
Ok. I am not a Gentoo user. Programmer. Blah blah blah.

Just a Linux using Scooter Tramp.

I noticed the problem you present me has nothing to do with Windows. But that is OK. I have broad shoulders and can handle that also.

Download and md5sum check and burn a

edit: DOH. Dumb ass Biker. Wrong link previously. http://www.partitionwizard.com/free-...n-manager.html

cd. Use your bios key to boot the live cd. Open the partitioner tool. It will look sorta like this old picture



Right click on "foo" . Pick change to logical. Hit apply. When done shut down the cd and computer.

You can do the shrinking and other stuff in Gentoo Gparted.


I did this with Windows. Which is notorious for Data loss and Non bootable after messing with Windows NTFS operating system partition shrinkage. I did not trip or fall. But YMMV. Not being a Linux Knuckle Dragging Scooter Tramp like I am
with a GED edjucation.

Good Luck with it. Happy Trails, Rok

Edit: The only reason I preserve Windows on any of my laptops is I use DRM Windows Motorcycle
Tuning Software that is run once and costs hundreds of dollars.

2nd Edit: Forgot to mention I made my Restore DVDs. All 3 of them. Before carving up that Compaq
Laptop to how I wanted to use it.

Last edited by rokytnji; 01-05-2015 at 11:58 AM.
 
1 members found this post helpful.
Old 01-05-2015, 11:41 AM   #19
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by rokytnji View Post
Right click on "foo" . Pick change to logical. Hit apply. When done shut down the cd and computer.
There is no any "logical" options. The only change I can aplly to partition is changing filesystem type (Fat, NTFS, ext,OS/2 and so on).

Could you be so kind to explain, what exactly have I to click to change primary partition to extended without having to delete it?


Added:
When I click partition, appears menu with this items: Copy, Set Active, Delete, Format, Resize, Hide/Unhide, Info, List Types, Move, Delete All, Set type, Erase. Which one do you use to change partition "to logical"?

Last edited by Teufel; 01-05-2015 at 11:46 AM.
 
Old 01-05-2015, 11:54 AM   #20
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,111
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
My Bad. Wrong Iso. I had to go to my rack and check what disk I burned,

http://www.partitionwizard.com/free-...n-manager.html


EDIT:
I edited my previous post to show my mistake. Sorry for posting after just waking up. I am awake now,

Last edited by rokytnji; 01-05-2015 at 12:00 PM.
 
Old 01-05-2015, 12:01 PM   #21
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by Teufel View Post
Well, I have my drive divided into 4 primary partitions:
Code:
# partition table of /dev/sdc
unit: sectors
/dev/sdc1 : start=     2048, size=  3704832, Id=83
/dev/sdc2 : start=  3706880, size=  3201024, Id=83
/dev/sdc3 : start=  6907904, size=  3999744, Id=83
/dev/sdc4 : start= 10907648, size=  4657152, Id=83
At third partition I created a file named "foo".
Could you be so kind to instruct me, how do I rename sdc3 from primary to extended and create inside it a couple of logical partitions without losing my "foo" file?
Essentially, you don't, at least not without backing up your file elsewhere and restoring it afterward. The existing filesystem in that partition would have to be shifted over slightly to make room the the extended partition header. That's a fussy operation that has to be done exactly right or you lose the filesystem. It's not something I would be very eager to do even though I do, at least in theory, know how.
 
Old 01-05-2015, 12:50 PM   #22
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Quote:
Originally Posted by rknichols View Post
The existing filesystem in that partition would have to be shifted over slightly to make room the the extended partition header. That's a fussy operation that has to be done exactly right or you lose the filesystem. It's not something I would be very eager to do even though I do, at least in theory, know how.
You cannot create fifth partition, and it doesn't matter do you have free space for it or not. You may shift it to the left and to the right, but you can't create fifth partition, neither primary nor extended.

BTW, Partition Logic recommended by you, can't do it as well: it complains that the partitions table full of partitions when trying to add new one.

Last edited by Teufel; 01-05-2015 at 12:53 PM.
 
Old 01-05-2015, 01:13 PM   #23
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Unfortunately screenshorts from Partition Magic live doesn't work, so I did it with my GParted:
http://i.imgur.com/v9W8hvq.png

Error message exactly explains why it cannot be done: extended partition is the same primary.
 
Old 01-05-2015, 01:18 PM   #24
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,111
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Quote:
Originally Posted by Teufel View Post
You cannot create fifth partition, and it doesn't matter do you have free space for it or not. You may shift it to the left and to the right, but you can't create fifth partition, neither primary nor extended.

BTW, Partition Logic recommended by you, can't do it as well: it complains that the partitions table full of partitions when trying to add new one.
Uh. I said change the name of a primary to logical. Not add new one. Must be a communication issue here.
 
Old 01-05-2015, 01:22 PM   #25
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,111
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
My screenshot in my original post shows how I laid things out.

http://postmyimage.com/img2/211_gparted.png
 
Old 01-05-2015, 01:30 PM   #26
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Look at your screenshot carefully: it has FOUR primary partitions (including extended)
The extended marked as sda2.
Your drive never had five primary partitions (including extended). And partitions enumeration proves it.
LOL

Just take any stick and try it yourself instead of arguing.
May be you know something that unknown for Gparted or Partition Logic developers?
You might enlighten them, how to put fifth partition to the drive and after that delete one ot them...

Well, let it be according to you, I'm tired of explaining.

Last edited by Teufel; 01-05-2015 at 01:36 PM.
 
Old 01-05-2015, 02:06 PM   #27
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,111
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Like I said. Must be a communication issue. Sigh.

I bet the OP knows what I mean.
 
Old 01-05-2015, 02:11 PM   #28
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by Teufel View Post
You cannot create fifth partition, and it doesn't matter do you have free space for it or not. You may shift it to the left and to the right, but you can't create fifth partition, neither primary nor extended.
You would have to delete partition 3, then re-create it as an extended partition. Now you could create logical partitions within your new extended partition. If you had previously shrunk the filesystem and shifted it to the right by exactly the correct amount, it would magically reappear in the first logical partition you created.
Quote:
BTW, Partition Logic recommended by you, can't do it as well: it complains that the partitions table full of partitions when trying to add new one.
I never recommended that. You have me confused with someone else.
 
Old 01-05-2015, 02:16 PM   #29
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ yeah i do but i am still scared to try it.
@teufel: the situation is an hd with 4 primary partitions with important data on each partition. (for whatever reason we dont have an internet connection or any other disk.) rokytnji proposes a solution where a primary partition can be converted to an extended partition and the important files will be undisturbed.

to me it sounds as complicated as updating the kernel without rebooting <@.

Last edited by schneidz; 01-05-2015 at 02:21 PM.
 
Old 01-05-2015, 03:41 PM   #30
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
@ rokytnji:
yes, I re-read all the posts again after "communication issue" was mentioned and found that I missed this one:
http://www.linuxquestions.org/questi...ml#post5295717
You posted wrong iso. It should be Free Partition Manager: http://www.partitionwizard.com/free-...n-manager.html
I tried it this way:
1. Created 4 primary partitions and put text file at one of them
2. Converted this partition's type from primary to logical.
3. Resized logical partition to get free space
4. Created a couple of logical partitions at freed space

I admit, it works with small file. My file still there, though I do not know how things will go if the partition will contain a lot of files. To get enough free space for new partition it might require to destroy data at converted partition. It is the lack of this method.
And yes, we would not be arguing for so long you posted correct link from the beginning Or at least if you replaced "rename" therm with "convert"

@ schneidz:
I do not know how things will go if you have a lot of important files.
I think they will be lost, if the free space within some of partitions (that planned to be converted) insufficiently to create new partition.
And I do not know how this tool will hadle partition if it highly fragmented. Could it move the files properly? Who knows?

Added:
I would try to unload files from sda2 partition to external drive and convert it to logical.
If right now you have at sda3 enoght free space to fit Fedora there (check it), you should be fine.
You could resize it to get free space for Fedora partition and copy saved files back latter.Even they will not fit, you could move some of saved files to Windows C: drive (sda1), of couse if there are enough free space.

Last edited by Teufel; 01-05-2015 at 07:27 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
[SOLVED] help: error: no such partition, grub rescue, on a netbook Stengah123 Linux - Software 2 03-20-2012 09:09 PM
[SOLVED] Backup netbook's restore partition bonixavier Linux - Laptop and Netbook 3 05-07-2011 09:41 AM
Grub 1.5 Error 22 - Partition Deleted on Netbook. lszanto Linux - General 1 04-30-2010 02:44 AM
Weird partition blindness xmeson Slackware 2 02-20-2005 11:47 PM
Weird partition issue GhostDog Linux - General 1 10-06-2002 08:55 AM

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

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