You are not logged in.
Pages: 1
I'm kind of confused on how the partitioning works. This line in one of the default configurations:
PARTITIONS='/dev/sda 100:ext2:+ *:ext4'
Seems a bit weird to me, and the wiki doesn't explain it very well. I looked in a few of the bash sources for AIF and it didn't really help me understand what's going on.
What I'm trying to do is, if possible, edit some partitions, while leaving others alone. To me, this line looks as if it erases and recreates the entire drive, which is something that I'd like to avoid if possible.
Can anyone give me a decent explanation on what the $PARTITIONS varaible does?
Offline
My guess would be it creates a 100 MB ext2 partition, makes it bootable and fills the rest of /dev/sda with ext4. Maybe you can point it to a specific partition, like /dev/sda1 instead of the whole drive.
Last edited by karol (2011-04-22 19:28:44)
Offline
Moved to Installation.
ᶘ ᵒᴥᵒᶅ
Offline
sfdisk manual doesn't give any direct answer to your question, but try the '-N' option:
-N number
Change only the single partition indicated. For example:
% sfdisk /dev/hdb -N5
,,,*
%
will make the fifth partition on /dev/hdb bootable (`active') and change nothing else. (Probably this
fifth partition is called /dev/hdb5, but you are free to call it something else, like `/my_equip‐
ment/disks/2/5' or so).
I have no idea if this can be achieved from AIF.
Offline
Moved to Installation.
Sorry about that; I naturally posted the question in the newbie corner even though I shouldn't have.
I guess that I need to rephrase my question a bit. I looked through the code and it seems a bit unclear what AIF does with this particular string. I don't think that it directly relates to anything in sfdisk/cfdisk/whatever that AIF uses.
Offline
Have you tried the example from tests/runtime/automatic-reuse-fs-sda/profile?
Offline
I looked through the code and it seems a bit unclear what AIF does with this particular string. I don't think that it directly relates to anything in sfdisk/cfdisk/whatever that AIF uses.
https://github.com/Dieterbe/aif/blob/ma … systems.sh
# partitions a disk. heavily altered
# $1 device to partition
# $2 a string of the form: <partsize in MiB>:<fstype>[:+] (the + is bootable flag)
partition()
{
debug 'FS' "Partition called like: partition '$1' '$2'"
[ -z "$1" ] && die_error "partition() requires a device file and a partition string"
[ -z "$2" ] && die_error "partition() requires a partition string"
DEVICE=$1
STRING=$2
# validate DEVICE
if [ ! -b "$DEVICE" ]; then
notify "Device '$DEVICE' is not valid"
return 1
fi
target_umountall
# setup input var for sfdisk
# format: each line=1 part. <start> <size> <id> <bootable>[ <c,h,s> <c,h,s>]
read -r -a fsspecs <<< "$STRING" # split up like this otherwise '*' will be globbed. which usually means an entry containing * is lost
for fsspec in "${fsspecs[@]}"; do
fssize=$(echo $fsspec | tr -d ' ' | cut -f1 -d:)
fssize_spec=",$fssize"
[ "$fssize" = "*" ] && fssize_spec=';'
fstype=$(echo $fsspec | tr -d ' ' | cut -f2 -d:)
fstype_spec=","
[ "$fstype" = "swap" ] && fstype_spec=",S"
bootflag=$(echo $fsspec | tr -d ' ' | cut -f3 -d:)
bootflag_spec=""
[ "$bootflag" = "+" ] && bootflag_spec=",*"
sfdisk_input="${sfdisk_input}${fssize_spec}${fstype_spec}${bootflag_spec}\n"
done
sfdisk_input=$(printf "$sfdisk_input") # convert \n to newlines
# invoke sfdisk
debug 'FS' "Partition calls: sfdisk $DEVICE -uM >$LOG 2>&1 <<< $sfdisk_input"
printk off
sfdisk -D $DEVICE -uM >$LOG 2>&1 <<EOF
$sfdisk_input
EOF
if [ $? -gt 0 ]; then
notify "Error partitioning $DEVICE (see $LOG for details)"
printk on
return 1
fi
printk on
return 0
}
Seems it chops that string
for fsspec in "${fsspecs[@]}"; do
fssize=$(echo $fsspec | tr -d ' ' | cut -f1 -d:)
fssize_spec=",$fssize"
[ "$fssize" = "*" ] && fssize_spec=';'
and passes it to sfdisk
sfdisk_input="${sfdisk_input}${fssize_spec}${fstype_spec}${bootflag_spec}\n"
Offline
Ah, for some reason, I seemed to have skipped over that function.
I thought that it was for the mount points and such, rather than the partitioning.
Thanks for the help.
Offline
Pages: 1