Gentoo Archives: gentoo-user

From: wabenbau@×××××.com
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] fstab/mount riddle...how?
Date: Sun, 02 Aug 2015 21:58:43
Message-Id: 20150802235734.13a4779f@hal9000.localdomain
In Reply to: [gentoo-user] fstab/mount riddle...how? by Meino.Cramer@gmx.de
1 Meino.Cramer@×××.de wrote:
2
3 > Hi,
4 >
5 > ...still fiddling with Linux on my ASUS MeMO Pad 7... ;)
6 >
7 > Current status:
8 > SDCard:
9 > Back from extFAT (toooooo slllooooooww) to FAT32
10 > On this SDCard two file, each 4GB in sizse and formatted ext4
11 > One conatins currently the complete Linux (used as chroot environment)
12 > The second one contains a copy of /usr (that is, the second image
13 > contains /usr - not only its ontents).
14 >
15 > I finally want to get rid of the /usr on the first file to get more
16 > space for upgrades, intstallations and such.
17 >
18 > While using the chrooted environment (completly booted from the first
19 > file) I did
20 >
21 > mount /dev/sdcard /mnt
22 > losetup /dev/loop(x) /mnt/frstfile.img
23 > mount /dev/loop(x) /image
24 > mount --bind /image/usr /usr
25
26 Why don't you use /usr as mount point for /dev/loop(x)?
27 AFAIK it does not matter that /usr already contains something.
28
29 > This way the /usr of the first image file was somehow
30 > "knocked off" and the (identical) /usr of the second image
31 > file tooks its place.
32
33 This should IMHO also be the case when you mount /dev/loop(x) directly
34 to /usr. But I haven't tested this. Maybe I'm wrong.
35
36 > It works so far.
37 >
38 > Now the problem:
39 > How can I manipulate /etc/fstab (and may be others) in a
40 > way that /usr of the second image file permanently replaces
41 > /usr of the first image file AND gives me the change to remove
42 > /usr of the first image file?
43
44 I think, as long as you have mounted something to /usr, you will have no
45 access to the "old" content of /usr. It is covered by the new mount.
46
47 But why don't you just delete the content of /usr before you using it as
48 mount point. I suggested this already in my last post.
49
50 I haven't tested this by myself so maybe I'm wrong, but I think as long as
51 you do this in single user mode from a simple text console with bash, it
52 should work. System components are normally not living under /usr, so
53 nothing should fail when you do this.
54
55 --
56 Regards
57 wabe