* Resize / file system and create /home in existing raid 1
@ 2008-05-05 20:35 Tiago Pinheiro
2008-05-05 21:53 ` Peter Grandi
0 siblings, 1 reply; 4+ messages in thread
From: Tiago Pinheiro @ 2008-05-05 20:35 UTC (permalink / raw)
To: linux-raid
Hi!
I'm running Ubuntu 7.10 x64. Currently, my system is setup as follows:
- / is in a Raid 1 array (/dev/md0) consisting of two partitions -
sda1 and sdb1 (ca. 148 GB);
- swap in Raid 0 (/dev/md1) - sda2 and sdb2 of ca. 1 GB each giving me
2 GB in total:
- sda and sdb are two disks of 160GB:
- I do not have a separate /home file system.
I would like to correct this situation by doing the following:
- resize the partition containing the / file system to 27 GB keeping
it in RAID 1 (/dev/md0);
- create a new partition of 120GB to mount /home, also in RAID 1 (/dev/md2);
- change swap from a RAID 0 to a RAID 1, resizing it to 2GB (/dev/md1).
Can this be done without reinstalling everything from scratch?
Output of /proc/mdstat:
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5]
[raid4] [raid10]
md1 : active raid0 sda2[0] sdb2[1]
2023936 blocks 64k chunks
md0 : active raid1 sda1[0] sdb1[1]
155276160 blocks [2/2] [UU]
unused devices: <none>
/proc/mdstat
Output of /etc/fstab:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/md0
UUID=b3dd64e4-786f-496b-b9e3-c42da731e113 / ext3
defaults,errors=remount-ro 0 1
# /dev/md1
UUID=d9f45f6b-025f-42e7-9ebf-27cddc6fa27b none swap sw
0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec 0 0
Output of mdadm --detail /dev/md0:
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 13:25:15 2008
Raid Level : raid1
Array Size : 155276160 (148.08 GiB 159.00 GB)
Used Dev Size : 155276160 (148.08 GiB 159.00 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon May 5 18:14:31 2008
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
UUID : c39b647f:cb4f0780:05770ebd:8c404dcc
Events : 0.18
Number Major Minor RaidDevice State
0 8 145 0 active sync /dev/sda1
1 8 161 1 active sync /dev/sdb1
Output of mdadm --detail /dev/md1:
/dev/md1:
Version : 00.90.03
Creation Time : Mon Feb 25 13:25:23 2008
Raid Level : raid0
Array Size : 2023936 (1976.83 MiB 2072.51 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Mon May 5 01:17:47 2008
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Chunk Size : 64K
UUID : cd9a2299:6e3e0036:8ebd1878:1deccd4a
Events : 0.7
Number Major Minor RaidDevice State
0 8 146 0 active sync /dev/sda2
1 8 162 1 active sync /dev/sdb2
I would really appreciate your help. If you need further info from me
please just say so and I will try to post it as soon as possible.
Thanks.
Cheers,
Tiago
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Resize / file system and create /home in existing raid 1
2008-05-05 20:35 Resize / file system and create /home in existing raid 1 Tiago Pinheiro
@ 2008-05-05 21:53 ` Peter Grandi
2008-05-06 9:26 ` Markus Hochholdinger
2008-05-06 13:58 ` Tiago Pinheiro
0 siblings, 2 replies; 4+ messages in thread
From: Peter Grandi @ 2008-05-05 21:53 UTC (permalink / raw)
To: Linux RAID
[ ... reshaping from ... ]
> - / is in a Raid 1 array (/dev/md0) consisting of two
> partitions - sda1 and sdb1 (ca. 148 GB);
> - swap in Raid 0 (/dev/md1) - sda2 and sdb2 of ca. 1 GB each
> giving me 2 GB in total:
[ ... to ... ]
> - resize the partition containing the / file system to 27 GB
> keeping it in RAID 1 (/dev/md0);
> - create a new partition of 120GB to mount /home, also in RAID
> 1 (/dev/md2);
> - change swap from a RAID 0 to a RAID 1, resizing it to 2GB
> (/dev/md1).
Separating '/' and '/home' is a good idea. RAID swap, either
RAID0 or RAID1, is usually pointless. RAID1 swap is only useful
if you have really demanding availability requirements.
> Can this be done without reinstalling everything from scratch?
You have two mirrored disks so it is trivial.
Break the mirroring, repartition 'sdb' say into 'sdb[123]',
'mkfs' the 'sdb[13]' partitions, 'mkswap' the 'sdb2' partition,
copy stuff from 'sda1' to 'sdb1' and 'sdb3', reboot from 'sdb1'
without any RAID, repartition 'sda' in the same way as 'sdb',
then recreate new RAID mirrors ('md0' as 'sda1' and 'sdb1'
etc.). You can do much the same from a live CD eliminating the
obvious steps.
Resizing is dangerous, shrinking is very dangerous, and most
filesystems don't support shrinking anyhow.
> Output of /proc/mdstat: [ ... ]
Why so much pointless stuff...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Resize / file system and create /home in existing raid 1
2008-05-05 21:53 ` Peter Grandi
@ 2008-05-06 9:26 ` Markus Hochholdinger
2008-05-06 13:58 ` Tiago Pinheiro
1 sibling, 0 replies; 4+ messages in thread
From: Markus Hochholdinger @ 2008-05-06 9:26 UTC (permalink / raw)
To: Linux RAID
[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]
Hi,
Am Montag, 5. Mai 2008 23:53 schrieb Peter Grandi:
[..]
> Resizing is dangerous, shrinking is very dangerous, and most
> filesystems don't support shrinking anyhow.
is there any documentation why resizing is dangerous?
I'm using a lot of RAID1 with ext3 ontop in my virtual servers and i resize
(grow) the RAID1 and ext3 filesystem as i need more space without
interrupting.
I've done this very often (more than 50 times) for a long time (for about 2
years) and never had any problems. I also do sometimes fsck to check if
something went wrong (i can do this without interruption because my RAID1
partitions are managed with lvm, and so, i do snapshots and make the fsck on
the snapshots).
I've done shrinking not that often because i don't know a filesystem which can
shrinking online (ext3 and reiserfs can be shrinked offline). But as i've
testet shrinking with ext3 it's for me also very stable. Shrinking reiserfs
(offline) doesn't work reliably and i use reiserfs only on my backup space.
But shrinking RAID1 is not possible without recreating the RAID1, means
shrinking RAID1 is not possible online.
--
greetings
eMHa
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Resize / file system and create /home in existing raid 1
2008-05-05 21:53 ` Peter Grandi
2008-05-06 9:26 ` Markus Hochholdinger
@ 2008-05-06 13:58 ` Tiago Pinheiro
1 sibling, 0 replies; 4+ messages in thread
From: Tiago Pinheiro @ 2008-05-06 13:58 UTC (permalink / raw)
To: Linux RAID mailing list
Hi there,
Thanks for your prompt answer!
> [ ... reshaping from ... ]
>
>
> > - / is in a Raid 1 array (/dev/md0) consisting of two
> > partitions - sda1 and sdb1 (ca. 148 GB);
> > - swap in Raid 0 (/dev/md1) - sda2 and sdb2 of ca. 1 GB each
> > giving me 2 GB in total:
>
> [ ... to ... ]
>
>
> > - resize the partition containing the / file system to 27 GB
> > keeping it in RAID 1 (/dev/md0);
> > - create a new partition of 120GB to mount /home, also in RAID
> > 1 (/dev/md2);
> > - change swap from a RAID 0 to a RAID 1, resizing it to 2GB
> > (/dev/md1).
Yep, that's essentially it.
> > Can this be done without reinstalling everything from scratch?
>
> You have two mirrored disks so it is trivial.
Not so trivial to me... :)
> Break the mirroring, repartition 'sdb' say into 'sdb[123]',
> 'mkfs' the 'sdb[13]' partitions, 'mkswap' the 'sdb2' partition,
> copy stuff from 'sda1' to 'sdb1' and 'sdb3', reboot from 'sdb1'
> without any RAID, repartition 'sda' in the same way as 'sdb',
> then recreate new RAID mirrors ('md0' as 'sda1' and 'sdb1'
> etc.). You can do much the same from a live CD eliminating the
> obvious steps.
Let's suppose I use a live CD. It seems safer and less error prone.
Step by step, we have:
- break the mirroring: it is my perception that this would not be
necessary as the system would not be aware of any raid. The only
problem I see here is the fact that the drives are partitioned as RAID
auto detect, but I might be seeing a problem where it is not there;
- repartition the drive and create file systems: fine, will use parted
to do it in a non-destructive manner, shrink sdb1 (ext3) to 27GB,
delete sdb2 (swap), create new sdb2 (ext3) with 120GB and create sdb3
(swap) with 2GB; I will have to set them as RAID autodetect as well,
right?
- copy stuff from sda1 to sdb1 (/) and sdb2 (/home): fine; will do
something like this 'find . -depth -print0 | sudo cpio --null --sparse
-pvd /target/';
- reboot from sdb1 without any raid: how can I do that? change
something in GRUB, or merely physically disconnecting sda? in any
case, won't sdb's partitions be seen as they should belong to a RAID?
- repartition sda: fine;
- recreate the arrays: will this be non-destructive? do I have to
recreate them as degraded (starting with sdb[123]) and then add the
other partitions (sda[123])? would this be ok, or is there a better
way of doing it? 'mdadm --create --verbose /dev/md0 --level=1
--raid-devices=2 /dev/sda1 missing';
Am I going in the right direction here?
Thanks for all the help.
>
> Resizing is dangerous, shrinking is very dangerous, and most
> filesystems don't support shrinking anyhow.
Would that mean that it is not possible to do it?
>
> > Output of /proc/mdstat: [ ... ]
>
> Why so much pointless stuff...
Sorry about that. It's just that I was apparently unable to
distinguish what would be necessary and what was not.
Cheers,
Tiago
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-06 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-05 20:35 Resize / file system and create /home in existing raid 1 Tiago Pinheiro
2008-05-05 21:53 ` Peter Grandi
2008-05-06 9:26 ` Markus Hochholdinger
2008-05-06 13:58 ` Tiago Pinheiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).