JP Vossen on 26 Apr 2016 21:13:10 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] disk image one-liner |
Ahhh, so XFS only. Very cool though, thanks. On 04/26/2016 11:25 PM, Keith C. Perry wrote:
JP, I'll give you 3 :) All based on from the example provided at the bottom of the xfsdump man page. Assuming I have a 100Gb file system with 14Gb in use mounted at /mnt/vm which is my "source", I could format and mount a 16Gb USB disk on /mnt/flash and... xfsdump -J - /mnt/vm | xfsrestore -p 300 -J - /mnt/flash This would perfectly image the /mnt/vm filesystem to /mnt/flash and show status every 300 seconds. Only thing left to do is reinstall the boot sectors. :D But wait, there's more! XFS is designed to be able to dump live file systems so on a running system, so... xfsdump -p 300 -J - / | lzop > /mnt/replication/sysvol.xfz ...would dump the root file system, run it though lzop compression and save the file in sysvol.xfz on /mnt/replication. That location could be an external drive or some other location. I usually SSHfs mount backup locations for this task when I'm on the same LAN. If I am pushing data off-LAN or SSHfs isn't available I can always use regular SSH... xfsdump -p 300 -J - / | lzop | ssh user@remote.server.ip "dd of=/mnt/replication/sysvol.xfz" BTW, you can also use the xfsrestore program to interactively browse and restore individual files or directories from a compressed dump file :D I should also say, that this really is file system imaging and not strictly disk imaging but it came up in the context where the terms could be used interchangeably. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Keith C. Perry, MS E.E. Owner, DAO Technologies LLC (O) +1.215.525.4165 x2033 (M) +1.215.432.5167 www.daotechnologies.com ----- Original Message ----- From: "JP Vossen" <jp@jpsdomain.org> To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org> Sent: Tuesday, April 26, 2016 5:52:08 PM Subject: [PLUG] disk image one-linerSubject: Re: [PLUG] [plug-announce] TOMORROW - Tue, Apr 19, 2016:PLUG North - "Linux Containers" by Jason Plum and Rich Freeman (*6:30 pm* at CoreDial in Blue Bell) On 04/26/2016 12:07 PM, Keith C. Perry wrote: ...So, even though I always start with 100Gb disk images when I move the file system, it gets imaged onto the appropriate medium in at the appropriate size with the same one-liner. It doesn't matter whether its a 16Gb USB stick, 128Gb SSD or 1Tb encrypted VM container with system and data volumes.... And that one-liner would be....what now? Sounds quite interesting! XFS only or generic?
Later, JP -- ------------------------------------------------------------------- JP Vossen, CISSP | http://www.jpsdomain.org/ | http://bashcookbook.com/ ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug