Hello, I'm going to be moving a filesystem around, and was planning on using rsync to do it, so like to get some advice from those more experienced than I (both using rsync, and moving filesystems)... I currently have a system that has a separate /usr on an LVM partition. I want to merge this back into the / (root) filesystem. This is a production server (mail server, gentoo linux), so I'd really like to not brick this thing in the process. What would the best arguments to use for making sure that everything is preserved properly for a smooth transition? Some suggestions on the gentoo list have been: -a, or -axAHX, or -apogXx, or -PvasHAX or should I go with a combined -apogsvxAHPX ? Or is all that necessary? Would -a be all I need? Thanks for any comments/suggestions... ********** OT ********* If anyone cares to comment on the steps I've settled on, I'd appreciate that too: 1. Boot off of the latest gentoo LiveDVD 2. Mount / mount /dev/sda3 /mnt/gentoo/ There should already be a /usr directory where it was being mounted before, right? If not, then I guess I create it with root:root 755 permissions. 3. Mount old /usr to be moved/merged vgscan vgchange -a y mount /dev/vg/usr /mnt/gentoo/oldusr 4. Copy /oldusr to /usr rsync -a? /mnt/gentoo/oldusr/ /mnt/gentoo/usr/ Are the trailing slashes required/important/necessary? Which arguments should I use? 5. Edit /etc/fstab and comment/remove the /usr line nano -wc /mnt/gentoo/etc/fstab #/dev/vg/usr /usr reiserfs noatime 0 0 6. Unmount mounted filesystems umount /mnt/gentoo/oldusr umount /mnt/gentoo 7. Reboot into new system Done? -- Best regards, */Charles/* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20131202/2c517475/attachment.html>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 First, make sure you have good backups in case anything goes wrong. Second, make sure your root (which appears to be a regular partition rather than an lvm2 slice) is large enough to handle your current /usr filesystem. Third, consider whether you should be moving root into lvm2 rather than moving /usr out of it as this would increase flexibility in the future rather than reducing it. ........> > -a, or -axAHX, or -apogXx, or -PvasHAX > > or should I go with a combined -apogsvxAHPX ?- -aH is enough for most things. If your current /usr is mounted with the acl option then you should use -A. If you have USE=caps or caps-ng then you will need -X. -v, -i, and -P are modifications to the output of rsync and purely up to you. Most of the rest of that is included in -a. -S might save you a little space but never use it on /boot (I know you said /usr but I felt like saying that anyway). ..........> 1. Boot off of the latest gentoo LiveDVDI would use SystemRescueCD. It is Gentoo based but much better setup for this kind of work. It is also nice to have around.> 2. Mount / > > mount /dev/sda3 /mnt/gentoo/You might have to specify more options here. Check what they are before you shut down.> There should already be a /usr directory where it was being > mounted before, right? If not, then I guess I create it with > root:root 755 permissions. > > 3. Mount old /usr to be moved/merged > > vgscan vgchange -a y mount /dev/vg/usr /mnt/gentoo/oldusrI think SystemRescueCD will do part of that for you but if not those are the right steps (not including the mkdir)> 4. Copy /oldusr to /usr > > rsync -a? /mnt/gentoo/oldusr/ /mnt/gentoo/usr/ Are the trailing > slashes required/important/necessary?Yes.> Which arguments should I use?See above> 5. Edit /etc/fstab and comment/remove the /usr line > > nano -wc /mnt/gentoo/etc/fstab > > #/dev/vg/usr /usr reiserfs noatime 0 0Change this to mount in /olduser. You have no reason to delete it at this point so you can keep it around just in case. At least until you need to reclaim the vg space.> 6. Unmount mounted filesystems > > umount /mnt/gentoo/oldusr umount /mnt/gentoo > > 7. Reboot into new system > > Done?While you are at it I would recommend converting from reiserfs to ext4. Reiserfs has never really been all that reliable and ext4 caught up to it and passed it on performance for most things.> -- > > Best regards, > > */Charles/* > >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlKc6sIACgkQVKC1jlbQAQc4lwCfcL3jcLatcaac0t3ZDYbVLq8x 8lMAoJhtu6ssKl//oJH0FbfAwbSm1FbK =D/SR -----END PGP SIGNATURE-----
On Mon, Dec 02, 2013 at 02:31:23PM -0500, Charles Marcus wrote:> Hello, > > I'm going to be moving a filesystem around, and was planning on > using rsync to do it, so like to get some advice from those more > experienced than I (both using rsync, and moving filesystems)... > > I currently have a system that has a separate /usr on an LVM partition. > > I want to merge this back into the / (root) filesystem. > > This is a production server (mail server, gentoo linux), so I'd > really like to not brick this thing in the process. > > What would the best arguments to use for making sure that everything > is preserved properly for a smooth transition? >I have some simple tips:> Some suggestions on the gentoo list have been: > > -a, or -axAHX, or -apogXx, or -PvasHAX > > or should I go with a combined -apogsvxAHPX ? >I suggest you have a look at the output of rsync --help, it says: -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X) Clearly some of the ones you mention are already on that list. There is no need to add them again. So what is stored in /usr ? Is there also a /usr/src ? or /usr/local that has any content ? -A can be useful if you have ACLs, lots of systems don't. -X can be useful if you have extended attributes, lots of systems don't. -H is for hardlinks, I don't usually see many of them around. I've not seen a Gentoo system in a long time, but if /usr just contains installed packages then I think you won't see any of the above. But if you add them, they don't harm. It will just take more time and maybe use more memory. For example -H will use more memory if I'm not mistaken. If you don't have enough memory, it might crash. But I don't think it is usually a problem these days. But if Gentoo builds all the packages in /usr/src andd lots of source still exist, it might be very large. If you do have a /usr/src or /usr/local or something like that. Are they on the same filesystem ? If not, you want -x to prevent them being copied as well. You can obviously easily check if there is anything else mounted under /usr by checking the mount command and/or /etc/fstab I've never used -s I don't see any reason for using -p or -P for partial files, because if copying doesn't succeed you'll probably just start over. There is no network to worry about.> Or is all that necessary? Would -a be all I need? > > Thanks for any comments/suggestions... > > ********** OT ********* > > If anyone cares to comment on the steps I've settled on, I'd > appreciate that too: > > 1. Boot off of the latest gentoo LiveDVD > > 2. Mount / > > mount /dev/sda3 /mnt/gentoo/ > > There should already be a /usr directory where it was being mounted > before, right? If not, then I guess I create it with root:root 755 > permissions. > > 3. Mount old /usr to be moved/merged > > vgscan > vgchange -a y > mount /dev/vg/usr /mnt/gentoo/oldusr > > 4. Copy /oldusr to /usr > > rsync -a? /mnt/gentoo/oldusr/ /mnt/gentoo/usr/ >When using rsync from an other machine, which uses other uids/gids, I would always recommend to add: --numeric-ids> Are the trailing slashes required/important/necessary? >Yes, you need to use them when you are working with directories.> Which arguments should I use? > > 5. Edit /etc/fstab and comment/remove the /usr line > > nano -wc /mnt/gentoo/etc/fstab > > #/dev/vg/usr /usr reiserfs noatime 0 0 > > 6. Unmount mounted filesystems > > umount /mnt/gentoo/oldusr > umount /mnt/gentoo > > 7. Reboot into new system >Anyway, on most Linux distributions, moving the content of /usr shouldn't be a big event. Because the system doesn't change the content of /usr it usually just contains programs, libraries and other files from installed packages. Don't worry, to much. If it's a mailserver, what you could do is: - shutdown - unplug the network - do everything you need to do to copy the files and change fstab - check if everything starts up normally - plug network back in If with the check something fails, reboot with the livecd again and fix any problems. Because the mailserver isn't connected to the network, no mail was lots or bounced. I assume this is a standalone mailserver that doesn't depend on an external database. A mailserver shouldn't bounce mail if DNS isn't working for a little while. Something else you could consider is to not automatically start the server processes and first check that everything works. Don't forgot to enable them to start automatically again when everything is done ;-)> Done? > > -- > > Best regards, > > */Charles/*Hope that was useful for you.> -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
On 12/2/2013 11:31 AM, Charles Marcus wrote:> Hello, > > I'm going to be moving a filesystem around, and was planning on using > rsync to do it, so like to get some advice from those more experienced > than I (both using rsync, and moving filesystems)...--- If you have 'star' on your system, it might be faster. I'd do it with the system *up*, and, as someone else suggested, copy /usr to /usr.tmp (assuming you are moving from /usr to the root fs. For that matter, is there a reason not to give "cp" a try" mkdir /usr.tmp && cp -ax /usr/. /usr.tmp/. I guarantee it will be faster than rsync. That or star -- if you want to know options, I'd have to reread the manpage, way too much to remember. In a pinch, you could use cpio -- it also handles hard links (both of the above will automatically handle hard-link tracking without crashing. rsync should not crash due to hardlink issues. Memory shouldn't be a problem if you have large enough paging files... (though it might get very 'dogslow', if you really have problems w/memory. For the purpose you are stating, copying all of /usr using "cp" or "star" would be better. If you have other things mounted on /usr, you can mount a copy of /usr in /mnt/usr w/o the mounts with: mount --bind /usr /mnt/usr That will mount a copy of /usr on /mnt/usr but without the submounts (as stated in the mount manpage).