{"id":12711,"date":"2019-03-28T14:17:37","date_gmt":"2019-03-28T14:17:37","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12711"},"modified":"2019-03-28T14:17:37","modified_gmt":"2019-03-28T14:17:37","slug":"how-to-backup-or-clone-linux-partitions-using-cat-command","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/how-to-backup-or-clone-linux-partitions-using-cat-command\/","title":{"rendered":"How to Backup or Clone Linux Partitions Using \u2018cat\u2019 Command"},"content":{"rendered":"<p>A rough utilization of Linux\u00a0<a href=\"https:\/\/www.tecmint.com\/13-basic-cat-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">cat command<\/a>\u00a0would be to make a full disk backup or a disk partition backup or cloning of a disk partition by redirecting the command output against the partition of a hard disk, or USB stick or a local image file or write the output to a network socket.<\/p>\n<div id=\"attachment_20388\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Linux-Filesystem-Backup-Using-cat-Command.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-20388\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Linux-Filesystem-Backup-Using-cat-Command.png\" alt=\"Linux Filesystem Backup Using 'cat' Command\" width=\"719\" height=\"343\" aria-describedby=\"caption-attachment-20388\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-20388\" class=\"wp-caption-text\">Linux Filesystem Backup Using \u2018cat\u2019 Command<\/p>\n<\/div>\n<p>It absolutely normal of you to think of why we should use\u00a0<strong>cat<\/strong>\u00a0over\u00a0<strong>dd<\/strong>\u00a0when the latter does the same job easily, which is quite right, however, I recently realized that cat is much faster than\u00a0<strong>dd<\/strong>\u00a0when its comes to speed and performance.<\/p>\n<p>I do agree that\u00a0<strong>dd<\/strong>\u00a0provides, even more, options and also very useful in dealing with large backups such as tape drives (<a href=\"https:\/\/www.tecmint.com\/clone-linux-partitions\/\" target=\"_blank\" rel=\"noopener\">How to Clone Linux Partitions Using \u2018dd\u2019 Command<\/a>), whereas cat includes lesser option and it\u2019s not necessarily a worthy\u00a0<strong>dd<\/strong>\u00a0replacement but still, remains an option wherever applicable.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-centos-ubuntu-disk-cloning-backup-using-clonezilla\/\" target=\"_blank\" rel=\"noopener\">How to Clone or Backup Linux Disk Using Clonezilla<\/a><\/p>\n<p>Trust me, it gets the job done quite successfully in copying the content of a partition to a new unformatted partition. The only requirements would be to provide a valid hard disk partition with the minimum size of the existing data and with no filesystem whatsoever.<\/p>\n<p>In the below example the first partition on the first hard disk, which corresponds to the\u00a0<code>\/boot<\/code>\u00a0partition i.e.\u00a0<code>\/dev\/sda1<\/code>, is cloned onto the first partition of the second disk (i.e.\u00a0<code>\/dev\/sdb1<\/code>) using the Linux redirection operator.<\/p>\n<pre># cat \/dev\/sda1 &gt; \/dev\/sdb1\r\n<\/pre>\n<div id=\"attachment_19878\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Full-Disk-Partition-Backup-in-Linux.jpg\" rel=\"attachment wp-att-19878\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-19878\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Full-Disk-Partition-Backup-in-Linux.jpg\" alt=\"Full Disk Partition Backup in Linux\" width=\"747\" height=\"387\" aria-describedby=\"caption-attachment-19878\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-19878\" class=\"wp-caption-text\">Full Disk Partition Backup in Linux<\/p>\n<\/div>\n<p>After the command finishes, the cloned partition is mounted to\u00a0<code>\/mnt<\/code>\u00a0and both mount points directories are listed to check if any files are missing.<\/p>\n<pre># mount \/dev\/sdb1 \/mnt\r\n# ls \/mnt\r\n# ls \/boot\r\n<\/pre>\n<div id=\"attachment_19879\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Verify-Cloned-Partition.png\" rel=\"attachment wp-att-19879\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-19879\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Verify-Cloned-Partition.png\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Verify-Cloned-Partition.png 800w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Verify-Cloned-Partition-768x576.png 768w\" alt=\"Verify Cloned Partition Files\" width=\"800\" height=\"600\" aria-describedby=\"caption-attachment-19879\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-19879\" class=\"wp-caption-text\">Verify Cloned Partition Files<\/p>\n<\/div>\n<p>In order to extend the partition file system to the maximum size issue the following command with root privileges.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-system-backup-tools\/\" target=\"_blank\" rel=\"noopener\">14 Outstanding Backup Utilities for Linux Systems<\/a><\/p>\n<pre>$ sudo resize2fs \/dev\/sdb1\r\n<\/pre>\n<div id=\"attachment_19880\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Resize-Extend-Linux-Partition-Size.png\" rel=\"attachment wp-att-19880\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-19880\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/04\/Resize-Extend-Linux-Partition-Size.png\" alt=\"Resize or Extend Partition Size in Linux\" width=\"657\" height=\"114\" aria-describedby=\"caption-attachment-19880\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-19880\" class=\"wp-caption-text\">Resize or Extend Partition Size in Linux<\/p>\n<\/div>\n<p>The\u00a0<code>cat<\/code>\u00a0command is an excellent tool to\u00a0<a href=\"https:\/\/www.tecmint.com\/manage-linux-filenames-with-special-characters\/\" target=\"_blank\" rel=\"noopener\">manipulate text files in Linux<\/a>\u00a0and some special multimedia files, but should be avoided for binary data files or concatenate shebang files. For all other options don\u2019t hesitate to execute\u00a0<code>man cat<\/code>\u00a0from console.<\/p>\n<pre>$ man cat\r\n<\/pre>\n<p>Surprisingly, there is another command called\u00a0<strong>tac,<\/strong>\u00a0yes, I am talking about\u00a0<strong>tac<\/strong>, which is a reverse version of\u00a0<strong>cat<\/strong>command (also spelled backwards) which display each line of a file in reverse order, want to know more about\u00a0<strong>tac<\/strong>, read\u00a0<a href=\"https:\/\/www.tecmint.com\/learn-linux-cat-command-and-tac-command\" target=\"_blank\" rel=\"noopener\">How to Use Tac Command in Linux.<\/a><\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/backup-or-clone-linux-partitions-using-cat-command\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A rough utilization of Linux\u00a0cat command\u00a0would be to make a full disk backup or a disk partition backup or cloning of a disk partition by redirecting the command output against the partition of a hard disk, or USB stick or a local image file or write the output to a network socket. Linux Filesystem Backup &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/how-to-backup-or-clone-linux-partitions-using-cat-command\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Backup or Clone Linux Partitions Using \u2018cat\u2019 Command&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12711","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12711"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12711\/revisions"}],"predecessor-version":[{"id":12712,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12711\/revisions\/12712"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}