LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Increment Files System's size (https://www.linuxquestions.org/questions/linux-general-1/increment-files-system%27s-size-462698/)

Hep 07-10-2006 02:31 PM

Increment Files System's size
 
Hi, Is there a way to increment the size of a file system with another hard disk? I am using a legacy ssytem, RH 7.1, so logic volume module is unavailable. Thanks in advance.

xode 07-10-2006 03:00 PM

This is how I would do it, using as an example /home (assuming that the new hard drive is larger than your existing /home partition): (1) backup all of the data in /home and the partition on the existing hard drive that is next to /home (typically /var); (2) delete the old /home partition and expand /var to include what was the old /home partition;(3) install the 2nd hard drive, fill that entire hard drive with one partition and make /home the mount point for that new partition; and (4) restore the data to /home and /var.

haertig 07-10-2006 04:22 PM

Quote:

Originally Posted by Hep
Hi, Is there a way to increment the size of a file system with another hard disk? I am using a legacy ssytem, RH 7.1, so logic volume module is unavailable. Thanks in advance.

LVM is the best way, but you don't have that. Also, converting a non-LVM filesystem to LVM can be a bit of work (a second disk for temporary copies of data is most helpful).

But you don't/can't have LVM, so you might try unionfs. A bit messier, but it can get the job done.

For example, let's extend /usr/local which is just a subdirectory under /usr for this example. The steps could be modified slightly if /usr/local were a seperate mountpoint. You'll obviously need to be root, and might want to do this from single-user mode if people are likely to be using /usr/local while you're trying to mess with it.

(1) install unionfs
(2) mv /usr/local /usr/local.1
(3) mount /dev/whatever /usr/local.2 (where "/dev/whatever" is a partition on your new disk)
(4) mkdir /usr/local
(5) mount -f unionfs -o dirs=/usr/local.2:/usr/local.1=ro none /usr/local

Don't ever mess with the /usr/local.1 or /usr/local.2 directories directly. Always use /usr/local

This will get you your filesystem expansion, but it really would be better to go for LVM if at all possible. unionfs uses some "magic" that might be confusing later. For example, suppose you had an older file that physically exists at /usr/local.1/oldfile You later delete that file with "rm /usr/local/oldfile" The file appears gone when looking at /usr/local However, in fact it still exists on /usr/local.1 but has been "whited-out" on /usr/local.2, which is overlaid on top of the original /usr/local.1 Think of /usr/local as a "view" that encompasses the writeable layer /usr/local.2 "on top of" the readonly layer /usr/local.1 All file additions, changes, and deletions must happen on /usr/local.2 since that's the only writeable layer. Thus the "white-out" scenerio for file deletion.

Like I said, unionfs can get the job done, but LVM is better as a long term solution. Or you could just buy a new bigger disk and transfer all your existing stuff to it.

Hep 07-12-2006 03:21 PM

Thanks, it helps a lot.


All times are GMT -5. The time now is 10:36 PM.