I’ve got 3 portable hard drives one is 160GB, the other two are 500GB. I want to write zeros to them using Linux and . I found this command:   dd if=/dev/zero of=/dev/sda bs=?   How for the block size, what is the ideal block size for my 3 portable hard drives? (Note: I placed the ? at the end of the command.)
120699
I use dd in its simplest form to clone a hard drive:  dd if=INPUT of=OUTPUT   However, I read in the manpage that dd knows a blocksize parameter. Is there an optimal value for the blocksize parameter that will speed up the cloning procedure?
22443
I have installed bootable ubuntu on hard disks but now I can not format them with Disk Utility program. When I try to format it says "One or more partitions are busy on /dev/sdb" for both hard disks. Is there any way to format these drives?  EDIT: With "Disk Utility" program when I select one of the hard drives It shows 3 volumes;  99 MB FAT 111 GB EXT4 9 GB UNKNOWN   I can not format this unknown volume.  With Gparted program, It doesn't shows Unknown volume only shows 111GB EXT4.
8375
I am in the process of building my first RAID5 array. I've used mdadm to create the following set up:  root@bondigas:~# mdadm --detail /dev/md1 /dev/md1:         Version : 00.90   Creation Time : Wed Oct 20 20:00:41 2010      Raid Level : raid5      Array Size : 5860543488 (5589.05 GiB 6001.20 GB)   Used Dev Size : 1953514496 (1863.02 GiB 2000.40 GB)    Raid Devices : 4   Total Devices : 4 Preferred Minor : 1     Persistence : Superblock is persistent      Update Time : Wed Oct 20 20:13:48 2010           State : clean, degraded, recovering  Active Devices : 3 Working Devices : 4  Failed Devices : 0   Spare Devices : 1           Layout : left-symmetric      Chunk Size : 64K   Rebuild Status : 1% complete             UUID : f6dc829e:aa29b476:edd1ef19:85032322 (local to host bondigas)          Events : 0.12      Number   Major   Minor   RaidDevice State        0       8       16        0      active sync   /dev/sdb        1       8       32        1      active sync   /dev/sdc        2       8       48        2      active sync   /dev/sdd        4       8       64        3      spare rebuilding   /dev/sde   While that's going I decided to format the beast with the following command:  root@bondigas:~# mkfs.ext4 /dev/md1p1  mke2fs 1.41.11 (14-Mar-2010) /dev/md1p1 alignment is offset by 63488 bytes. This may result in very poor performance, (re)-partitioning suggested. Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=16 blocks, Stripe width=48 blocks 97853440 inodes, 391394047 blocks 19569702 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=0 11945 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks:          32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,          4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,          102400000, 214990848  Writing inode tables: ^C 27/11945 root@bondigas:~# ^C   I am unsure what to do about "/dev/md1p1 alignment is offset by 63488 bytes." and how to properly partition the disks to match so I can format it properly.
102036
I am booting from an Ubuntu CD on my laptop. I want to write all zeros to my hard drive, then re-stall Windows 7. I have backed up all the files I want to.  After booting up, I open a terminal window, and type:    dd if=/dev/zero of=/dev/sda bs=1024   The computer responds with "permission denied".  Any suggestions on how to proceed?
36391
I have a question,in linux, is there any method to mount a block of memory as a filesystem? For example, in X86 architecture, when power on, I reserve a  block of memory about 8 Mbytes, and then when linux startup, I mount this block of memory as a filesystem and then read and write file to the file system ? What will be the fs type?
1738
I've noticed that when I do a:  ls -ls file   It provides block count, say 8 blocks.  When I do:  stat file   I notice that the block count is 16, twice the number given by ls.   The block size on my file system is 4096. I learned that the arbitrary unit for blocks used by ls is 1024. Is it correct to say that stat uses an arbitrary unit of 512 bytes when reporting blocks?  If so, is there a reason for the inconsistency?  I'm running Ubuntu 11.10 on an ext4 file system.
35383
I had a problem (new to me) last week. I have a ext4 (Fedora 15) filesystem. The application that runs on the server suddenly stopped. I couldn't find the problem at first look.   df showed 50% available space. After searching for about an hour I saw a forum post where the guy used df -i. The option looks for inodes usage. The system was out of inodes, a simple problem that I didn't realize. The partition had only 3.2M inodes.  Now, my questions are: Can I make the system have more inodes? Should/can it be set when formatting the disk? With the 3.2M inodes, how many files could I have?
106828
I'm currently writing a small script to backup bulks of floppy disks and format them afterward for later use.  I use dd to copy the disk's image and cp to copy all the files on the disk.  Here are the commands I use to do so:  # Copying disk image dd if="/dev/fd0" of="/path/to/backup/folder" &amp;&gt;/dev/null &amp;&amp; sync  # Copying disk files cp -R "/mnt/floppy/." "/path/to/backup/folder/" &amp;&gt;/dev/null   After this process, the script needs to format the floppy disk. My problem is that I want my script to format the floppy disk only if both backup commands (dd and cp) were successful.  For example, if dd couldn't copy all 1.44MB of the floppy disk because of bad blocks, then do not format the floppy disk.  How can I test if both commands were successful (They must be tested seperatly, as I do not always backup both disk's image and files)?
85413
Possible Duplicates:             df -h says that I have 494G used on /var:  Filesystem            Size  Used Avail Use% Mounted on /dev/sda3             564G  494G   41G  93% /var   But du -sh /var says it's 350G  What makes them different?
88585
I have a USB where I'm coping an ISO of 5 Mb aprox with a small OS with its own grub. If I connect the device and check it sudo fdisk -l I get:  ... Device     Boot Start   End Sectors  Size Id Type /dev/sdb1  *        1  9551    9551  4.7M cd unknown   If I copy with dd the ISO sudo dd if=my_os.iso of=/dev/sdb   14852+0 records in 14852+0 records out 7604224 bytes (7.6 MB) copied, 0.538487 s, 14.1 MB/s   It works perfectly. An boot from BIOS in other PC.  The problem is, sometime I forget to connect the USB after update the BIOS, so I do ff WITHOUT the USB connected,  the output is:  14852+0 records in 14852+0 records out 7604224 bytes (7.6 MB) copied, 0.00987684 s, 770 MB/s   Now, the /dev/sdb register is corrupted, the copy speed (770 MB/s) have no sense, and cannot user again dd until reboot.  I have tried to repair it with ddrescue and it doesn't work  sudo ddrescue /dev/zero /dev/sdb conv=noerror,sync   My question is, what is happening exactly and if is possible, how to repair /dev/sdb to avoid reboot and dd start working again?  Thanks.
63525
I'm formatting a 1TB external hard drive as a single NTFS partition.  This drive is mainly meant for storing media.  Should I choose something other than the default allocation unit size?  The options range from 512 bytes to 64K.  Are there any guidelines that I should use with partitions storing other data?  Should I stop poking around and just leave it at "default"?
21036
I've copied the USB drive to an .img file using dd:  dd if=/dev/sdc of=myimage.img   I want to reduce the size of the partition in the image. I've tried several methods and always end up with a loopback-mounted image whose partition is still the full size of the USB.    How do I modify myimage.img to have a smaller partition once loopback-mounted? Do I need to copy zeros into the empty part of the partition before doing so? Do I need to defragment so that when I reduce the image size, I'm deleting empty bytes? (From what I've read, Linux spreads out into the whole partition so I have no expectation that all of the data at the end of the image are zero bytes. Even writing all zeros will just consume the empty bytes wherever they lie.)   NOTE: I'm not trying to save disk space, so zipping doesn't help me.  BACKGROUND  I have Linux installed on a USB drive using ext4. I intend to duplicate the install for multiple devices. I've done so successfully but would like to create on the same USB drive a read-only partition with the system and a small partition that allows persistent storage. Rather than break my USB, I'm trying to modify a copy of the USB. I hope we don't get distracted by this background.  In short, I've done the following:  # Create mount point in current directory sudo mkdir mnt # Loopback mount the image fdisk -l myimage.img sudo mount -o offset=&lt;partion_block_start * block_size&gt; myimage.img mnt # Copy all zeros to remaining space of the image cd mnt sudo dd if=/dev/zero of=filler conv=fsync bs=1M rm filler cd ..   First, I tried to use parted as described in  and qemu-img as described in .  sudo umount mnt parted myimage.img # At parted command prompt (parted) resizepart 1 # Entered my end &lt;target size&gt;. Note that parted uses zero-based  # indexing. This could be your final image size. In my case, the way the # Linux installer worked, the partition started at 1M. (parted) print # I see that the partition is now sized as I expect (parted) exit # Just another sanity check sudo parted -m esp3_007.img unit B print # I see that the partition is now sized as I expect   When I try to mount the image again, it works fine but df still shows the partition as the same size. So then I tried  qemu-img resize myimage.img &lt;target_size&gt;   And now, when I try to mount the image, I get the "mount: wrong fs type, bad option, bad superblock..." error message.  Then I tried using gparted as described in . The GUI showed a full partition unless I ran parted in the first place. Even then, the GUI wouldn't let me resize the partition.  For trying to force the partition size to be smaller, and starting with a fresh copy of myimage.img I tried fdisk described in   sudo fdisk myimage.img Command (m for help): d Command (m for help): n Command action    e   extended    p   primary partition (1-4) p Partition number (1-4, default 1): 1 # defaults on the rest seemed to be correct in my case.   When I mounted the partition, it still showed as the same size.
19259
I have Ubuntu 14.04 with a lot of packages and work related stuff that I am very happy with it. It is installed on my main SSD drive which is a 120GB one (I had choosen "/" when I installed ubuntu, so I beleive everything should be on this drive). It shows up as /dev/sda  Now I have added another SSD to my computer which is a 240Gb. I do not have any other storage media at hand at the moment (e.g. external hard drive).   Since the new 240GB drive has obviously more capacity and is faster (a newer generation than my 120GB one), I want to move my Linux to this new drive. This new drive shows up as /dev/sdb and at the moment it is not formatted or anything (I have literally unpackaged and inserted in my PC right now :P)  How can I safely move my linux installation to the new drive?  I can change the SATA cable so the new drive shows as /dev/sda if necessary.  This is the output of "fdisk -l" if that helps:  Disk /dev/sda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x00076d7a     Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048   226064383   113031168   83  Linux /dev/sda2       226066430   234440703     4187137    5  Extended Partition 2 does not start on physical sector boundary. /dev/sda5       226066432   234440703     4187136   82  Linux swap / Solaris  Disk /dev/sdb: 240.1 GB, 240057409536 bytes 255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000  Disk /dev/sdb doesn't contain a valid partition table
54980
I recently bought a 750 GB 2.5" hard drive and put it in an external enclosure.  It has , but I use Windows 7, so I assumed I would be safe.   I decided to try exFAT, because I was enticed by the reduced overhead For "Allocation unit size" I selected "Default allocation size" Tried with "Quick Format" un-selected first, but it was taking too long, so I stopped and started over with "Quick Format" selected After drive was formatted, looking at the format options again shows that the "Allocation unit size" is 256 KB   The drive works fine, but I had a question about the difference between "Size" and "Size on disk."  On my 120 GB NTFS formatted internal hard drive, the difference is only 0.16%.  However, on my much larger, exFAT formatted external drive, the difference is 17.38%.  At that rate, the most I will fit on this 750 GB drive is 637 GB (with 0 free space).  What format options should I use to maximize usable disk space?  What impact will my current settings have on performance?  What impact will your recommended settings have on performance?  Format settings    Internal hard drive    External hard drive (with big space difference!)
25281
I just used boot and nuke to wipe my hard drive and reinstall my OS systems. When selecting the hard drive I noticed that there were only 931gb free in my hard drive.  Is this normal? It sees like a strange number as I though terabyte drives held 1024gb.  Is some of the hard drive hidden? Are there any programs that can check?  Thanks in advanced for any help with this!  df -h returns the following:  Filesystem           Size  Used Avail Use% Mounted on udev                 3.9G     0  3.9G   0% /dev tmpfs                786M   18M  768M   3% /run /dev/sda5            437G  5.7G  409G   2% / tmpfs                3.9G   31M  3.9G   1% /dev/shm tmpfs                5.0M  4.0K  5.0M   1% /run/lock tmpfs                3.9G     0  3.9G   0% /sys/fs/cgroup tmpfs                786M   20K  786M   1% /run/user/124 /home/*/.Private     437G  5.7G  409G   2% /home/* tmpfs                786M  2.0M  784M   1% /run/user/1000   lsblk returns the following:  NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT sda              8:0    0 931.5G  0 disk   ├─sda1           8:1    0   500M  0 part   ├─sda2           8:2    0 478.8G  0 part   ├─sda3           8:3    0   496M  0 part   ├─sda4           8:4    0     1K  0 part   ├─sda5           8:5    0 443.9G  0 part  / └─sda6           8:6    0   7.9G  0 part   └─cryptswap1   253:0    0   7.9G  0 crypt [SWAP] sr0             11:0    1  1024M  0 rom      EDIT: I am literally installing the dual boot system as we speak. Windows first, here is a breakdown of what Windows 10 sees:   So total size is 931.51GB. That is a very strange number.
38207
I am currently restoring a usb stick with a dd image, I have previously created. However is noticed very poor write speed around ~7 MB/s although the stick is usually much faster.  After looking around a little, I noticed that a lot of data is being read from the USB drive which explains the poor write performance. Nothing but dd is accessing the device at that time.  Edited atop line:  sdd: busy 101% | read 18020 | write 613 | MBr/s 7.04 | MBw/s 7.1   I noticed a similar behavior when writing directly to my md array using dd. However when writing to a mounted filesystem with dd, this does not happen.  So my question is why is read from the usb stick when writing directly to the block device and whether this can be prevented to improve write performance?
105080
$ df -kh Filesystem      Size  Used Avail Use% Mounted on udev            7,8G     0  7,8G   0% /dev tmpfs           1,6G   19M  1,6G   2% /run /dev/sda2       622G  227G  364G  39% / tmpfs           7,8G  1,1G  6,7G  14% /dev/shm tmpfs           5,0M  4,0K  5,0M   1% /run/lock tmpfs           7,8G     0  7,8G   0% /sys/fs/cgroup /dev/loop1      143M  143M     0 100% /snap/inkscape/2527 /dev/loop3       79M   79M     0 100% /snap/core/1441 /dev/loop0       79M   79M     0 100% /snap/core/1577 /dev/loop4       79M   79M     0 100% /snap/core/1512 /dev/loop2       62M   62M     0 100% /snap/pencilsheep/5 tmpfs           1,6G   92K  1,6G   1% /run/user/1000   What are these /dev/loop device files? My RAM is always full. Is this related?