Jump to content

Repartitioning /var


superyupkent
 Share

Recommended Posts

In your case I would do the following:

 

move your /home tree and your /var trees to, let's say, the / (root) partition (assuming that it is enough big to hold the contents of both trees during the process), then I would use fdisk (or parted) to repartition at pleasure the partitions that holded both /home and /var. Then I would format the brand new partitions, and I will edit /etc/fstab to reflect the new status. And finally I will move the /home and /var trees to their new locations (partitions).

 

By steps the thing would be something like this:

 

Previous status (I will assume this situation):

/ ---> /dev/hda1 ---- 18,5 GB

/home/ ---> /dev/hda5 ---- 13 GB

/var/ ---> /dev/hda6 ---- 1,5 GB

 

 

[*] moving the contents of /home/ and /var/ trees to the root partition in order to empty the partitions that previously held both trees (ie, copying both trees to /tmp):

~# /bin/cp -a /home /tmp/

~# /bin/cp -a /var /tmp/

 

 

[*] Repartitioning:

~# /bin/umount /dev/hda5 /dev/hda6

~# /sbin/fdisk ----- or whatever other partitioning tool (ie parted)

At this step I will remove both hda5 and hda6, and recreate them as hda5 (7,5Mb) and hda6 (7Mb) or something like that (it is just an example).

 

 

[*] Formatting (as reiserfs):

~# /sbin/mkreiserfs /dev/hdb5

~# /sbin/mkreiserfs /dev/hdb6

 

 

[*] Mounting the partitions. As the partition schema will be the same there is no need to edit the /etc/fstab (except if they weren't reiserfs before), the only thing to do will be:

~# mkdir -p /home /var ----> probably this step won't be needed

~# /bin/mount -a

 

 

[*] Moving back the data to it's place:

~# /bin/cp -a /tmp/home /tmp/var /

 

 

[*] Be sure that everything is allright and remove the bak trees:

~# /bin/rm -fr /tmp/home /tmp/var

 

Final status:

/ ---> /dev/hda1 ---- 18,5 GB

/home/ ---> /dev/hda5 ---- 7,5 GB

/var/ ---> /dev/hda6 ---- 7 GB

 

Note1: All this procedure will be better done at runlevel 1

Note2: The procedure I've described has no guarantee at all, as it has not been tested, and more important, it has been written 'on the fly' right now w/o thinking too much (It's late here). So be sure you did understood all the steps and their potential risks. Check after each step that it has been done what it is supposed to be done.

Note3: That's the way I would do it, and it doesn't mean that it will be the best one.

Note4: Notes 2 & 3 are my disclaimers :twisted:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...