Allow usage fsarchiver restfs archive filesystem

Post here if you want to request a features that has not been implemented yet
Post Reply
jmrasor
Posts: 3
Joined: Sat Mar 10, 2012 3:28 pm

Allow usage fsarchiver restfs archive filesystem

Post by jmrasor » Sat Mar 10, 2012 4:12 pm

This usage would be equivalent to

Code: Select all

fsarchiver restfs archive id=0,dest=filesystem
... where just one filesystem has been saved.
Here's a patch against oper_restore.c to do it:

Code: Select all

--- oper_restore.c.orig	2012-03-10 10:46:16.492590793 -0500
+++ oper_restore.c	2012-03-10 11:00:51.157594766 -0500
@@ -1338,0 +1339 @@
+    char dst[1024];
@@ -1366,0 +1368,14 @@
+            // Allow simple fsarchiver [options] restfs archive filesystem
+            // if argv[0] is itself a valid block device, make 
+            // argv[0] simulate full argument list
+            if ((stat64(argv[0], &st)==0) && (S_ISBLK(st.st_mode)))
+            {
+                snprintf(dst, sizeof dst, "%s%s", "id=0,dest=", argv[0]); 
+                argv[0] = dst;
+            } else if ( strstr (argv[0], "id=")==NULL)
+            // attempting fsarchiver restfs archive filesystem usage
+            {
+                errprintf("\"%s\" isn't a valid block device.\n", argv[0]);
+                return -1;
+            }
+

jmrasor
Posts: 3
Joined: Sat Mar 10, 2012 3:28 pm

Re: Allow usage fsarchiver restfs archive filesystem

Post by jmrasor » Sat Mar 10, 2012 4:22 pm

And here's a patch against the man page fsarchiver.8 to document the added usage:

Code: Select all

--- fsarchiver.8.orig	2012-03-10 10:16:15.599231089 -0500
+++ fsarchiver.8	2012-03-10 10:19:02.029138783 -0500
@@ -36,0 +37,6 @@
+.I filesystem
+.PP
+.B fsarchiver [
+.I options
+.B ] restfs
+.I archive
@@ -173,0 +180,2 @@
+.SS restore the only filesystem from an archive (no number given):
+fsarchiver restfs /data/myarchive2.fsa /dev/sda1

Post Reply