LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to add space to other partition? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-add-space-to-other-partition-931405/)

tejli007 02-26-2012 01:14 PM

How to add space to other partition?
 
hi there,
i want to install cpanel so i need more space in /,
I want to add more space from /home to /
am using centos 5.6

example:
now is like this

Filesystem Size Used Avail Use% Mounted on
/dev/md2 1016G 1.8G 963G 1% /
/dev/md1 496M 36M 435M 8% /boot
/dev/md3 1.7T 196M 1.6T 1% /home





i want to have like this



Filesystem Size Used Avail Use% Mounted on
/dev/md2 1.8G 2.8 T 1% /
/dev/md1 36M 435M 8% /boot
/dev/md3 196M 150G 1% /home


if is possible without lousing any data.

thanks.

johnsfine 02-26-2012 02:06 PM

Quote:

Originally Posted by tejli007 (Post 4612541)
I want to add more space from /home to /

I don't think you provided enough information for anyone to give you a detailed answer.

I haven't used Linux software RAID enough to know the answer even if you had given enough info. But I do know how to use google. The first hit when I tried google to get your answer looks pretty good:

http://www.howtoforge.com/how-to-res...-software-raid

The first step described there also looks like a very good step to get the additional data someone would need in order to give you a better answer. Post the output from
Code:

cat /proc/mdstat
Edit, now that I've read that whole link more carefully, I no longer think it is a good enough tutorial to get you through the whole process. But the first step of gathering relevant info is still a good idea while waiting for a better expert to help.

I also suggest posting the output from the following command as root:
Code:

fdisk -l

tejli007 02-26-2012 02:21 PM

Quote:

Originally Posted by johnsfine (Post 4612567)
I don't think you provided enough information for anyone to give you a detailed answer.

I haven't used Linux software RAID enough to know the answer even if you had given enough info. But I do know how to use google. The first hit when I tried google to get your answer looks pretty good:

http://www.howtoforge.com/how-to-res...-software-raid

The first step described there also looks like a very good step to get the additional data someone would need in order to give you a better answer. Post the output from
Code:

cat /proc/mdstat
Edit, now that I've read that whole link more carefully, I no longer think it is a good enough tutorial to get you through the whole process. But the first step of gathering relevant info is still a good idea while waiting for a better expert to help.

I also suggest posting the output from the following command as root:
Code:

fdisk -l

here it is:

Code:

[root@server3 ~]# cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdb1[1] sda1[0]
      33553344 blocks [2/2] [UU]

md1 : active raid1 sdb2[1] sda2[0]
      524224 blocks [2/2] [UU]

md3 : active raid1 sdb5[1] sda5[0]
      1822445440 blocks [2/2] [UU]

md2 : active raid1 sdb3[1] sda3[0]
      1073741760 blocks [2/2] [UU]

unused devices: <none>
[root@server3 ~]#



fdisk -l :

Code:

[root@server3 ~]# fdisk -l

WARNING: The size of this disk is 3.0 TB (3000592982016 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).


Disk /dev/sda: 3000.5 GB, 3000592982016 bytes
64 heads, 32 sectors/track, 2861588 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              2      32768    33553408  fd  Linux raid autodetect
/dev/sda2          32769      33280      524288  fd  Linux raid autodetect
/dev/sda3          33281    1081856  1073741824  fd  Linux raid autodetect
/dev/sda4        1081857    2861588  1822445568  85  Linux extended
/dev/sda5        1081857    2861588  1822445567+  fd  Linux raid autodetect

WARNING: The size of this disk is 3.0 TB (3000592982016 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).


Disk /dev/sdb: 3000.5 GB, 3000592982016 bytes
64 heads, 32 sectors/track, 2861588 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              2      32768    33553408  fd  Linux raid autodetect
/dev/sdb2          32769      33280      524288  fd  Linux raid autodetect
/dev/sdb3          33281    1081856  1073741824  fd  Linux raid autodetect
/dev/sdb4        1081857    2861588  1822445568  85  Linux extended
/dev/sdb5        1081857    2861588  1822445567+  fd  Linux raid autodetect

Disk /dev/md2: 1099.5 GB, 1099511562240 bytes
2 heads, 4 sectors/track, 268435440 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md2 doesn't contain a valid partition table

Disk /dev/md3: 1866.1 GB, 1866184130560 bytes
2 heads, 4 sectors/track, 455611360 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md3 doesn't contain a valid partition table

Disk /dev/md1: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md0: 34.3 GB, 34358624256 bytes
2 heads, 4 sectors/track, 8388336 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn't contain a valid partition table


johnsfine 02-26-2012 02:32 PM

That info shows me your goal is a little trickier to reach than I would have expected. But it certainly is doable.

I looked at a few online descriptions of the process and I don't understand why they make it as difficult and dangerous as they do. I think it should be a little simpler than the online descriptions make it. But maybe there is some aspect of software RAID I'm misunderstanding.

You should be aware of four layers for /home and three layers for / and that resizing must affect all layers. There might be some GUI tool that does all the layers together (as there is for non RAID partitions) making all this easy. I don't know it.

You have a file system for /home. That file system is inside a RAID partition md3. That RAID partition is inside logical partitions sda5 and sdb5. Those logical partitions are inside extended partitions sda4 and sdb4.

Lacking knowledge of a tool that coordinates the whole process, I think you would need to:
1) shrink the file system inside md3
2) shrink the RAID partition md3
3) shrink/move the logical partitions, I think leaving the freed space inside the extended partitions sda5 and sdb5.
4) shrink the extended partitions sda4 and sdb4 leaving the freed space before them

Then
5) Extend the primary partitions sda3 and sdb3.
6) Extend the RAID partition md2.
7) Extend the filesystem inside md2.

For step 5, online info I have read instead suggests:
5a) remove one of sda3 or sdb3 from md2
5b) grow the one that was removed
5c) replace and resync it
5d) remove the other
5e) grow it
5f) replace and resync it.
I don't know if/why all that is needed.

tejli007 02-26-2012 02:37 PM

''You have a file system for /home. That file system is inside a RAID partition md3''

This means if i unsize this partition the raid 1 will not be active(will not mirrir)?

johnsfine 02-26-2012 02:43 PM

Quote:

Originally Posted by tejli007 (Post 4612583)
'This means if i unsize this partition the raid 1 will not be active(will not mirrir)?

I have no idea what you mean.
Hopefully some expert will soon look at posts 1 and 3 and give you a better answer.

tejli007 02-26-2012 02:43 PM

Quote:

Originally Posted by johnsfine (Post 4612581)
That info shows me your goal is a little trickier to reach than I would have expected. But it certainly is doable.

I looked at a few online descriptions of the process and I don't understand why they make it as difficult and dangerous as they do. I think it should be a little simpler than the online descriptions make it. But maybe there is some aspect of software RAID I'm misunderstanding.

You should be aware of four layers for /home and three layers for / and that resizing must affect all layers. There might be some GUI tool that does all the layers together (as there is for non RAID partitions) making all this easy. I don't know it.

You have a file system for /home. That file system is inside a RAID partition md3. That RAID partition is inside logical partitions sda5 and sdb5. Those logical partitions are inside extended partitions sda4 and sdb4.

Lacking knowledge of a tool that coordinates the whole process, I think you would need to:
1) shrink the file system inside md3
2) shrink the RAID partition md3
3) shrink/move the logical partitions, I think leaving the freed space inside the extended partitions sda5 and sdb5.
4) shrink the extended partitions sda4 and sdb4 leaving the freed space before them

Then
5) Extend the primary partitions sda3 and sdb3.
6) Extend the RAID partition md2.
7) Extend the filesystem inside md2.

For step 5, online info I have read instead suggests:
5a) remove one of sda3 or sdb3 from md2
5b) grow the one that was removed
5c) replace and resync it
5d) remove the other
5e) grow it
5f) replace and resync it.
I don't know if/why all that is needed.

wow linux is hard man.
Am ready to give you my server pass and to make it for me.
contact me at b.sejdini(at)yahoo.com if you can help me with this.
Thanks

johnsfine 02-26-2012 02:54 PM

Quote:

Originally Posted by tejli007 (Post 4612588)
wow linux is hard man.

I expect it isn't that hard. I just don't know the easier way.

BTW, have you ever resized a software RAID on Windows XP (I have). That is different but way harder, plus it required using Linux tools.

Quote:

Am ready to give you my server pass and to make it for me.
contact me at b.sejdini(at)yahoo.com if you can help me with this.
One item I didn't mention in this thread (I did in your other thread). Most of that work cannot be done while your server is booted normally. You need to shut it down and boot something such as a Linux bootable CD, then do all the partition resizing while that CD is booted. That makes it a bit trickier (I don't think impossible) for you do give control to someone remotely to do the commands for you.

My own skill level is high enough to blunder through something like this in person (I have done many similar tasks that way) but not nearly high enough to deal with the extra challenge of working remotely.

Since the system is so new, what is wrong with the plan of wipe it all out and install Centos (or Ubuntu if you really prefer) from scratch partitioned whatever way you want?

But looking at your other thread also made me realize you don't really need/want to mess with resizing md3. You really want to delete md3.
You can easily copy all of /home from md3 to some other directory on md2. Later you can dismount and eliminate /home and rename that other directory as /home. Then delete md3, sda5, sda4, sdb5 and sdb4. I think all that might even be doable while the full system is booted normally (as long as ordinary users aren't logged in).
Then growing md2 should be somewhat simpler with sda4 and sdb4 completely gone. Growing md2 would still require being booted from something else.


All times are GMT -5. The time now is 07:57 AM.