2

Trying to copy 1.9 TB data from a raw disk to a larger one of 2.6 TB and then, at some point, the transaction stops due lack of space on destination disk. Did a research on that and found that this has to do with the difference in block size of source (512) and destination (4096) disks. Then I've looked for solutions to create a disk with block size of 512, without success. Could anyone point out some direction where to look for?

Any help would be highly appreciated!

Update:

(Some detail that I've missed out earlier and could be helpful)

There is a file called data.dd which I've mounted using loop mounting.

root@server:# fdisk -l data.dd
Disk data.dd: 1.8 TiB, 2000398934016 bytes, 3907029168 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
Disklabel type: dos
Disk identifier: 0x00000000

Device                 Boot Start        End    Sectors  Size Id Type
data.dd1          1 3907024064 3907024064  1.8T fd Linux raid autodetect

root@server:# losetup /dev/loop1 data.dd -o $((1 * 512))
root@server:# lsblk
NAME                           MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop1                            7:1    0   1.8T  0 loop
└─shark-storage                252:25   0   1.7T  0 lvm

root@server:# mount /dev/shark/storage /storage/mnt/

root@server:# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/shark-storage      1.7T  1.5T  193G  89% /storage/mnt

Finally, I am copying it's data to another disk either by using cp or rsync. Neither of them are completing.

  • How are you doing the copy? "raw disk" means no file system at all? – ubfan1 Nov 7 '17 at 1:06
  • @ubfan1, updated my post with additional info, please take look. – Attila Antal Nov 7 '17 at 6:18
  • So you have a logical volume inside a loop-mounted file. Maybe try a filesystem check on your source. – ubfan1 Nov 7 '17 at 17:47
0

Okay, got it working now. Instead of copying the content from the disk image, I've cloned it directly to the destination. Perhaps that should've been done in the first place.

This might not be the exact answer, but worth sharing.

Here is what I did:

  1. created a disk (assume it's called vdb) of 2.6TB to make sure there is more than enough space.
  2. successfully restored the image using dd
root@server:~# dd if=./data.dd of=/dev/vdb bs=4096 conv=notrunc,noerror

root@server:~# lsblk
vdb                 253:16   0   2.6T  0 disk
└─vdb1              253:17   0   1.8T  0 part
  1. While mounting it turned out to be a Raid member
root@server:~# mdadm --assemble --run /dev/md127 /dev/vdb1
mdadm: /dev/vdb1 is busy - skipping
root@server:~# mdadm --assemble --run --force /dev/md127 /dev/vdb1
mdadm: /dev/vdb1 is busy - skipping
root@server:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md127 : inactive vdb1[0](S)
      1953511936 blocks

unused devices: <none>
root@server:~# mount /dev/md127 /mydata/
mount: /dev/md127: can't read superblock
root@server:~# mdadm --examine /dev/vdb1
/dev/vdb1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 0a0f4cab:13da9f8f:32773d18:de90fe8d (local to host server)
  Creation Time : Mon Jun 20 14:38:59 2011
     Raid Level : raid1
  Used Dev Size : 1953511936 (1863.01 GiB 2000.40 GB)
     Array Size : 1953511936 (1863.01 GiB 2000.40 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 4

    Update Time : Tue May 31 06:45:38 2016
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
       Checksum : f2035ced - correct
         Events : 1354346


      Number   Major   Minor   RaidDevice State
this     0       8       17        0      active sync

   0     0       8       17        0      active sync
   1     1       8       49        1      active sync

root@server:~# mdadm -A -R /dev/md127 /dev/vdb1
mdadm: /dev/vdb1 is busy - skipping

root@server:~# mdadm -S /dev/md127
mdadm: stopped /dev/md127

root@server:~# mdadm -A -R /dev/md127 /dev/vdb1
mdadm: /dev/md127 has been started with 1 drive (out of 2).

root@server:~# mount /dev/md127 /mydata/
mount: unknown filesystem type 'LVM2_member'

root@server:~# fdisk -l /dev/md127
Disk /dev/md127: 1.8 TiB, 2000396222464 bytes, 3907023872 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

root@server:~# lvmdiskscan
  /dev/vgname/lvname  [       1.66 TiB]
  /dev/md127          [       1.82 TiB] LVM physical volume

root@server:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vgname/lvname
  LV Name                lvname
  VG Name                vgname
  LV UUID                W4abfE-wnuM-Q2Z1-item-mdo9-daHx-K10yQB
  LV Write Access        read/write
  LV Creation host, time ,
  LV Status              available
  # open                 0
  LV Size                1.66 TiB
  Current LE             435456
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

root@server:~# vgdisplay
  --- Volume group ---
  VG Name               vgname
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.82 TiB
  PE Size               4.00 MiB
  Total PE              476931
  Alloc PE / Size       435456 / 1.66 TiB
  Free  PE / Size       41475 / 162.01 GiB
  VG UUID               tNqlCk-SSzi-1eFO-ZPyX-fAee-3cIi-Tdu2gR

root@server:~# lsblk
NAME                MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
vdb                 253:16   0   2.6T  0 disk
└─vdb1              253:17   0   1.8T  0 part
  └─md127             9:127  0   1.8T  0 raid1
    └─vgname-lvname 252:2    0   1.7T  0 lvm

root@server:~# mount /dev/vgname/lvname /mydata/
root@server:~# lsblk
NAME                MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
vdb                 253:16   0   2.6T  0 disk
└─vdb1              253:17   0   1.8T  0 part
  └─md127             9:127  0   1.8T  0 raid1
    └─vgname-lvname 252:2    0   1.7T  0 lvm   /mydata

root@server:~# cd /mydata/
root@server:/mydata# ll
... lots of files and folders ....

Resources that helped me find a way to handle the case:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.