Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Clone Linear Raid Array without empty space
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Palme
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2014
Posts: 92

PostPosted: Thu Aug 01, 2019 1:16 pm    Post subject: Clone Linear Raid Array without empty space Reply with quote

Situation

Code:
 df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.6T  3.6G  3.4T   1% /
devtmpfs         10M     0   10M   0% /dev
tmpfs           3.2G  512K  3.2G   1% /run
cgroup_root      10M     0   10M   0% /sys/fs/cgroup
shm              16G     0   16G   0% /dev/shm
/dev/sda2       504M   20M  459M   5% /boot


Code:


 mdadm --detail /dev/md0
/dev/md0:
           Version : 0.90
     Creation Time : Sun Jul 28 20:33:36 2019
        Raid Level : linear
        Array Size : 3906500608 (3725.53 GiB 4000.26 GB)
      Raid Devices : 2
     Total Devices : 2
   Preferred Minor : 0
       Persistence : Superblock is persistent

       Update Time : Sun Jul 28 20:33:36 2019
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

          Rounding : 0K

Consistency Policy : none

              UUID : fc9f83bc:46a517b4:776c2c25:004bd7b2
            Events : 0.1

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       17        1      active sync   /dev/sdb1




Is it possible to use sdb1 as a target disk to backup only used space on md0 and sda2?
how to Compress and Split the disk image by size

thanks
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9691
Location: almost Mile High in the USA

PostPosted: Thu Aug 01, 2019 2:59 pm    Post subject: Reply with quote

Ouch, fortunately it is a linear raid so theoretically you can do this without damage, however it sounds like you want to move to the second disk in the linear.

If there was a good way I'd shrink the array to the first disk (if it's ext2fs there's a resize2fs command that should do it), then remove the second disk from the array. Do what you want to do with the second disk (repartition, mkfs) and copy first to second disk.

However I'd be wary about doing something like this without a backup. And you're using only 3.6GB at this point it's not too much data, can you find another two small disks to just copy onto (one for copy, one for backup)? This would be safest instead of dumping to itself which can be dangerous.

(I'm not sure what your intent is... eventually if you fill up more than a single disk, you can't put a "redundant backup" on the second disk of the array because the sum will be larger than a single disk. You're better off running the disks JBOD if you're worried about backup and just rsyncing the disks versus dealing with "R"AID. Actually since you're working disks like this you may have been better suited using LVM instead of MD as you can simply keep a pool of free space and add to either disk as you fill up, backup or main. Still have the same problem if data exceeds one disk's worth of space however.)
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Palme
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2014
Posts: 92

PostPosted: Fri Aug 02, 2019 12:30 pm    Post subject: Reply with quote

Hi

I thought about the following procedure

1. Boot from Live cd
2. Mount /dev/sdb1 to let's say /mnt/backup (as a temporary storage space)
3. backup /dev/md0 and /dev/sdb2 to /mnt/backup
4. Move the backup to my externel hdd
5. Delete all Backup files in /mnt/backup
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54310
Location: 56N 3W

PostPosted: Fri Aug 02, 2019 5:38 pm    Post subject: Reply with quote

Palme,

You probably can't mount /dev/sdb1 alone.
You don't know where in /dev/md0 your data is.

As it stands, /dev/sdb1 contains a piece of a filesystem that belongs to a raid set that includes /dev/sdb1
You cannot do anything with /dev/sdb1 unless you can remove it from the raid set first.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Palme
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2014
Posts: 92

PostPosted: Sat Aug 03, 2019 1:12 pm    Post subject: Reply with quote

NeddySeagoon

I thought, with linear RAID, the chunks will be sequentially assigned from one drive to the next, only when the first drive is completely full.

thus all my data should be on dev/sda3 and / dev / sdb1 must be empty!
or do I misunderstand something?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9691
Location: almost Mile High in the USA

PostPosted: Sat Aug 03, 2019 1:24 pm    Post subject: Reply with quote

It's not guaranteed to be at the beginning of the disk. The data can show up anywhere in the array - the filesystem typically selects extents to write and though a lot of the time is at the beginning of the array, large gaps are selected to reduce fragmentation. The gaps could extend the data into the second disk, though probably not likely at this point.

Definitely cannot mount a linear array's individual elements alone. You have to shrink the filesystem and then remove the extra disk if you want to do something special with that disk.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54310
Location: 56N 3W

PostPosted: Sat Aug 03, 2019 2:40 pm    Post subject: Reply with quote

Palme,

raid 0.9 puts the raid metadata an the end of the raid space.
It contains a single filesystem that describes all the space in the raid set, Its not two separate filesystems.

Your raid set is comripised of /dev/sda3 and /dev/sdb1 in linear mode. You don't know what the order is.
Attempting to mount one element will fail as the filesystem will be found but is bigger than the containing volume.
Mount won't like that.

Attempting to mount the other element will give you a filesystem not found error, that's correct too as there is no filesystem.
The filesystem metada is on the the other element.

Shrink the filesystem.
Shrink the raid, it must be bigger than the filesystem still.
You still won't know where your data is.

Than you can think about taking the raid set apart.

This shrinkage cannot be performed with the filesystem in use.

Its much lower risk to save the data somewhere else.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum