[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LVM reorganization




Boyd Stephen Smith Jr. wrote:
On Wednesday 2008 December 17 23:30:04 M.Lewis wrote:
Boyd Stephen Smith Jr. wrote:
On Wednesday 2008 December 17 23:00:41 M.Lewis wrote:
Given a Lenny LVM setup as follows:

rattler:~# lvs
   LV     VG                   Attr   LSize  Origin Snap%  Move Log
Copy%  Convert
   home   rattler              -wi-ao 65.02G
   root   rattler              -wi-ao  6.68G
   swap_1 rattler              -wi-ao  2.59G

Is it possible to reorganize the current LVM to separate out say /var &
/tmp into their on LV?
Any free space on the VG? Or, can you make some by shrinking one of the
filesystems and then shrinking it's associated VG?
No, free space is all used in LVs. Yes, I can shrink /home easily by
10-20GB.

Then, I'd:
--- Prep ---
 1. Go down to or boot into single-user mode.
 2. Unmount /home
 3. Size down /home and then rattler/home
4. Optional: make sure the /home filesystem is still fine -- at this point reverting the lv shrinking is fairly easy. --- 5. Make new lvs for /var and /tmp. (BTW, if you have 1G or more, you might just put /tmp on tmpfs.)
 6. Make the new filesystems for /var and /tmp.
7. If possible, remount / read-only. If writing isbeing done to files in the old /var or /tmp during or after the rsync, you'll lose some of that data
 8. Mount the new /var and /tmp in the right place.
--- Data Migration ---
 9. Mount with -o bind / on /mnt.
10. Rsync /mnt/var/. to /var and /mnt/tmp/. to /tmp.
11. rm -rf /mnt/{var,tmp}/{.[!.],}*
12. Umount /mnt.
--- Finishing touches --
13. Add new /var and /tmp to /etc/fstab.
14. Reboot normally or simply walk the system up to your normal multi-user run level.

Relevant manpages:
1. init
2. umount
3. filesystem-specific e.g. resize_reiserfs; lvreduce
4. fsck; If you need to undo the lvreduce, vgcfgrestore
5. lvcreate
6. mkfs
7. mount (options: remount,ro)
8. mount
9. mount (options: bind)
10. rsync
11. rm
12. umount
13. fstab
14. init

Write back if you need more details.

After giving this some thought, I could simplify this more by putting in a larger HD and following steps 5 -14 (modified slightly). This would have two additional benefits that I wouldn't get otherwise:

1) a big safety factor
2) more room that I could squeak out of the current drive.

Thanks,
Mike

--

 To understand a program you must become both the machine and the program.
  15:00:02 up 1 day, 14:37,  2 users,  load average: 0.27, 0.36, 0.18

 Linux Registered User #241685  http://counter.li.org


Reply to: