LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices


Reply
  Search this Thread
Old 08-15-2017, 08:53 AM   #1
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
How to grow HFS filesystem?


How can you grow the root HFS partition? I used gparted (from Debian on USB) to shrink/move HFS partitions, but now I want to remove the Debian partition and expand the main HFS partition to take advantage of the extra space.

This is a 2011 Mac Mini (the model with Core i5-2415M) dual booting with OSX/Debian. I didn't put GRUB on sda, though - I put /boot and GRUB on a USB drive. As such, the bootloader on sda is untouched. The only "footprint" of Debian is the ext4 sda4 partition -- which I want to get rid of now.

(I'm still using this machine primarily with Debian - but I'm using NFS-RAMBOOT booting off the network, so I no longer need anything Debian related on the hard drive.)

So here are things I have tried:

1) Use gparted to expand HFS partition from Debian 9. But surprise to me! Gparted can only shrink/move HFS. It can't expand it. But maybe a newer version can? I'll do a USB install of some other Linux or BSD or whatever if it'll give me this capability.

2) Use disk utility within OSX. But I couldn't find any option to expand the partition. I saw a greyed out icon to expand a "disc image", but that doesn't even sound like an option to expand a partition. Note that the OSX partition I wish to expand is the one I was booted into.

3) Used WINDOWS+R upon boot to boot into the recovery OSX partition; went to its disk utility. It looked pretty much the same, with no obvious option to expand the partition.

So, my hoped for solutions:

A) Newer version of gparted maybe has the ability to grow HFS+ filesystems? I'm okay with doing a USB drive install or burning a CD for this capability.

B) Download an OSX utility program to manage partitions? It would have to be able to grow the HFS filesystem that's currently being used as the root OS filesystem.

C) Burn some sort of OSX liveCD or recovery CD?

D) backup file tree; delete current HFS+ partition; create new HFS+ partition; copy from backup? - But are there any weird special file system permissions I must watch out for? Is it okay to backup to ext4? Any gotchas with doing the backup/restore over nfs file share?

Searching this forum only gave me a very old hit which didn't seem to have any solution.

Searching on the internet in general gave me this:

http://osxdaily.com/2009/11/20/resiz...-disk-utility/

but when I tried to go into the disk utility, I only saw tabs for "First Aid, Erase, RAID, Restore". I did NOT see a tab for "Partition". Maybe the options look different in the more recent OSX? Or maybe it's something to do with the user I'm logged in as?

Like I said, I'm a total OSX newbie so I don't know my way around it.

Thanks!

(BTW, I'm in the middle of doing a dd image of sda to a network drive; that way I can restore to the current state if I mess things up.)

Last edited by IsaacKuo; 08-15-2017 at 08:58 AM.
 
Old 08-15-2017, 10:29 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Location: Horgau, Germany
Distribution: Manjaro KDE, Win 10
Posts: 2,199

Rep: Reputation: 164Reputation: 164
What version of gparted are you using?
You can download it here: http://gparted.sourceforge.net/download.php
 
Old 08-15-2017, 02:40 PM   #3
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
version is 0.25.0

details of the Debian 9 Stretch gparted package are here:

https://packages.debian.org/stretch/gparted

But I expect its capabilities will depend upon the capabilities of the supporting utilities. Gparted is, after all, fundamentally a front end for various console based disk management utilities. So, I don't think it would be useful to just download the latest gparted. But doing a Debian Sid install or Ubuntu install could be an easier option.

But searching around, I get the impression that there simply isn't a way to grow an HFS+ file system in Linux, period. I'm not going to blindly do some Sid or Ubuntu installs or whatever if there's no chance it would work.

Right now I'm trying to use rsync -vaxH to an nfs ext4 share to backup the /dev/sda2 file tree, but I'm not very confident about it. I originally tried "rsync -vaxAXH" but it was having too many problems with not being able to find or set attributes.

I think maybe archiving to a tarball might work better, but even so I feel like linux isn't going to necessarily capture all of the required attributes etc with a mounted HFS+ file system.

I've also used "blkid /dev/sda2" to get the UUID etc for /dev/sda2:

Code:
/dev/sda2:
UUID="eb50ead8-1e2a-3826-b926-212d4573d541"
LABEL="Macintosh HD"
TYPE="hfsplus"
PARTLABEL="Customer"
PARTUUID="9aaa3aed-8c77-4bc0-8122-9638cc3e526b"
I'm not really an expert in getting/setting all of these bits and pieces other than UUID (which Debian uses by default for identifying partitions in various places). Hopefully, if I wipe out the current /dev/sda2 and create a new one, I'll be able to replicate the UUIDs, and LABELs. But I'm still not optimistic that the restore of the file tree using rsync or tarball will get all of the file attributes right...
 
Old 08-15-2017, 04:25 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
To me it seems that you are mixing up partition resize and file system resize. At least you report that both don't work. But it is useless to think about file system expansion if the partition is not resized.

I understand you want to delete the Debian partition on sda4.

I am not sure that you did that, I don't see your report on that. (Sorry if I overlooked it)

The next problem is that HFS seems to be on sda2. Then it looks like sda3 is in the way. What is on sda3? You cannot expand sda2 into sda4 skipping sda3.

It is likely that sda3 holds extended partitions. Hope not, because it will be difficult and complicated to move those.

If there is nothing on it, or swap space, you can delete sda3. If it is swap space you must recreate the swap later.

Assuming you solve the sda3 problem, and gparted still cannot resize, use parted. Note the start of the HFS partition. Not the amount of free space you have.

Delete the HFS partition. Recreate it using the same start sector. Set the size to original size + free space. A little less to be sure not to pass the end of the free space.

If you use the same start sector it is non destructive. After starting OSX you should see a larger partition. But act like you lost the hard disk considering backups. This is extremely dangerous to your data. One typo and your disk is wiped.

When all this is done, you should be able to boot into OSX and expand the file system on the now larger partition. At least I assume this is possible.

jlinkels
 
Old 08-15-2017, 05:00 PM   #5
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
I have no problem moving sda3 out of the way. It's an OSX recovery partition, and it functions just fine after being moved (it's what I boot into with WINDOWS-R). I have moved it left and right many times, so far. It was originally all the way to the right, before I installed Debian. I have never touched sda1 at all (EFI System), and I have never moved the left edge of sda2 (the main OSX partition).

I have not yet deleted sda4 (my ext4 Debian "/" partition). No point to it until I'm ready to expand sda2.

My big issue is that when I copy a backup of the file tree, there are a lot of file attributes that it can't find or transfer. I'm pretty confident that I can adjust the new HFS+ partition UUIDs and LABELs etc so that the EFI bootloader will successfully go to it. But I'm not confident that the file system will be sufficiently restored to the original state with all of the file attributes on various special files.

There are no extended partitions and no logical partitions. This isn't MBR. Just sda1 (EFI System), sda2 (Apple HFS+), sda3 (Apple boot), and sda4 (ext4).

Anyway, I'm going to try and boot into OSX again and see if I can figure out a way to resize the partition while booted to it. Doing some more searching around, it seems that the GUI of the OSX Disk Utility has changed around several times...sometimes gaining/losing capabilities, and sometimes moving things around and making things very counter-intuitive. Maybe the option is there but I just need to click around more thoroughly to find the partition resize options.
 
Old 08-15-2017, 05:34 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Well, if you have moved sda3 out of the way do you have free space "to the right of sda2"?

Also, because you say "I cannot resize a HFS partition" I am wondering if you report accurately. A partition is a part of a hard disk occupying a certain amount of sectors. It has nothing to do with the file system on it. So regardless whether the partition is HFS, NTFS, ext4 or nothing, your disk partitioner is able to resize it. Or it cannot because it was designed to impose certain constraints.

I am also surprised that you say your backup does not contain all file attributes. So in case of a crash you would not be able to restore? Maybe you should look into a reliable backup solution before continuing touching the partition of your hard disk. BTW from people using a Mac I understand that making a back is dragging one disk icon to another disk icon. Mac users are not supposed to think about directory trees and attributes.

jlinkels
 
Old 08-15-2017, 06:19 PM   #7
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Yes, about 300GB of space. I shrank the Debian partition already so it's pretty darn small. Then I shifted it and the sda3 partition all the way to the right.

Actually, I had shifted them all the way to the left also, before I did my "dd" sda image. That made the image a lot smaller than the full 500GB.

I have full confidence in the dd image of sda. I can restore from that if necessary. But it will restore with the partitions and sizes precisely the same as when I took the image. It will not expand any partitions.

I have little confidence in the file level copy I have made going from hfs+ mounted within Linux to an ext4 nfs share.
 
Old 08-15-2017, 06:21 PM   #8
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
BTW, the gparted GUI will refuse to grow just the partition if it can't also grow the filesystem within it. This is normal behavior for gparted. It is also a long standing limitation that it can't grow HFS+. I was hoping maybe very recent linux file system tools may have fixed this, but I guess not.
 
Old 08-15-2017, 07:09 PM   #9
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by IsaacKuo View Post
C) Burn some sort of OSX liveCD or recovery CD?


D) backup file tree; delete current HFS+ partition; create new HFS+ partition; copy from backup? - But are there any weird special file system permissions I must watch out for? Is it okay to backup to ext4? Any gotchas with doing the backup/restore over nfs file share?
That is along the way to do it instead of CD or shares that will never work for a restore as they will not preserve the OSX resource forks and other such attributes use external USB drive. Using the restore option after having formatted the external HFS+ using GUID partition scheme select as source the existing install as destination the external apply and let it do its thing. Once it has completed reboot selecting from the menu Startup Volume choosing the new install as the target to boot once you have confirmed everything has worked you can reboot into the recovery wiping the internal drive partitioning GUID and formatting HFS+. Then you do the same restore from external to internal to get it back to where you want it. BTW if you download Carbon Copy Cloner trial version it will do all the restore options from a live running disk unlike OSX which removed that option from diskutil several versions ago.
 
1 members found this post helpful.
Old 08-15-2017, 08:25 PM   #10
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by HappyTux View Post
That is along the way to do it instead of CD or shares that will never work for a restore as they will not preserve the OSX resource forks and other such attributes use external USB drive. Using the restore option after having formatted the external HFS+ using GUID partition scheme select as source the existing install as destination the external apply and let it do its thing. Once it has completed reboot selecting from the menu Startup Volume choosing the new install as the target to boot once you have confirmed everything has worked you can reboot into the recovery wiping the internal drive partitioning GUID and formatting HFS+. Then you do the same restore from external to internal to get it back to where you want it. BTW if you download Carbon Copy Cloner trial version it will do all the restore options from a live running disk unlike OSX which removed that option from diskutil several versions ago.
Thanks! I think I have figured out the much simpler thing of using the (working) OSX install to grow its own partition. I didn't see the option before because I didn't click around enough. The "Partition" tab only appears if you click on the root disk--not the partition you want to resize.

If you do what I did, which was click on the partition you want to resize, you'll see all of the tabs except the Partition tab. And the Partition tab doesn't appear grayed out. It simply isn't there at all, with the remaining tabs scrunched inward.

So basically, it appears the version of OSX on the 2011 Mac Mini is perfectly capable of resizing its own partition even when running. Also, this Partition tab is available when booting to the small system restore/rescue partition.

Right now, I have selected this in order to grow sda2. I think it's in the middle of doing it; it says "Preparing to Partition Disk" with a progress bar. It's been over half an hour, though, and it still hasn't gotten any further than that (no progress indicated in progress bar either). I'll give it another couple hours, though at least. If this doesn't work out, I'll try to expand the partition from the restore/recovery partition.

(I'm not marking this as SOLVED until after I confirm this has actually worked.)
 
Old 08-15-2017, 09:32 PM   #11
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by IsaacKuo View Post

So basically, it appears the version of OSX on the 2011 Mac Mini is perfectly capable of resizing its own partition even when running. Also, this Partition tab is available when booting to the small system restore/rescue partition.

Right now, I have selected this in order to grow sda2. I think it's in the middle of doing it; it says "Preparing to Partition Disk" with a progress bar. It's been over half an hour, though, and it still hasn't gotten any further than that (no progress indicated in progress bar either). I'll give it another couple hours, though at least. If this doesn't work out, I'll try to expand the partition from the restore/recovery partition.
All versions I have used will do a resize while running it is the cloning of the running system it will no longer do. That preparing to do seems to taking some unusual amount of time it should be a minute or two then onto doing the operation. You may want to look at Activity Monitor to see if the cpu usage of Disk Utility is going up and down showing it doing something or for that matter the disk io in there to see if that is showing activity.
 
1 members found this post helpful.
Old 08-16-2017, 05:52 AM   #12
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Okay, so I have resized the main OSX partition, but lost my recovery partition.

It seems that the existence of the ext4 sda4 partition was preventing the resize from even getting started with OSX Disk Utility (whether booted to the main OSX partition or the recovery partition). I tried resizing to a size that only partially increased the main partition size, and that had no effect. In all cases, Disk Utility would hang at the "Preparing to Partition Disk" step.

I wiped out the ext4 sda4 partition entirely using gparted (diskless netboot to Debian). I also moved the recovery partition all the way to the right (using gparted).

After this, I booted to the recovery partition, and tried to resize the main OSX partition. This time it went past the "Perparing to Partition Disk" step in maybe less than a second. It was very fast. And then it went through many steps, none of which took too terribly long...things like checking the file system. But it ultimately threw an error saying "Couldn't unmount file system". I thought this was strange...

So, I booted to the main OSX partition. This time, I was able to resize the partition to full size. The entire process didn't take all that long. Less than 15 minutes. I'm not sure, because I left when it got started and by the time I came back it was done.

HOWEVER, after booting back into Debian (diskless netboot), I discovered that the recovery partition was GONE. Apparently, telling the OSX Disk Utility to use the full size of the disk implicitly told it to wipe out that sda3 recovery partition. It gave me no warning that it would do anything like that. Note that the recovery partition is hidden in the OSX Disk Utility partitioner.

I'm actually not too happy with this, so I'm going to go through the very lengthy process of using dd to recover to my previous snapshot and I'll see if I can avoid wiping out my recovery partition this time...

Don't expect an update on this soon. It's going to take a while for this stuff to complete...
 
Old 08-16-2017, 07:29 AM   #13
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by IsaacKuo View Post
Okay, so I have resized the main OSX partition, but lost my recovery partition.


I'm actually not too happy with this, so I'm going to go through the very lengthy process of using dd to recover to my previous snapshot and I'll see if I can avoid wiping out my recovery partition this time...
Not needed Carbon Copy Cloner offers to create a Recovery partition for you if there is not one present on the disk or update if outdated I do believe as well.

Edit: You should be using OSX native tools with its disks it does not play well with other OSs in that respect, protocols for communication between OSs works fairly well.

Last edited by HappyTux; 08-16-2017 at 07:32 AM.
 
Old 08-17-2017, 10:40 AM   #14
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Okay, I have had various struggles and successes, but basically I have determined that the OSX recovery partition can't resize the main OSX partition (it always fails saying it can't unmount partition) and that the main OSX partition always wipes out the recovery partition when resizing itself - even when it only resizes itself just a little bit bigger (with hundreds of GB of unallocated empty space between itself and the recovery partition).

I may give Carbon Copy Cloner a go, but I have some reservations:

1) At their web site, it seems that the download is for a "30 Day Trial". This makes it sound like the software will not work after 30 days. I'm okay with paying for software if I'm paying for capabilities that I'll use and are worth the money, but chances are good I'll only even boot into OSX maybe once or twice a year for whatever the heck may work better with the iPhone than Windows 10. I'm sure CCC has great capabilities for people who have a need for its capabilities. But I just want to restore this Mac Mini to the state it was before I shrunk its main partition.

What I have experienced with OSX so far in my lifetime does not inspire me to have any desire to use it more than the barest of bare minimums. Honestly, the only reason I'm keeping this Mac Mini up is in case I want to get into iOS native app development. Besides, OSX on this 2011 Mac Mini is crippled by the slow hard drive.

2) Honestly, I don't know how to download or install OSX software, much less remove it cleanly afterward--which I'll definitely want to do to avoid cluttering up this computer with non-functioning junk after the trial period. Various things on this OSX thing seem to complain about my expired iTunes account and/or expired Credit Card info on it.

3) The current recovery partition includes a base OSX image. I don't see how CCC could possibly replicate that image after the partition it's on has been wiped out.

BTW, I have no large USB thumbdrives, so options for where to save a partition or partition image are extremely limited for me while in OSX. In contrast, when booted up to Debian I've got huge drives on the network via NFS shares (and also samba).

So right now, I have made a new much smaller "dd" image (saved to my main file server), and I think my next step will be to try and "dd" an image of just /dev/sda3 and try to restore it afterward. My plan is:

Code:
1) image OSX Recovery partition sda3 with

dd if=/dev/sda3 of=/mnt/nfsshare/transfer/OSXsda3.img bs=32256

2) Reboot into main OSX (sda2), and use Disk Utility to expand itself

currently it is 27.4G:

/dev/sda1         40    409639   409600  200M EFI System
/dev/sda2     409640  57755647 57346008 27.4G Apple HFS/HFS+
/dev/sda3  975503360 976773119  1269760  620M Apple boot

My plan is to expand it to the maximum size minus 700M. This will leave enough space for the original sda3.

3) Reboot into Debian NFS-RAMBOOT; use gparted to create a new sda3 (1269760*512 bytes in size).

I think the file system I choose won't matter, so I'll just make it FAT.

4) restore from image with

dd if=/mnt/nfsshare/transfer/OSXsda3.img of=/dev/sda3 bs=32256

I think this will restore all relevant aspects of sda3 such as label, UUID, whatever.
It's not an elegant plan, but hopefully it will work.

Last edited by IsaacKuo; 08-17-2017 at 10:44 AM.
 
Old 08-17-2017, 10:41 AM   #15
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546

Original Poster
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
delete - dupe

Last edited by IsaacKuo; 08-17-2017 at 10:44 AM.
 
  


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
zypper update makes /var/lib/rpm/Packages grow and grow and grow... Earl3 Linux - General 3 06-27-2011 02:07 PM
LXer: Linux desktops grow and grow and grow LXer Syndicated Linux News 0 11-23-2007 01:00 PM
Recovering a filesystem (do you know something about NTFS or HFS?) mapquest Linux - General 2 04-25-2007 10:26 PM
hfs: unable to find HFS+ superblock VFS: Can't find ext3 filesystem on dev sdb. macroron Linux - Hardware 3 11-20-2006 09:50 PM
Error mounting HFS+ volume: unable to find HFS+ superblock applewax Linux - General 3 05-31-2006 08:45 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX

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