I have a 1TB big file (disk-image from a damaged drive) and a 1.3MB small file (beginning of a disk-file).  Using the contents of the small file, I want to overwrite portions of the big file. That is, I want to insert/overwrite the first 1.3MB of the 1TB-image using the small file.  Using small temporary files for testing I was unable to overwrite parts of the files. Rather, dd overwrote the files completely. This is not what I want.  Is dd able to do this?
86471
I have an empty file (only zeroes are in it) of size 9,0KB and I need to write another file (with size 1,1KB) to it, but the first file must not lose its size or the rest of its contents. So if the whole file is 00000000000000... now, I need to write second file in it and leave the zeroes as they are. I have tried to use dd, but I haven't succeed - file resizes.  dd if=out/one.img of=out/go.img   Does anybody know how can I do it?
11762
is a wonder. It lets you duplicate a hard drive to another, completely zero a hard drive, etc. But once you launch a dd command, there's nothing to tell you of its progress. It just sits there at the cursor until the command finally finishes. So how does one monitor dd's progress?
30677
We are a team of mathematicians (i.e., no DBA experience).  We have a large database in SQL Server 2012.  It has more than 2 TB of data (hundreds of tables, each with millions of rows and hundreds of columns wide).  Each month, we receive a bundle of additions and revisions to the data, requiring us to perform extensive updates to our database by deleting, replacing, or updating most or all of the tables.  Our work is mostly focused on crafting the SQL logic to calculate the results that we need.  We're not running a real-time call center.  We apply a few indexes as needed, and we're pretty happy with the performance.  The problem is the log file.  Naturally, the log file grows and grows with so much data manipulation.  Our log file currently stands at about 1 TB.  We have a good amount of disk space, but it is not infinite.  From what we read on the Internet, we understand that the log file is necessary for transaction integrity, rollbacks, and recovery.  But for our specific purposes, we don't care about any of that.  We will probably never perform a rollback, nor would we ever attempt a recovery.  Worse comes to worse, we would simply download the data files again and create a new database from scratch.  We really just want the log file to go away and never come back.  We set the database recovery mode to Simple, naively thinking that this meant "no recovery mode", but we were quickly cured of those illusions.  We also understand that there are many wrong things not to do (detaching, shrinking, etc.).  We just don't know the right thing to do.  Maybe someone is going to suggest that we set a limit to log file growth.  However, that leaves two issues: (1)  How do we get rid of the 1 TB which is already there? (2)  We previously tried that, and as we approached the specified limit we started getting Error 9002 (log file full) here, there, and everywhere.  So now we are afraid of applying a size limit.  How do we tell the database "No log file, please" without any hurt feelings?
61115
I am attempting to clone multiple partitions with either  or dd without cloning the whole drive which consists of:  A boot partition A home partition  Seen below is the original installation on a 128GB SSD, which I successfully cloned to a larger 250GB. This as a backup that I would later try to resize and shrink down.  Below is a photo of a working clone of the operating system, which is now about 41 gigs in size total after being resized with Gparted.  I have tried to clone these partitions to my 64GB USB disk as a working portable backup, but have ran into some issues. I have tried using: sudo -s dd if=/dev/sdb of=/dev/sdc &amp; pid=$! while kill -USR1 $pid; do sleep 1; done  This bit for bit cloning method tried to copy the unallocated space on the input drive, which obviously won't work because the output disk is much smaller. In a second attempt I was able create a partition table on the destination disk that matched the source's sizes. I then tried to use boot repair and got  Moving onto to  options; normally a disk to disk would be my choice, but since the destination drive is smaller than the source,  will not allow this. I do see an option to copy ONE partition at a time using the disk to disk option, but do not see how I might clone all three at once. I know there is an option to do this with saving as image but I want the USB to be bootable. One way I can think of making this work would be to make an image of the partitions I want to clone using disk to image, then restoring the image to the 64GB USB disk later, but after trying this I ran into more errors. After making an image of /dev/sdb/ I attempted to restore the file but got this error about /dev/sdb2/ missing:  (/dev/sdb is the target for this session) So perhaps my image was OK, but it didn't properly read /dev/sdb2/ so I checked it with Gparted again and saw this following here:  I checked with Synaptic Package Manager to see, and I already have e2fsprogs v1.42.9-3 installed. So I did some reading and tried the following solutions that have worked for other people: sudo fsck.ext4 -f /dev/sda6 sudo touch /forcefsck Sudo reboot  this seemed to work temporarily, as after another reboot or two, the problem still persists. I am assuming now that during the device to image process in Clonezilla that my /dev/sd2/ was not read properly, as I can not even access this partition in Nautilus or Gparted. I am thinking that is may have been caused by the re-sizing of the drive, but can not be sure, as it will still allow me to boot to this installation. I think I can actually clone these two partitions to image, and then restore them but I need to address this problem of:  The following list of software packages is required for ext4 file system support: e2fsprogs v1.41+.  Could this have come from re-sizing the partition? If so, how come I am able to boot to this installation if it can't be read?
48216
I was messing around with my new hard drive, which only contains some personal files, and to check its write speed, I typed: sudo dd if=/dev/zero of=/dev/sda, /dev/sda/ being the new 2 TB connected to my Raspberry Pi.  Hopefully, I cancelled the command and only 11 MB have been written. Now disk content can't show up, and now parted tell me that the partition tree is like this:  |--- unallocated 8.00 MB |--- unknown 1.82 TB |--- unallocated 9.08 MB   Before, it was like this:  |--- ext4 1.82 TB   I don't know if dd did overwrite the first 11 MB of the disk, which means that the partition table have been totally overwritten, or random bits of the hard drive have been overwritten.  Now the hard drive is connected to my Xubuntu 14.04 laptop as /dev/sdb. I've tried gpart which is still running, and also testdisk without success.  Knowing that the whole disk was ext4 and that sector size was 4096, is it possible to recover the partition table without re-formating and make me able to access my files again (even if some have been corrupted/deleted)? Or the only solution I have is to use a file recovery tool, which would be tiresome because of the amount of data to copy stored on this drive?
105710
PARTITIONING (e.g. fdisk) What are some useful commands used for partitioning an additional hard drive from the command-line? Since most published guides steer towards GParted and other graphical utilities, a summary of some command-line sequences would be helpful.  TUNING - RESERVED SPACE, WRITE-BACK &amp; ACCESS TIMES How to remove the reserved disk space set aside (by default) in case the drive becomes 100% full.  Since I is a secondary drive simply for 'data', removing the reserved area ensures the whole drive is available for use.  I'm also curious about write-through vs. write-back and skipping the update of access times (on files and directories) so as to improve performance.
118965
Is there a clever way to do copy and move operations or a command to duplicate a file, without having to do a cd, then mv after, at the same folder?  For example, I have to run the following:  mv /folder1/folder2/folder3/file.txt /folder1/folder2/folder3/file-2013.txt   Note that the directory to where I'm moving the file is the same, but I have to put the whole path again and sometimes it gets annoying. I'm curious to know if there's another way to do that without having to put the whole path again, because the operation would be done in the same path.
62020
I'm trying to approximate the computer's write speed using dd:  dd if=/dev/urandom of=/dev/null bs=1K count=10000   which gives the following output  10000+0 records in 10000+0 records out 10240000 bytes (10 MB) copied, 0.746313 s, 13.7 MB/s   How can I get the '13.7 MB/s' into a bash variable? I've tried piping the output from dd to progs like awk, sed and grep to no avail.  Ultimately, I'm calling this via os.system(...) from within a python script. If anyone knows of a more direct way to get a similar result inside python I'd be interested in that also. I'm trying to predict how long a file copy will take, based on the file size.  Any help would be greatly appreciated.
101699
I have a bunch of files in a directory (with sub directories) with similar names except the last digit is a different number. I would like to keep the version with the largest file size. However some files will not have any duplicates but I do need to keep that file.  files will look like  111~1.mp4    (1mb) 111~2.mp4    (5mb) 111~3.mp4    (2mb)  222~1.mp4    (3mb)  333~1.mp4    (2mb) 333~2.mp4    (4mb)  444~1.mp4    (1mb) 444~2.mp4    (5mb) 444~3.mp4    (3mb) 444~4.mp4    (7mb)   I would like to keep only the largest version size.  111~2.mp4    (5mb)  222~1.mp4    (3mb)  333~2.mp4    (4mb)  444~4.mp4    (7mb)   Im afraid I got stumped, Ive been searching but havent been able to get it going what I have done so far is able to get the size of the files  set "filename=*.*" for %%A in (%filename%) do echo.Size of "%%A" is %%~zA bytes   but now I have to compare the duplicates to each other and delete the smaller size version and only keep the larger size version and if their is no duplicate than keep that version.
71727
I want to transfer my current system hard drive to a larger hard drive. Doing so, I thought of creating an image of my system hard drive which is 320 GB in size.   Would I be able to restore this image on a larger hard drive? I plan buying a 1TB hard drive.  If yes, how? I prefer no data loss.  I am using Windows 7
17551
I have a large file (8GB for Example). How can I split it into multiple parts, let's say 3 equal parts, and after that how do I integrate them later?
121599
Does adding Tempdb files require a restart? We would like to Add files on the same drive, Not Delete and Not modify. We tested in Dev and QA environment, restart was not required. However for production I would like to be sure everything works properly. Some are stating conditions, not always necessary, sometimes necessary, I am reading resources below:  ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev2', FILENAME = N'G:\tempdb2.ndf' , SIZE = 12288000KB , MAXSIZE = UNLIMITED, FILEGROWTH = 0 ) GO ALTER DATABASE [tempdb] ADD FILE ( NAME = N'tempdev3', FILENAME = N'G:\tempdb3.ndf' , SIZE = 12288000KB , MAXSIZE = UNLIMITED, FILEGROWTH = 0    Do You Need an Outage to Add tempdb files? Brent Ozar  "Technically, not always. But practically speaking, yes. If you have to shrink files, that’s very difficult while SQL Server is in use, and we’ve seen cases where anti-virus/file control tools didn’t act up until SQL Server was restarted after the files were added."   "Once the additional files have been created, it’s not always necessary to perform a service restart.  However, in many production environments, simply modifying the filesize of the existing TempDB datafile (tempdev) is not possible without restarting services first. "  The following resources are saying no restart required:
99177
I find myself moving reasonably large amount of data (20+ GB) from one directory tree to other. Often times they are on the same filesystem but sometimes they are on different ones. I do cp just to preserve the original data just-in-case. Once the copy is done I delete the original data after verifying that the data has been copied alright. Sometimes I just do mv if I feel too lazy to clean original data afterwards. However, I am wondering, from purely technical point of view, which operation is more efficient? Why?
106723
I've used dd to clone disks like this:   dd if=/dev/sdb of=/dev/sda bs=4096 conv=notrunc,noerror,sync   And it's always worked fine. Any and all docs on 'dd' take pains to remind you that the target disk must be the same size or bigger than the source.  Does that absolutely have to be true?   Now, I quite understand that if I clone to a smaller disk I can't expect any partitions that are even partially  'out of bounds' on the target to be intact.  However, knowing full well  that I'd need to edit my partitions on the target later, deleting the 'out of bounds' ones, could I still use 'dd' to make a brute force copy of the source up to the limits of the physical size of the target? Or would 'dd' reduce the target to a smoking pile of wreckage when it reached the limit of its size ;-)  BTW, researching this, I've seen recommended values for bs= of everything from bs=1024 up to bs=32M, what really is best?
102325
I've tired a number of things to get this to work and I'm missing something.   I ran out of space on my 8gb bootable flash drive. I'm running 12.04 server. The drive has sda1 (primary 4gb), sda2 (extended 4GB) and sda5 (swap 4gb).  I tried copying old drive to new drive using ddrescue (whole drive copy) and then resizing on another linux box using gparted.  I made sda1 ~22Gb (75% of the drive) and used the remaining space for sda2 and sda5.  When I tried booting it I get to the GRUB menu and when I select the OS I get a message about not enough room or space.    Next try.    I dd'd the MBR of the new drive and then created sda1 - primary linux 83 (75% of sectors on drive), sda2 - extended 5 (25% - remaining sectors), sd5 - logical linux 82 swap (same sectors as sda2).  I then wrote the changes and exited fdisk.  I then ran ddrescue with the following command:  ddrescue -d -f -r3 /dev/sda1 /dev/sdb1  (old drive copied to new drive).  It competed successfully.  I mounted the new copied partition and ran df to see the free space and it shows the same amount as the old small drive -97% used.  I thought I had to resize or something so I moved drive to other linux box and ran gparted.  Didn't find that the partiion needed resizing.    The new partition has the same UUID as the original but I think i might need to copy the old swap partition UUID to the new one and I don't know how - only how to randmly generate a new one.   So, where did I go wrong here. Am I close to getting this right?
48458
For testing purposes I have to generate a file of a certain size (to test an upload limit).    What is a command to create a file of a certain size on Linux?
77216
I have a image which was taken with Clonezilla as SAVEDISK on a 160GB harddrive. Now a newer version of the PC released with a 120GB harddrive, the space in use is just 20GB  Is there a way I can force Clonezilla (or any other program) to manipulate the images 'original size' to 120GB or lower, so Clonezilla can write it to the new PC?