Resizing and creating partitions

bt107
Posts: 88
Joined: Fri Aug 06, 2010 8:40 pm

Resizing and creating partitions

Postby bt107 » Sun Aug 08, 2010 7:22 pm

I just installed Amahi and so far I'm quite impressed. I was looking for some type of easy-to-manage home server software when I came across this.

The Fedora 12 DVD installed without a hitch however I think I made a fundamental mistake. I only created 2 partitions; / and a swap. I didn't think to create a partition for data. Plus, I've moved several gigs of data to the hda already.

I'm adding a second hard drive so I was looking at Greyhole for share pooling. The wiki warns against including the root partition in the share pool. But, that's the only one I have other than the swap.

So, my question is this, is it possible to shrink the root partition and create a new partition using the resulting free space? Can I then move the shares to the new partition without having to reload all the data over again? I've done this in Windows but I'm pretty green with Linux.

Thanks!

whetu
Posts: 30
Joined: Tue Jul 13, 2010 3:32 am

Re: Resizing and creatng partitions

Postby whetu » Mon Aug 09, 2010 2:31 pm

The wiki warns against using the root partition in greyhole because if it fills up you can have some weird errors occur. Outside of that, there's no really earth-shattering reason not to.

Of course the correct way to fix this is the path that you're taking, but another way is to simply monitor the drive usage, which is a good practice anyway. There's an abundance of basic scripts out there that can do this for you e.g.

http://www.cyberciti.biz/tips/shell-scr ... space.html

If I were you, I'd install the second drive and move all the existing data across to that. Then remove it while you work on your first drive. This way, if things go wrong you can simply re-install.

Are you running Amahi headless or with a desktop?

bt107
Posts: 88
Joined: Fri Aug 06, 2010 8:40 pm

Re: Resizing and creatng partitions

Postby bt107 » Mon Aug 09, 2010 4:13 pm

Thanks for the reply. I was thinking of doing that but wasn't quite sure how to go about it with Amahi. Would I just change the share location through the control panel? Then resize the / partition and create a new partition in the resulting free space?

Yes, I'm running it headless.

bt107
Posts: 88
Joined: Fri Aug 06, 2010 8:40 pm

Re: Resizing and creatng partitions

Postby bt107 » Tue Aug 10, 2010 7:19 am

I re-read the wiki for adding a second hard drive to Amahi and it made sense to me this time. So here's what I'm going to try. I'll use gparted live CD to shrink the / partition then create a new partition in the resulting free space. I should then be able to use the wiki guide to mount the new partition and move the shares over to it.

It seems like this should work but if it doesn't I'll just wipe it and reinstall. The data can be recovered. Either way I'll report the results.

bt107
Posts: 88
Joined: Fri Aug 06, 2010 8:40 pm

Re: Resizing and creatng partitions

Postby bt107 » Wed Aug 11, 2010 5:01 am

Well no joy at all. Gparted couldn't resize the partition because it's LVM and not supported. So, short of wiping the whole thing and starting over I'm stuck with keeping / in the share pool.

It would really make sense to put some kind of mention in the Amahi installer instructions about creating a partition other than / for shares if one wants to use Greyhole.

Since all this (Amahi, Greyhole, etc.) is free I really have no right to complain about what is really a small issue in a very fine effort so please just consider this constructive criticism from a grateful novice.

Thanks!!

whetu
Posts: 30
Joined: Tue Jul 13, 2010 3:32 am

Re: Resizing and creatng partitions

Postby whetu » Wed Aug 11, 2010 3:48 pm

I figured it was LVM, I think the instructions need to specify not to use LVM, if anything.

Unless you want to do a full re-install, have a read around the following:

http://www.tldp.org/HOWTO/LVM-HOWTO/

paying particular attention to vgdisplay, lvdisplay and lvreduce. It's woefully outdated, but the concepts are the same.

/edit:
off the top of my head, and assuming the result of vgdisplay and lvdisplay has / relative to /dev/vg00/lvol1. In this example, the partition is 200G and you want to reduce it to 20G, first you want to boot up into system maintenance mode, or if you can get / unmounted while running (you can on some systems, I don't know about Fedora though):

# remove 180G from the LV
lvresize -L -180G /dev/vg00/lvol1
# run a fsck on it
e2fsck -f /dev/vg00/lvol1
# resize the FS to the LV size
resize2fs /dev/vg00/lvol1

Then it should be mountable, and you'd use lvcreate to create a new lvol in the freed up space.

Note that while enlarging an LV is quite robust and safe, reducing the size of one is nowhere near as solid. This may be a case of cut your losses and reinstall...

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Resizing and creating partitions

Postby moredruid » Thu Aug 12, 2010 12:10 am

uhm, that's not the correct sequence :)

first unmount the filesystem (run "telinit 1" first to go to single user mode), if possible. If this doesn't work (it's the root partition after all) you'll need to boot with a linux live distro and modify the LV from there.

then

Code: Select all

fsck -f /dev/<volumegroup name>/<logicalvolume name>
then

Code: Select all

resize2fs /dev/<volumegroup name>/<logicalvolume name> <desired size; e.g. 50G>
then

Code: Select all

lvresize -L <desired size; must be exactly equal to or more as above value> /dev/<volumegroup name>/<logicalvolume name>
remount the partition (mount -a); run "telinit 3" to go to multi-user networking mode - you shouldn't get any errors.

reboot to check if the system survives a normal reboot and you're done. On large disks this process may take a lot of time. It might be "easier" to do a complete reinstall, but you have to know how to work the partitioner if you want to use LVM.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

whetu
Posts: 30
Joined: Tue Jul 13, 2010 3:32 am

Re: Resizing and creating partitions

Postby whetu » Mon Aug 16, 2010 4:44 pm

uhm, that's not the correct sequence :)
Cheers for the correction - as I said, it was off the top of my head :)

User avatar
moredruid
Expert
Posts: 791
Joined: Tue Jan 20, 2009 1:33 am
Location: Netherlands
Contact:

Re: Resizing and creating partitions

Postby moredruid » Tue Aug 17, 2010 12:37 pm

I just went through that process just 1 day before :lol: so it was quite fresh. Though it's no fun to resize a 1.4 TB LV to around 850GB :?
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D2173656C7572206968616D41snlbxq' | dc
Galileo - HP Proliant ML110 G6 quad core Xeon 2.4GHz, 4GB RAM, 2x750GB RAID1 + 2x1TB RAID1 HDD

live2012
Posts: 1
Joined: Tue Aug 17, 2010 6:18 pm

Re: Resizing and creating partitions

Postby live2012 » Tue Aug 17, 2010 6:39 pm

Of cause you can resize partition and create partition.
Resize partition can be realized by the Partition Manager, it can work flawlessly. Fortunately, it is free for use.
I used to resize partition through it, really worded well.
Then, after resize partition, then you can create partition.
The webpage I linked can help you, go and see.
:)
http://www.extend-partition.com/resourc ... drive.html

Who is online

Users browsing this forum: No registered users and 33 guests